...

Text file src/cuelang.org/go/doc/tutorial/kubernetes/quick/services/kitchen/kube.cue

Documentation: cuelang.org/go/doc/tutorial/kubernetes/quick/services/kitchen

     1package kube
     2
     3#Component: "kitchen"
     4
     5deployment: [string]: spec: template: {
     6	metadata: annotations: "prometheus.io.scrape": "true"
     7	spec: containers: [{
     8		ports: [{
     9			containerPort: 8080
    10		}]
    11		livenessProbe: {
    12			httpGet: {
    13				path: "/debug/health"
    14				port: 8080
    15			}
    16			initialDelaySeconds: 40
    17			periodSeconds:       3
    18		}
    19	}]
    20}
    21
    22deployment: [ID=_]: spec: template: spec: {
    23	_hasDisks: *true | bool
    24
    25	// field comprehension using just "if"
    26	if _hasDisks {
    27		volumes: [{
    28			name: *"\(ID)-disk" | string
    29			gcePersistentDisk: pdName: *"\(ID)-disk" | string
    30			gcePersistentDisk: fsType: "ext4"
    31		}, {
    32			name: *"secret-\(ID)" | string
    33			secret: secretName: *"\(ID)-secrets" | string
    34		}, ...]
    35
    36		containers: [{
    37			volumeMounts: [{
    38				name:      *"\(ID)-disk" | string
    39				mountPath: *"/logs" | string
    40			}, {
    41				mountPath: *"/etc/certs" | string
    42				name:      *"secret-\(ID)" | string
    43				readOnly:  true
    44			}, ...]
    45		}]
    46	}
    47}

View as plain text