cue: implementation of marked defaults

Change-Id: I7b0ed2b1e372a71410cbd05253ca819f08509a2a
diff --git a/doc/tutorial/kubernetes/manual/services/cloud.cue b/doc/tutorial/kubernetes/manual/services/cloud.cue
index 27fdb1a..4ba6142 100644
--- a/doc/tutorial/kubernetes/manual/services/cloud.cue
+++ b/doc/tutorial/kubernetes/manual/services/cloud.cue
@@ -12,11 +12,10 @@
 }
 
 deployment <Name>: _base & {
-	name:     Name | string
-// jba: why do you need to write "Name | string"? Doesn't the grammar require that the value
-// of <Name> is a string?
+	// Allow any string, but take Name by default.
+	name:     string | *Name
 	kind:     "deployment" | "stateful" | "daemon"
-	replicas: 1 | int
+	replicas: int | *1
 
 	image: string
 
@@ -36,10 +35,10 @@
 	envSpec: {"\(k)" value: v for k, v in env}
 
 	volume <Name>: {
-		name:      Name | string
+		name:      string | *Name
 		mountPath: string
-		subPath:   null | string
-		readOnly:  false | true
+		subPath:   string | *null
+		readOnly:  *false | true
 		kubernetes: {}
 	}
 }
@@ -48,11 +47,11 @@
 	name: Name | string
 
 	port <Name>: {
-		name: Name | string
+		name: string | *Name
 
 		port:       int
-		targetPort: port | int
-		protocol:   "TCP" | "UDP"
+		targetPort: int | *port
+		protocol:   *"TCP" | "UDP"
 	}
 
 	kubernetes: {}
@@ -66,10 +65,11 @@
 
 	// Copy over all ports exposed from containers.
 	port "\(Name)": {
-		port:       Port | int
-// jba: Port must be defined, so why do you need "| int"?
-		targetPort: Port | int
-// jba: I don't think you need targetPort, because it's defined above in terms of port.
+		// Set default external port to Port.
+		port:       int | *Port
+		targetPort: int | *Port
+		// TODO(verify): jba: I don't think you need targetPort, because it's defined above in terms of port.
+		// Should probably be Port fixed.
 	} for Name, Port in spec.expose.port
 
 	// Copy over the labels
diff --git a/doc/tutorial/kubernetes/manual/services/frontend/kube.cue b/doc/tutorial/kubernetes/manual/services/frontend/kube.cue
index b01c302..c8d47e8 100644
--- a/doc/tutorial/kubernetes/manual/services/frontend/kube.cue
+++ b/doc/tutorial/kubernetes/manual/services/frontend/kube.cue
@@ -3,7 +3,7 @@
 _base label component: "frontend"
 
 deployment <Name>: {
-	expose port http: 7080 | int
+	expose port http: *7080 | int
 	kubernetes spec template metadata annotations: {
 		"prometheus.io.scrape": "true"
 		"prometheus.io.port":   "\(expose.port.http)"
diff --git a/doc/tutorial/kubernetes/manual/services/kitchen/kube.cue b/doc/tutorial/kubernetes/manual/services/kitchen/kube.cue
index 00a5466..40344c0 100644
--- a/doc/tutorial/kubernetes/manual/services/kitchen/kube.cue
+++ b/doc/tutorial/kubernetes/manual/services/kitchen/kube.cue
@@ -30,16 +30,16 @@
 	// Volumes
 	volume "\(name)-disk": {
 		name:      string
-		mountPath: "/logs" | string
+		mountPath: *"/logs" | string
 		spec gcePersistentDisk: {
-			pdName: name | string
+			pdName: *name | string
 			fsType: "ext4"
 		}
 	}
 
 	volume "secret-\(name)": {
-		mountPath: "/etc/certs" | string
+		mountPath: *"/etc/certs" | string
 		readOnly:  true
-		spec secret secretName: "\(name)-secrets" | string
+		spec secret secretName: *"\(name)-secrets" | string
 	}
 }