Skip to content

Commit cc9dd33

Browse files
authored
Merge pull request #179 from xrstf/etcd-probes
add probes to etcd statefulsets
2 parents 5bb3b1d + 4cea585 commit cc9dd33

File tree

5 files changed

+101
-4
lines changed

5 files changed

+101
-4
lines changed

charts/kcp/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: kcp
33
description: A prototype of a multi-tenant Kubernetes control plane for workloads on many clusters
44

55
# version information
6-
version: 0.12.7
6+
version: 0.12.8
77
appVersion: "0.28.3"
88

99
# optional metadata

charts/kcp/templates/etcd-statefulset.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{{- if .Values.etcd.enabled -}}
1+
# This file is based on https://etcd.io/docs/v3.5/op-guide/kubernetes/
2+
3+
{{ if .Values.etcd.enabled -}}
24
apiVersion: v1
35
kind: Service
46
metadata:
@@ -15,6 +17,10 @@ spec:
1517
- port: 2380
1618
name: peer
1719
appProtocol: https
20+
- port: 8080
21+
name: metrics
22+
appProtocol: http
23+
publishNotReadyAddresses: true
1824
selector:
1925
{{- include "common.labels.selector" . | nindent 4 }}
2026
app.kubernetes.io/component: "etcd"
@@ -34,6 +40,9 @@ spec:
3440
{{- include "common.labels.selector" . | nindent 6 }}
3541
app.kubernetes.io/component: "etcd"
3642
replicas: 3
43+
podManagementPolicy: Parallel
44+
updateStrategy:
45+
type: RollingUpdate
3746
template:
3847
metadata:
3948
labels:
@@ -68,6 +77,7 @@ spec:
6877
- --initial-cluster-token=etcd-cluster-1
6978
- --initial-cluster=$(PEERS)
7079
- --initial-cluster-state=new
80+
- --listen-metrics-urls=http://0.0.0.0:8080
7181
- --auto-compaction-mode=periodic
7282
- --auto-compaction-retention=5m
7383
- --data-dir=/var/run/etcd/default.etcd
@@ -95,10 +105,29 @@ spec:
95105
name: client
96106
- containerPort: 2380
97107
name: peer
108+
- containerPort: 8080
109+
name: metrics
98110
{{- with .Values.etcd.resources }}
99111
resources:
100112
{{- toYaml . | nindent 12 }}
101113
{{- end }}
114+
readinessProbe:
115+
httpGet:
116+
path: /readyz
117+
port: 8080
118+
initialDelaySeconds: 10
119+
periodSeconds: 5
120+
timeoutSeconds: 5
121+
successThreshold: 1
122+
failureThreshold: 30
123+
livenessProbe:
124+
httpGet:
125+
path: /livez
126+
port: 8080
127+
initialDelaySeconds: 15
128+
periodSeconds: 10
129+
timeoutSeconds: 5
130+
failureThreshold: 3
102131
volumeMounts:
103132
- name: etcd-data
104133
mountPath: /var/run/etcd

charts/shard/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: shard
33
description: A prototype of a multi-tenant Kubernetes control plane for workloads on many clusters
44

55
# version information
6-
version: 0.0.5
6+
version: 0.0.6
77
appVersion: "0.22.0"
88

99
# optional metadata

charts/shard/templates/etcd-statefulset.yaml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{{- if .Values.etcd.enabled -}}
1+
# This file is based on https://etcd.io/docs/v3.5/op-guide/kubernetes/
2+
3+
{{ if .Values.etcd.enabled -}}
24
apiVersion: v1
35
kind: Service
46
metadata:
@@ -11,8 +13,14 @@ spec:
1113
ports:
1214
- port: 2379
1315
name: client
16+
appProtocol: https
1417
- port: 2380
1518
name: peer
19+
appProtocol: https
20+
- port: 8080
21+
name: metrics
22+
appProtocol: http
23+
publishNotReadyAddresses: true
1624
selector:
1725
{{- include "common.labels.selector" . | nindent 4 }}
1826
app.kubernetes.io/component: "etcd"
@@ -32,12 +40,30 @@ spec:
3240
{{- include "common.labels.selector" . | nindent 6 }}
3341
app.kubernetes.io/component: "etcd"
3442
replicas: 3
43+
podManagementPolicy: Parallel
44+
updateStrategy:
45+
type: RollingUpdate
3546
template:
3647
metadata:
3748
labels:
3849
{{- include "common.labels" . | nindent 8 }}
3950
app.kubernetes.io/component: "etcd"
4051
spec:
52+
{{- with .Values.etcd.affinity}}
53+
affinity:
54+
{{- toYaml . | nindent 8 }}
55+
{{- end }}
56+
{{- with .Values.etcd.tolerations }}
57+
tolerations:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- if .Values.global.imagePullSecrets }}
61+
imagePullSecrets:
62+
{{- include "kcp.imagePullSecrets" . | trim | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.etcd.priorityClassName }}
65+
priorityClassName: {{ . }}
66+
{{- end }}
4167
containers:
4268
- name: etcd
4369
image: {{ .Values.etcd.image }}:{{ .Values.etcd.tag }}
@@ -51,6 +77,7 @@ spec:
5177
- --initial-cluster-token=etcd-cluster-1
5278
- --initial-cluster=$(PEERS)
5379
- --initial-cluster-state=new
80+
- --listen-metrics-urls=http://0.0.0.0:8080
5481
- --auto-compaction-mode=periodic
5582
- --auto-compaction-retention=5m
5683
- --data-dir=/var/run/etcd/default.etcd
@@ -78,10 +105,29 @@ spec:
78105
name: client
79106
- containerPort: 2380
80107
name: peer
108+
- containerPort: 8080
109+
name: metrics
81110
{{- with .Values.etcd.resources }}
82111
resources:
83112
{{- toYaml . | nindent 12 }}
84113
{{- end }}
114+
readinessProbe:
115+
httpGet:
116+
path: /readyz
117+
port: 8080
118+
initialDelaySeconds: 10
119+
periodSeconds: 5
120+
timeoutSeconds: 5
121+
successThreshold: 1
122+
failureThreshold: 30
123+
livenessProbe:
124+
httpGet:
125+
path: /livez
126+
port: 8080
127+
initialDelaySeconds: 15
128+
periodSeconds: 10
129+
timeoutSeconds: 5
130+
failureThreshold: 3
85131
volumeMounts:
86132
- name: etcd-data
87133
mountPath: /var/run/etcd
@@ -114,4 +160,7 @@ spec:
114160
resources:
115161
requests:
116162
storage: {{ .Values.etcd.volumeSize }}
163+
{{- with .Values.etcd.storageClassName }}
164+
storageClassName: {{ . }}
165+
{{- end }}
117166
{{- end }}

charts/shard/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,27 @@ etcd:
1919
# cpu: 1
2020
memory: 20Gi
2121
volumeSize: 8Gi
22+
# StorageClass to use for etcd data volumes.
23+
storageClassName: ""
2224
profiling:
2325
enabled: false
26+
podDisruptionBudget:
27+
enabled: false
28+
maxUnavailable: 1
29+
tolerations: []
30+
priorityClassName: ""
31+
affinity:
32+
podAntiAffinity:
33+
preferredDuringSchedulingIgnoredDuringExecution:
34+
- weight: 1
35+
podAffinityTerm:
36+
labelSelector:
37+
matchExpressions:
38+
- key: "app.kubernetes.io/component"
39+
operator: In
40+
values:
41+
- etcd
42+
topologyKey: "kubernetes.io/hostname"
2443
kcp:
2544
enabled: true
2645
sharding:

0 commit comments

Comments
 (0)