Skip to content

Commit 541de7a

Browse files
authored
Merge pull request #2063 from beyonnex-io/enhance-helm-chart-startup
Enhance Helm chart by startupProbe
2 parents 70ed644 + 2a87bd2 commit 541de7a

11 files changed

+275
-122
lines changed

deployment/helm/ditto/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: |
1616
A digital twin is a virtual, cloud based, representation of his real world counterpart
1717
(real world “Things”, e.g. devices like sensors, smart heating, connected cars, smart grids, EV charging stations etc).
1818
type: application
19-
version: 3.6.2 # chart version is effectively set by release-job
19+
version: 3.6.3 # chart version is effectively set by release-job
2020
appVersion: 3.6.2
2121
keywords:
2222
- iot-chart

deployment/helm/ditto/scripts/patch-pods-deletion-cost.sh

+12-8
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ curl --fail --silent --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" \
2525
"https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/namespaces/${NAMESPACE}/pods" \
2626
| jq '.items | map(select(.metadata.labels.actorSystemName == "ditto-cluster") | { pod: .metadata.name, ip: .status.podIP, cost: .metadata.annotations."controller.kubernetes.io/pod-deletion-cost"})' \
2727
> pod_ip_cost.json
28-
if [ $? -ne 0 ]; then
29-
echo "Retrieving current pods curl failed [exit-code: $?]"
28+
curlExitCode=$?
29+
if [ $curlExitCode -ne 0 ]; then
30+
echo "Retrieving current pods curl failed [exit-code: $curlExitCode]"
3031
exit 1
3132
fi
3233

3334
# extract the first internal IP from `pod_ip_cost.json` in order to lookup Apache Pekko cluster membership data:
3435
somePekkoClusterIp=$(jq -r '.[0].ip' pod_ip_cost.json)
3536
echo "Accessing current Pekko Cluster members from internal ip: $somePekkoClusterIp ..."
3637
curl --fail --silent -o pekko_cluster_members.json http://$somePekkoClusterIp:7626/cluster/members
37-
if [ $? -ne 0 ]; then
38-
echo "Accessing current Pekko Cluster members curl failed [exit-code: $?]"
38+
curlExitCode=$?
39+
if [ $curlExitCode -ne 0 ]; then
40+
echo "Accessing current Pekko Cluster members curl failed [exit-code: $curlExitCode]"
3941
exit 1
4042
fi
4143

@@ -64,8 +66,9 @@ while read pod; do
6466
curl -X PATCH --silent --output /dev/null --show-error --fail --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" -H 'Content-Type: application/merge-patch+json' \
6567
"https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/namespaces/${NAMESPACE}/pods/${pod}" \
6668
--data '{"metadata": {"annotations": {"controller.kubernetes.io/pod-deletion-cost": null }}}'
67-
if [ $? -ne 0 ]; then
68-
echo "Clearing pod-deletion-cost curl failed [exit-code: $?]"
69+
curlExitCode=$?
70+
if [ $curlExitCode -ne 0 ]; then
71+
echo "Clearing pod-deletion-cost curl failed [exit-code: $curlExitCode]"
6972
exit 1
7073
fi
7174
fi
@@ -78,8 +81,9 @@ jq -r '.[] | [.pod, .ip, .cost] | @tsv' new_cost_pod_and_ip.json |
7881
curl -X PATCH --silent --output /dev/null --show-error --fail --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" -H 'Content-Type: application/merge-patch+json' \
7982
"https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/namespaces/${NAMESPACE}/pods/${pod}" \
8083
--data '{"metadata": {"annotations": {"controller.kubernetes.io/pod-deletion-cost": '\""$cost"\"' }}}'
81-
if [ $? -ne 0 ]; then
82-
echo "Patching pod-deletion-cost curl failed [exit-code: $?]"
84+
curlExitCode=$?
85+
if [ $curlExitCode -ne 0 ]; then
86+
echo "Patching pod-deletion-cost curl failed [exit-code: $curlExitCode]"
8387
exit 1
8488
fi
8589
done

deployment/helm/ditto/templates/connectivity-deployment.yaml

+24-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
# http://www.eclipse.org/legal/epl-2.0
99
#
1010
# SPDX-License-Identifier: EPL-2.0
11+
{{- $name := include "ditto.name" . -}}
1112
{{- if .Values.connectivity.enabled -}}
1213
---
1314
apiVersion: apps/v1
1415
kind: Deployment
1516
metadata:
1617
name: {{ include "ditto.fullname" . }}-connectivity
1718
labels:
18-
app.kubernetes.io/name: {{ include "ditto.name" . }}-connectivity
19+
app.kubernetes.io/name: {{ $name }}-connectivity
1920
{{ include "ditto.labels" . | indent 4 }}
2021
spec:
2122
replicas: {{ .Values.connectivity.replicaCount }}
@@ -26,12 +27,12 @@ spec:
2627
minReadySeconds: {{ .Values.connectivity.minReadySeconds }}
2728
selector:
2829
matchLabels:
29-
app.kubernetes.io/name: {{ include "ditto.name" . }}-connectivity
30+
app.kubernetes.io/name: {{ $name }}-connectivity
3031
app.kubernetes.io/instance: {{ .Release.Name }}
3132
template:
3233
metadata:
3334
labels:
34-
app.kubernetes.io/name: {{ include "ditto.name" . }}-connectivity
35+
app.kubernetes.io/name: {{ $name }}-connectivity
3536
app.kubernetes.io/instance: {{ .Release.Name }}
3637
actorSystemName: {{ .Values.pekko.actorSystemName }}
3738
{{- with .Values.connectivity.additionalLabels }}
@@ -45,6 +46,9 @@ spec:
4546
{{- end }}
4647
checksum/mongodb-config: {{ include (print $.Template.BasePath "/mongodb-secret.yaml") . | sha256sum }}
4748
checksum/config: {{ include (print $.Template.BasePath "/connectivity-configmap.yaml") . | sha256sum }}
49+
{{- with .Values.global.additionalAnnotations }}
50+
{{- toYaml . | nindent 8 }}
51+
{{- end }}
4852
{{- with .Values.connectivity.additionalAnnotations }}
4953
{{- toYaml . | nindent 8 }}
5054
{{- end }}
@@ -70,12 +74,14 @@ spec:
7074
mountPath: /var/log/ditto
7175
{{- end }}
7276
topologySpreadConstraints:
73-
- maxSkew: {{ .Values.connectivity.topologySpreadConstraints.maxSkew }}
74-
topologyKey: {{ .Values.connectivity.topologySpreadConstraints.topologyKey }}
75-
whenUnsatisfiable: {{ .Values.connectivity.topologySpreadConstraints.whenUnsatisfiable }}
77+
{{- range .Values.connectivity.topologySpreadConstraints }}
78+
- maxSkew: {{ .maxSkew }}
79+
topologyKey: {{ .topologyKey }}
80+
whenUnsatisfiable: {{ .whenUnsatisfiable }}
7681
labelSelector:
7782
matchLabels:
78-
app.kubernetes.io/name: {{ include "ditto.name" . }}-connectivity
83+
app.kubernetes.io/name: {{ $name }}-connectivity
84+
{{- end }}
7985
containers:
8086
- name: {{ .Chart.Name }}-connectivity
8187
image: {{ printf "%s:%s" .Values.connectivity.image.repository ( default .Chart.AppVersion ( default .Values.dittoTag .Values.connectivity.image.tag ) ) }}
@@ -312,11 +318,19 @@ spec:
312318
protocol: TCP
313319
containerPort: {{ .Values.global.prometheus.port }}
314320
{{- end }}
321+
startupProbe:
322+
httpGet:
323+
port: management
324+
path: /ready
325+
initialDelaySeconds: {{ .Values.connectivity.startupProbe.initialDelaySeconds }}
326+
periodSeconds: {{ .Values.connectivity.startupProbe.periodSeconds }}
327+
timeoutSeconds: {{ .Values.connectivity.startupProbe.timeoutSeconds }}
328+
successThreshold: {{ .Values.connectivity.startupProbe.successThreshold }}
329+
failureThreshold: {{ .Values.connectivity.startupProbe.failureThreshold }}
315330
readinessProbe:
316331
httpGet:
317332
port: management
318333
path: /ready
319-
initialDelaySeconds: {{ .Values.connectivity.readinessProbe.initialDelaySeconds }}
320334
periodSeconds: {{ .Values.connectivity.readinessProbe.periodSeconds }}
321335
timeoutSeconds: {{ .Values.connectivity.readinessProbe.timeoutSeconds }}
322336
successThreshold: {{ .Values.connectivity.readinessProbe.successThreshold }}
@@ -352,11 +366,13 @@ spec:
352366
requests:
353367
cpu: {{ mulf .Values.connectivity.resources.cpu 1000 }}m
354368
memory: {{ .Values.connectivity.resources.memoryMi }}Mi
369+
ephemeral-storage: {{ .Values.connectivity.resources.ephemeralStorageMi }}Mi
355370
limits:
356371
# ## no cpu limit to avoid CFS scheduler limits
357372
# ref: https://pekko.apache.org/docs/pekko/current/additional/deploying.html#deploying-to-kubernetes
358373
# cpu: ""
359374
memory: {{ .Values.connectivity.resources.memoryMi }}Mi
375+
ephemeral-storage: {{ .Values.connectivity.resources.ephemeralStorageMi }}Mi
360376
{{- if .Values.openshift.enabled }}
361377
{{- with .Values.openshift.securityContext }}
362378
securityContext:

deployment/helm/ditto/templates/dittoui-deployment.yaml

+12-7
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
# http://www.eclipse.org/legal/epl-2.0
99
#
1010
# SPDX-License-Identifier: EPL-2.0
11+
{{- $name := include "ditto.name" . -}}
1112
{{- if .Values.dittoui.enabled -}}
1213
---
1314
apiVersion: apps/v1
1415
kind: Deployment
1516
metadata:
1617
name: {{ include "ditto.fullname" . }}-dittoui
1718
labels:
18-
app.kubernetes.io/name: {{ include "ditto.name" . }}-dittoui
19+
app.kubernetes.io/name: {{ $name }}-dittoui
1920
{{ include "ditto.labels" . | indent 4 }}
2021
spec:
2122
replicas: {{ .Values.dittoui.replicaCount }}
@@ -25,12 +26,12 @@ spec:
2526
{{- end }}
2627
selector:
2728
matchLabels:
28-
app.kubernetes.io/name: {{ include "ditto.name" . }}-dittoui
29+
app.kubernetes.io/name: {{ $name }}-dittoui
2930
app.kubernetes.io/instance: {{ .Release.Name }}
3031
template:
3132
metadata:
3233
labels:
33-
app.kubernetes.io/name: {{ include "ditto.name" . }}-dittoui
34+
app.kubernetes.io/name: {{ $name }}-dittoui
3435
app.kubernetes.io/instance: {{ .Release.Name }}
3536
{{- with .Values.dittoui.additionalLabels }}
3637
{{- toYaml . | nindent 8 }}
@@ -45,12 +46,14 @@ spec:
4546
{{- toYaml . | nindent 8 }}
4647
{{- end }}
4748
topologySpreadConstraints:
48-
- maxSkew: {{ .Values.dittoui.topologySpreadConstraints.maxSkew }}
49-
topologyKey: {{ .Values.dittoui.topologySpreadConstraints.topologyKey }}
50-
whenUnsatisfiable: {{ .Values.dittoui.topologySpreadConstraints.whenUnsatisfiable }}
49+
{{- range .Values.dittoui.topologySpreadConstraints }}
50+
- maxSkew: {{ .maxSkew }}
51+
topologyKey: {{ .topologyKey }}
52+
whenUnsatisfiable: {{ .whenUnsatisfiable }}
5153
labelSelector:
5254
matchLabels:
53-
app.kubernetes.io/name: {{ include "ditto.name" . }}-dittoui
55+
app.kubernetes.io/name: {{ $name }}-dittoui
56+
{{- end }}
5457
containers:
5558
- name: {{ .Chart.Name }}-dittoui
5659
image: {{ printf "%s:%s" .Values.dittoui.image.repository ( default .Chart.AppVersion ( default .Values.dittoTag .Values.dittoui.image.tag ) ) }}
@@ -67,9 +70,11 @@ spec:
6770
requests:
6871
cpu: {{ mulf .Values.dittoui.resources.cpu 1000 }}m
6972
memory: {{ .Values.dittoui.resources.memoryMi }}Mi
73+
ephemeral-storage: {{ .Values.dittoui.resources.ephemeralStorageMi }}Mi
7074
limits:
7175
# cpu: # don't limit
7276
memory: {{ .Values.dittoui.resources.memoryMi }}Mi
77+
ephemeral-storage: {{ .Values.dittoui.resources.ephemeralStorageMi }}Mi
7378
securityContext:
7479
runAsNonRoot: true
7580
runAsUser: 101

deployment/helm/ditto/templates/gateway-deployment.yaml

+24-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
# http://www.eclipse.org/legal/epl-2.0
99
#
1010
# SPDX-License-Identifier: EPL-2.0
11+
{{- $name := include "ditto.name" . -}}
1112
{{- if .Values.gateway.enabled -}}
1213
---
1314
apiVersion: apps/v1
1415
kind: Deployment
1516
metadata:
1617
name: {{ include "ditto.fullname" . }}-gateway
1718
labels:
18-
app.kubernetes.io/name: {{ include "ditto.name" . }}-gateway
19+
app.kubernetes.io/name: {{ $name }}-gateway
1920
{{ include "ditto.labels" . | indent 4 }}
2021
spec:
2122
replicas: {{ .Values.gateway.replicaCount }}
@@ -26,12 +27,12 @@ spec:
2627
minReadySeconds: {{ .Values.gateway.minReadySeconds }}
2728
selector:
2829
matchLabels:
29-
app.kubernetes.io/name: {{ include "ditto.name" . }}-gateway
30+
app.kubernetes.io/name: {{ $name }}-gateway
3031
app.kubernetes.io/instance: {{ .Release.Name }}
3132
template:
3233
metadata:
3334
labels:
34-
app.kubernetes.io/name: {{ include "ditto.name" . }}-gateway
35+
app.kubernetes.io/name: {{ $name }}-gateway
3536
app.kubernetes.io/instance: {{ .Release.Name }}
3637
actorSystemName: {{ .Values.pekko.actorSystemName }}
3738
{{- with .Values.gateway.additionalLabels }}
@@ -45,6 +46,9 @@ spec:
4546
{{- end }}
4647
checksum/password-config: {{ include (print $.Template.BasePath "/gateway-secret.yaml") . | sha256sum }}
4748
checksum/config: {{ include (print $.Template.BasePath "/gateway-configmap.yaml") . | sha256sum }}
49+
{{- with .Values.global.additionalAnnotations }}
50+
{{- toYaml . | nindent 8 }}
51+
{{- end }}
4852
{{- with .Values.gateway.additionalAnnotations }}
4953
{{- toYaml . | nindent 8 }}
5054
{{- end }}
@@ -70,12 +74,14 @@ spec:
7074
mountPath: /var/log/ditto
7175
{{- end }}
7276
topologySpreadConstraints:
73-
- maxSkew: {{ .Values.gateway.topologySpreadConstraints.maxSkew }}
74-
topologyKey: {{ .Values.gateway.topologySpreadConstraints.topologyKey }}
75-
whenUnsatisfiable: {{ .Values.gateway.topologySpreadConstraints.whenUnsatisfiable }}
77+
{{- range .Values.gateway.topologySpreadConstraints }}
78+
- maxSkew: {{ .maxSkew }}
79+
topologyKey: {{ .topologyKey }}
80+
whenUnsatisfiable: {{ .whenUnsatisfiable }}
7681
labelSelector:
7782
matchLabels:
78-
app.kubernetes.io/name: {{ include "ditto.name" . }}-gateway
83+
app.kubernetes.io/name: {{ $name }}-gateway
84+
{{- end }}
7985
containers:
8086
- name: {{ .Chart.Name }}-gateway
8187
image: {{ printf "%s:%s" .Values.gateway.image.repository ( default .Chart.AppVersion ( default .Values.dittoTag .Values.gateway.image.tag ) ) }}
@@ -230,11 +236,19 @@ spec:
230236
protocol: TCP
231237
containerPort: {{ .Values.global.prometheus.port }}
232238
{{- end }}
239+
startupProbe:
240+
httpGet:
241+
port: management
242+
path: /ready
243+
initialDelaySeconds: {{ .Values.gateway.startupProbe.initialDelaySeconds }}
244+
periodSeconds: {{ .Values.gateway.startupProbe.periodSeconds }}
245+
timeoutSeconds: {{ .Values.gateway.startupProbe.timeoutSeconds }}
246+
successThreshold: {{ .Values.gateway.startupProbe.successThreshold }}
247+
failureThreshold: {{ .Values.gateway.startupProbe.failureThreshold }}
233248
readinessProbe:
234249
httpGet:
235250
port: management
236251
path: /ready
237-
initialDelaySeconds: {{ .Values.gateway.readinessProbe.initialDelaySeconds }}
238252
periodSeconds: {{ .Values.gateway.readinessProbe.periodSeconds }}
239253
timeoutSeconds: {{ .Values.gateway.readinessProbe.timeoutSeconds }}
240254
successThreshold: {{ .Values.gateway.readinessProbe.successThreshold }}
@@ -270,11 +284,13 @@ spec:
270284
requests:
271285
cpu: {{ mulf .Values.gateway.resources.cpu 1000 }}m
272286
memory: {{ .Values.gateway.resources.memoryMi }}Mi
287+
ephemeral-storage: {{ .Values.gateway.resources.ephemeralStorageMi }}Mi
273288
limits:
274289
# ## no cpu limit to avoid CFS scheduler limits
275290
# ref: https://pekko.apache.org/docs/pekko/current/additional/deploying.html#deploying-to-kubernetes
276291
# cpu: ""
277292
memory: {{ .Values.gateway.resources.memoryMi }}Mi
293+
ephemeral-storage: {{ .Values.gateway.resources.ephemeralStorageMi }}Mi
278294
{{- if .Values.openshift.enabled }}
279295
{{- with .Values.openshift.securityContext }}
280296
securityContext:

deployment/helm/ditto/templates/nginx-deployment.yaml

+12-7
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
# http://www.eclipse.org/legal/epl-2.0
99
#
1010
# SPDX-License-Identifier: EPL-2.0
11+
{{- $name := include "ditto.name" . -}}
1112
{{- if .Values.nginx.enabled -}}
1213
---
1314
apiVersion: apps/v1
1415
kind: Deployment
1516
metadata:
1617
name: {{ include "ditto.fullname" . }}-nginx
1718
labels:
18-
app.kubernetes.io/name: {{ include "ditto.name" . }}-nginx
19+
app.kubernetes.io/name: {{ $name }}-nginx
1920
{{ include "ditto.labels" . | indent 4 }}
2021
spec:
2122
replicas: {{ .Values.nginx.replicaCount }}
@@ -25,12 +26,12 @@ spec:
2526
{{- end }}
2627
selector:
2728
matchLabels:
28-
app.kubernetes.io/name: {{ include "ditto.name" . }}-nginx
29+
app.kubernetes.io/name: {{ $name }}-nginx
2930
app.kubernetes.io/instance: {{ .Release.Name }}
3031
template:
3132
metadata:
3233
labels:
33-
app.kubernetes.io/name: {{ include "ditto.name" . }}-nginx
34+
app.kubernetes.io/name: {{ $name }}-nginx
3435
app.kubernetes.io/instance: {{ .Release.Name }}
3536
{{- with .Values.nginx.additionalLabels }}
3637
{{- toYaml . | nindent 8 }}
@@ -62,12 +63,14 @@ spec:
6263
done
6364
{{- end }}
6465
topologySpreadConstraints:
65-
- maxSkew: {{ .Values.nginx.topologySpreadConstraints.maxSkew }}
66-
topologyKey: {{ .Values.nginx.topologySpreadConstraints.topologyKey }}
67-
whenUnsatisfiable: {{ .Values.nginx.topologySpreadConstraints.whenUnsatisfiable }}
66+
{{- range .Values.nginx.topologySpreadConstraints }}
67+
- maxSkew: {{ .maxSkew }}
68+
topologyKey: {{ .topologyKey }}
69+
whenUnsatisfiable: {{ .whenUnsatisfiable }}
6870
labelSelector:
6971
matchLabels:
70-
app.kubernetes.io/name: {{ include "ditto.name" . }}-nginx
72+
app.kubernetes.io/name: {{ $name }}-nginx
73+
{{- end }}
7174
containers:
7275
- name: {{ .Chart.Name }}-nginx
7376
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
@@ -92,9 +95,11 @@ spec:
9295
requests:
9396
cpu: {{ mulf .Values.nginx.resources.cpu 1000 }}m
9497
memory: {{ .Values.nginx.resources.memoryMi }}Mi
98+
ephemeral-storage: {{ .Values.nginx.resources.ephemeralStorageMi }}Mi
9599
limits:
96100
# cpu: # don't limit
97101
memory: {{ .Values.nginx.resources.memoryMi }}Mi
102+
ephemeral-storage: {{ .Values.nginx.resources.ephemeralStorageMi }}Mi
98103
volumeMounts:
99104
- name: nginx-conf
100105
mountPath: /etc/nginx/nginx.conf

0 commit comments

Comments
 (0)