github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/doc/tutorial/kubernetes/quick/services/infra/etcd/kube.cue (about)

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