...

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

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

     1package kube
     2
     3service: etcd: spec: {
     4	clusterIP: "None"
     5	ports: [{
     6	}, {
     7		name: "peer"
     8	}]
     9}
    10statefulSet: etcd: spec: {
    11	serviceName: "etcd"
    12	replicas:    3
    13	template: {
    14		metadata: annotations: {
    15			"prometheus.io.scrape": "true"
    16			"prometheus.io.port":   "2379"
    17		}
    18		spec: {
    19			affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: [{
    20				labelSelector: matchExpressions: [{
    21					key:      "app"
    22					operator: "In"
    23					values: ["etcd"]
    24				}]
    25				topologyKey: "kubernetes.io/hostname"
    26			}]
    27			terminationGracePeriodSeconds: 10
    28			containers: [{
    29				image: "quay.io/coreos/etcd:v3.3.10"
    30				ports: [{
    31					name:          "client"
    32					containerPort: 2379
    33				}, {
    34					name:          "peer"
    35					containerPort: 2380
    36				}]
    37				livenessProbe: {
    38					httpGet: {
    39						path: "/health"
    40						port: "client"
    41					}
    42					initialDelaySeconds: 30
    43				}
    44				volumeMounts: [{
    45					name:      "etcd3"
    46					mountPath: "/data"
    47				}]
    48				env: [{
    49					name:  "ETCDCTL_API"
    50					value: "3"
    51				}, {
    52					name:  "ETCD_AUTO_COMPACTION_RETENTION"
    53					value: "4"
    54				}, {
    55					name: "NAME"
    56					valueFrom: fieldRef: fieldPath: "metadata.name"
    57				}, {
    58					name: "IP"
    59					valueFrom: fieldRef: fieldPath: "status.podIP"
    60				}]
    61				command: ["/usr/local/bin/etcd"]
    62				args: [
    63					"-name",
    64					"$(NAME)",
    65					"-data-dir",
    66					"/data/etcd3",
    67					"-initial-advertise-peer-urls",
    68					"http://$(IP):2380",
    69					"-listen-peer-urls",
    70					"http://$(IP):2380",
    71					"-listen-client-urls",
    72					"http://$(IP):2379,http://127.0.0.1:2379",
    73					"-advertise-client-urls",
    74					"http://$(IP):2379",
    75					"-discovery",
    76					"https://discovery.etcd.io/xxxxxx",
    77				]
    78			}]
    79		}
    80	}
    81	// bootstrap
    82	// "-initial-cluster-token", "etcd-prod-events2",
    83
    84	volumeClaimTemplates: [{
    85		metadata: {
    86			name: "etcd3"
    87			annotations: "volume.alpha.kubernetes.io/storage-class": "default"
    88		}
    89		spec: {
    90			accessModes: ["ReadWriteOnce"]
    91			resources: requests: storage: "10Gi"
    92		}
    93	}]
    94}

View as plain text