Skip to content

Commit

Permalink
refactor(core): rename core statefulset to avoid upgrade downtime (#2581
Browse files Browse the repository at this point in the history
)

Co-authored-by: distro-ci[bot] <122795778+distro-ci[bot]@users.noreply.github.com>
  • Loading branch information
aabouzaid and distro-ci[bot] authored Nov 18, 2024
1 parent 4ee28cd commit 061b06d
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-version-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ jobs:
identifier: "${{ github.event.pull_request.number }}-intg-alpha"
deployment-ttl: "${{ contains(github.event.pull_request.labels.*.name, 'test-persistent') && '1w' || '' }}"
platforms: "gke,rosa"
# flows: "install,upgrade"
flows: "install"
flows: "install,upgrade"
camunda-helm-repo: "oci://ghcr.io/camunda/helm/camunda-platform"
camunda-helm-dir: "camunda-platform-alpha"
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
Expand Down
10 changes: 3 additions & 7 deletions charts/camunda-platform-alpha/templates/core/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
{{- end -}}

{{/*
[core] Common names.
[core] The old name used in PVC which is used to avoid upgrade downtime.
*/}}
{{- define "core.brokerName" -}}
{{- if .Values.global.zeebeClusterName -}}
{{- tpl .Values.global.zeebeClusterName . | trunc 63 | trimSuffix "-" | quote -}}
{{- else -}}
{{- printf "%s-broker" .Release.Name | trunc 63 | trimSuffix "-" | quote -}}
{{- end -}}
{{- define "core.legacyName" -}}
{{- printf "%s-zeebe" .Release.Name -}}
{{- end -}}

{{/*
Expand Down
7 changes: 5 additions & 2 deletions charts/camunda-platform-alpha/templates/core/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data:
startup.sh: |
# The Node ID depends on the Pod name so it cannot be templated in the StatefulSet level.
export ZEEBE_BROKER_CLUSTER_NODEID="${ZEEBE_BROKER_CLUSTER_NODEID:-$[${K8S_NAME##*-} * 1 + 0]}"
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}" >> ~/.bashrc
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}"
exec /usr/local/camunda/bin/camunda
Expand Down Expand Up @@ -99,9 +99,12 @@ data:
# zeebe.broker.cluster
cluster:
# The value of "nodeId" is set via the "ZEEBE_BROKER_CLUSTER_NODEID" env var.
# As it depends on the Pod name, which cannot be templated at the installation time.
# nodeId:
initialContactPoints:
{{- range (untilStep 0 (int .Values.core.clusterSize) 1) }}
- ${K8S_SERVICE_NAME}-{{ . }}.${K8S_SERVICE_NAME}:{{$.Values.core.service.internalPort}}
- {{ include "core.legacyName" $ }}-{{ . }}.${K8S_SERVICE_NAME}:{{$.Values.core.service.internalPort}}
{{- end }}
clusterSize: {{ .Values.core.clusterSize | quote }}
replicationFactor: {{ .Values.core.replicationFactor | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "core.brokerName" . }}
name: {{ include "core.fullname" . }}
labels:
{{- include "core.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "core.fullname" . }}
name: {{ include "core.legacyName" . }}
labels:
{{- include "core.labels" . | nindent 4 }}
annotations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
startup.sh: |
# The Node ID depends on the Pod name so it cannot be templated in the StatefulSet level.
export ZEEBE_BROKER_CLUSTER_NODEID="${ZEEBE_BROKER_CLUSTER_NODEID:-$[${K8S_NAME##*-} * 1 + 0]}"
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}" >> ~/.bashrc
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}"
exec /usr/local/camunda/bin/camunda
application.yaml: |
Expand Down Expand Up @@ -78,10 +78,13 @@ data:
# zeebe.broker.cluster
cluster:
# The value of "nodeId" is set via the "ZEEBE_BROKER_CLUSTER_NODEID" env var.
# As it depends on the Pod name, which cannot be templated at the installation time.
# nodeId:
initialContactPoints:
- ${K8S_SERVICE_NAME}-0.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-1.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-2.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-0.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-1.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-2.${K8S_SERVICE_NAME}:26502
clusterSize: "3"
replicationFactor: "3"
partitionsCount: "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
startup.sh: |
# The Node ID depends on the Pod name so it cannot be templated in the StatefulSet level.
export ZEEBE_BROKER_CLUSTER_NODEID="${ZEEBE_BROKER_CLUSTER_NODEID:-$[${K8S_NAME##*-} * 1 + 0]}"
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}" >> ~/.bashrc
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}"
exec /usr/local/camunda/bin/camunda
application.yaml: |
Expand Down Expand Up @@ -78,10 +78,13 @@ data:
# zeebe.broker.cluster
cluster:
# The value of "nodeId" is set via the "ZEEBE_BROKER_CLUSTER_NODEID" env var.
# As it depends on the Pod name, which cannot be templated at the installation time.
# nodeId:
initialContactPoints:
- ${K8S_SERVICE_NAME}-0.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-1.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-2.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-0.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-1.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-2.${K8S_SERVICE_NAME}:26502
clusterSize: "3"
replicationFactor: "3"
partitionsCount: "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
startup.sh: |
# The Node ID depends on the Pod name so it cannot be templated in the StatefulSet level.
export ZEEBE_BROKER_CLUSTER_NODEID="${ZEEBE_BROKER_CLUSTER_NODEID:-$[${K8S_NAME##*-} * 1 + 0]}"
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}" >> ~/.bashrc
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}"
exec /usr/local/camunda/bin/camunda
application.yaml: |
Expand Down Expand Up @@ -78,10 +78,13 @@ data:
# zeebe.broker.cluster
cluster:
# The value of "nodeId" is set via the "ZEEBE_BROKER_CLUSTER_NODEID" env var.
# As it depends on the Pod name, which cannot be templated at the installation time.
# nodeId:
initialContactPoints:
- ${K8S_SERVICE_NAME}-0.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-1.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-2.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-0.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-1.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-2.${K8S_SERVICE_NAME}:26502
clusterSize: "3"
replicationFactor: "3"
partitionsCount: "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
startup.sh: |
# The Node ID depends on the Pod name so it cannot be templated in the StatefulSet level.
export ZEEBE_BROKER_CLUSTER_NODEID="${ZEEBE_BROKER_CLUSTER_NODEID:-$[${K8S_NAME##*-} * 1 + 0]}"
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}" >> ~/.bashrc
echo "export ZEEBE_BROKER_CLUSTER_NODEID=${ZEEBE_BROKER_CLUSTER_NODEID}"
exec /usr/local/camunda/bin/camunda
application.yaml: |
Expand Down Expand Up @@ -78,10 +78,13 @@ data:
# zeebe.broker.cluster
cluster:
# The value of "nodeId" is set via the "ZEEBE_BROKER_CLUSTER_NODEID" env var.
# As it depends on the Pod name, which cannot be templated at the installation time.
# nodeId:
initialContactPoints:
- ${K8S_SERVICE_NAME}-0.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-1.${K8S_SERVICE_NAME}:26502
- ${K8S_SERVICE_NAME}-2.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-0.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-1.${K8S_SERVICE_NAME}:26502
- camunda-platform-test-zeebe-2.${K8S_SERVICE_NAME}:26502
clusterSize: "3"
replicationFactor: "3"
partitionsCount: "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: "camunda-platform-test-zeebe"
name: camunda-platform-test-core
labels:
app: camunda-platform
app.kubernetes.io/name: camunda-platform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: camunda-platform-test-core
name: camunda-platform-test-zeebe
labels:
app: camunda-platform
app.kubernetes.io/name: camunda-platform
Expand Down
4 changes: 4 additions & 0 deletions charts/camunda-platform-alpha/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,10 @@ core:
replicationFactor: "3"
## @param core.env can be used to set extra environment variables in each broker container
env: []
# - name: LOGGING_LEVEL_IO_CAMUNDA
# value: DEBUG
# - name: LOGGING_LEVEL_ORG_SPRINGFRAMEWORK
# value: TRACE
# - name: LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_SECURITY
# value: TRACE
## @param core.envFrom list of environment variables to import from configMapRef and secretRef
Expand Down

0 comments on commit 061b06d

Please sign in to comment.