Skip to content

Commit 86536cd

Browse files
authored
Merge pull request #37 from FabianKramm/main
build(chart): syncer liveness & readiness probes
2 parents 0169394 + f7ffabc commit 86536cd

File tree

4 files changed

+56
-9
lines changed

4 files changed

+56
-9
lines changed

chart/templates/statefulset.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ metadata:
88
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
99
release: "{{ .Release.Name }}"
1010
heritage: "{{ .Release.Service }}"
11+
{{- if .Values.labels }}
12+
{{ toYaml .Values.labels | indent 4 }}
13+
{{- end }}
14+
{{- if .Values.annotations }}
15+
annotations:
16+
{{ toYaml .Values.annotations | indent 4 }}
17+
{{- end }}
1118
spec:
1219
serviceName: {{ .Release.Name }}-headless
1320
replicas: {{ .Values.replicas }}
@@ -60,6 +67,7 @@ spec:
6067
{{- end }}
6168
{{- end }}
6269
containers:
70+
{{- if not .Values.vcluster.disabled }}
6371
- image: {{ .Values.vcluster.image }}
6472
name: vcluster
6573
command:
@@ -79,6 +87,8 @@ spec:
7987
{{ toYaml .Values.vcluster.volumeMounts | indent 10 }}
8088
resources:
8189
{{ toYaml .Values.vcluster.resources | indent 10 }}
90+
{{- end }}
91+
{{- if not .Values.syncer.disabled }}
8292
- name: syncer
8393
{{- if .Values.syncer.image }}
8494
image: "{{ .Values.syncer.image }}"
@@ -97,10 +107,35 @@ spec:
97107
{{- else }}
98108
args:
99109
{{ toYaml .Values.syncer.extraArgs | indent 10 }}
110+
{{- end }}
111+
{{- if .Values.syncer.livenessProbe }}
112+
{{- if .Values.syncer.livenessProbe.enabled }}
113+
livenessProbe:
114+
httpGet:
115+
path: /healthz
116+
port: 8443
117+
scheme: HTTPS
118+
failureThreshold: 15
119+
initialDelaySeconds: 5
120+
periodSeconds: 10
121+
{{- end }}
122+
{{- end }}
123+
{{- if .Values.syncer.readinessProbe }}
124+
{{- if .Values.syncer.readinessProbe.enabled }}
125+
readinessProbe:
126+
httpGet:
127+
path: /readyz
128+
port: 8443
129+
scheme: HTTPS
130+
failureThreshold: 15
131+
initialDelaySeconds: 5
132+
periodSeconds: 10
133+
{{- end }}
100134
{{- end }}
101135
env:
102136
{{ toYaml .Values.syncer.env | indent 10 }}
103137
volumeMounts:
104138
{{ toYaml .Values.syncer.volumeMounts | indent 10 }}
105139
resources:
106140
{{ toYaml .Values.syncer.resources | indent 10 }}
141+
{{- end }}

chart/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ syncer:
44
# image: loftsh/vcluster
55
extraArgs: []
66
env: []
7+
livenessProbe:
8+
enabled: true
9+
readinessProbe:
10+
enabled: true
711
volumeMounts:
812
- mountPath: /data
913
name: data
@@ -78,6 +82,12 @@ affinity: {}
7882
# Tolerations to apply to the vcluster statefulset
7983
tolerations: []
8084

85+
# Extra Labels for the stateful set
86+
labels: {}
87+
88+
# Extra Annotations for the stateful set
89+
annotations: {}
90+
8191
# Service configurations
8292
service:
8393
type: ClusterIP

cmd/vcluster/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func Execute(cobraCmd *cobra.Command, args []string, options *context.VirtualClu
175175
return false, nil
176176
}
177177

178+
time.Sleep(time.Second)
178179
return true, nil
179180
})
180181
if err != nil {

devspace.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ deployments:
2121
vcluster:
2222
image: rancher/k3s:v1.20.5-k3s1
2323
extraArgs:
24-
- --service-cidr=10.68.0.0/20
24+
- --service-cidr=10.96.0.0/12
2525
rbac:
2626
clusterRole:
2727
create: true
2828
syncer:
29+
readinessProbe:
30+
enabled: false
31+
livenessProbe:
32+
enabled: false
2933
image: ghcr.io/loft-sh/loft-enterprise/dev-vcluster
3034
noArgs: true
3135
dev:
@@ -73,6 +77,10 @@ profiles:
7377
containerName: syncer
7478
replaceImage: golang:1.16
7579
patches:
80+
- path: spec.containers[1].livenessProbe
81+
op: remove
82+
- path: spec.containers[1].readinessProbe
83+
op: remove
7684
- path: spec.containers[1].workingDir
7785
op: replace
7886
value: /vcluster
@@ -101,16 +109,9 @@ profiles:
101109
chart:
102110
name: ./chart
103111
values:
104-
serviceAccount:
105-
create: false
106-
name: default
107112
vcluster:
108113
image: rancher/k3s:v1.20.5-k3s1
109114
extraArgs:
110-
- --service-cidr=10.68.0.0/20
111-
rbac:
112-
clusterRole:
113-
create: true
115+
- --service-cidr=10.96.0.0/12
114116
syncer:
115117
image: ghcr.io/loft-sh/loft-enterprise/dev-vcluster
116-
extraArgs: []

0 commit comments

Comments
 (0)