Skip to content

Commit

Permalink
tidy up 2
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed AbouZaid <[email protected]>
  • Loading branch information
aabouzaid committed Sep 2, 2024
1 parent 8cad63e commit bcb1169
Show file tree
Hide file tree
Showing 25 changed files with 356 additions and 365 deletions.
497 changes: 246 additions & 251 deletions charts/camunda-platform-alpha/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ Fail with a message if global.identity.auth.identity.existingSecret is set and g
{{- end }}
{{- end }}

{{/*
Fail with a message if adaptSecurityContext has any value other than "force" or "disabled".
*/}}
{{- if not (has .Values.global.compatibility.openshift.adaptSecurityContext (list "force" "disabled")) }}
{{- $errorMessage := "[camunda][error] Invalid value for adaptSecurityContext. The value must be either 'force' or 'disabled'." -}}
{{ printf "\n%s" $errorMessage | trimSuffix "\n" | fail }}
{{- end }}

{{/*
Fail with a message if Identity is disabled and identityKeycloak is enabled.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.connectors) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.connectors.containerSecurityContext }}
securityContext: {{- toYaml .Values.connectors.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.connectors.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.connectors.service.serverPort }}
Expand Down Expand Up @@ -172,7 +172,7 @@ spec:
dnsPolicy: {{ .Values.connectors.dnsPolicy | quote }}
{{- end }}
{{- if .Values.connectors.podSecurityContext }}
securityContext: {{- toYaml .Values.connectors.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.connectors.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.connectors.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ spec:
{{- if .Values.console.dnsPolicy }}
dnsPolicy: {{ .Values.console.dnsPolicy | quote }}
{{- end }}
securityContext:
{{- toYaml .Values.console.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.console.podSecurityContext "context" $) | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.console) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.console.containerSecurityContext }}
securityContext:
{{- toYaml .Values.console.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.console.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.identity) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.identity.containerSecurityContext }}
securityContext: {{- toYaml .Values.identity.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.identity.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -323,7 +323,7 @@ spec:
dnsPolicy: {{ .Values.identity.dnsPolicy | quote }}
{{- end }}
{{- if .Values.identity.podSecurityContext }}
securityContext: {{- toYaml .Values.identity.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.identity.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.identity.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.operate) }}
command: ['/bin/sh', '/usr/local/operate/bin/migrate']
{{- if .Values.operate.containerSecurityContext }}
securityContext: {{- toYaml .Values.operate.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.operate.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
{{- if and .Values.global.elasticsearch.external (include "elasticsearch.passwordIsDefined" .) }}
Expand Down Expand Up @@ -101,7 +101,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.operate) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.operate.containerSecurityContext }}
securityContext: {{- toYaml .Values.operate.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.operate.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -334,7 +334,7 @@ spec:
dnsPolicy: {{ .Values.operate.dnsPolicy | quote }}
{{- end }}
{{- if .Values.operate.podSecurityContext }}
securityContext: {{- toYaml .Values.operate.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.operate.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.operate.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.optimize) }}
command: ['./upgrade/upgrade.sh', '--skip-warning']
{{- if .Values.optimize.containerSecurityContext }}
securityContext: {{- toYaml .Values.optimize.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.optimize.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -121,7 +121,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.optimize) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.optimize.containerSecurityContext }}
securityContext: {{- toYaml .Values.optimize.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.optimize.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -320,7 +320,7 @@ spec:
dnsPolicy: {{ .Values.optimize.dnsPolicy | quote }}
{{- end }}
{{- if .Values.optimize.podSecurityContext }}
securityContext: {{- toYaml .Values.optimize.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.optimize.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.optimize.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.tasklist) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.tasklist.containerSecurityContext }}
securityContext: {{- toYaml .Values.tasklist.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.tasklist.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -270,7 +270,7 @@ spec:
dnsPolicy: {{ .Values.tasklist.dnsPolicy | quote }}
{{- end }}
{{- if .Values.tasklist.podSecurityContext }}
securityContext: {{- toYaml .Values.tasklist.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.tasklist.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.tasklist.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
image: {{ include "webModeler.restapi.image" . | quote }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.webModeler.restapi.containerSecurityContext }}
securityContext: {{- toYaml .Values.webModeler.restapi.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.restapi.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -157,7 +157,7 @@ spec:
dnsPolicy: {{ .Values.webModeler.restapi.dnsPolicy | quote }}
{{- end }}
{{- if .Values.webModeler.restapi.podSecurityContext }}
securityContext: {{- toYaml .Values.webModeler.restapi.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.restapi.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.webModeler.restapi.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
image: {{ include "webModeler.webapp.image" . | quote }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.webModeler.webapp.containerSecurityContext }}
securityContext: {{- toYaml .Values.webModeler.webapp.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.webapp.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -152,7 +152,7 @@ spec:
dnsPolicy: {{ .Values.webModeler.webapp.dnsPolicy | quote }}
{{- end }}
{{- if .Values.webModeler.webapp.podSecurityContext }}
securityContext: {{- toYaml .Values.webModeler.webapp.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.webapp.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.webModeler.webapp.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ spec:
image: {{ include "webModeler.websockets.image" . | quote }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.webModeler.websockets.containerSecurityContext }}
securityContext:
{{- toYaml .Values.webModeler.websockets.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.websockets.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -137,7 +136,7 @@ spec:
dnsPolicy: {{ .Values.webModeler.websockets.dnsPolicy | quote }}
{{- end }}
{{- if .Values.webModeler.websockets.podSecurityContext }}
securityContext: {{- toYaml .Values.webModeler.websockets.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.webModeler.websockets.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.webModeler.websockets.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ spec:
{{ .Values.zeebeGateway.extraVolumeMounts | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.zeebeGateway.containerSecurityContext }}
securityContext: {{- toYaml .Values.zeebeGateway.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.zeebeGateway.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.zeebeGateway.startupProbe.enabled }}
startupProbe:
Expand Down Expand Up @@ -177,7 +177,7 @@ spec:
dnsPolicy: {{ .Values.zeebeGateway.dnsPolicy | quote }}
{{- end }}
{{- if .Values.zeebeGateway.podSecurityContext }}
securityContext: {{- toYaml .Values.zeebeGateway.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.zeebeGateway.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.zeebeGateway.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ Zeebe Gateway.
{{- $_ := set .Values.zeebeGateway.ingress "grpc" (deepCopy $zgIngress | mergeOverwrite .Values.zeebeGateway.ingress.grpc) -}}
{{- end -}}
{{/*
OpenShift.
The `elasticsearch.sysctlImage` container adjusts the virtual memory and file descriptors of the machine needed for Elasticsearch.
By default, the `sysctlImage` container will fail on OpenShift because it requires privileged mode.
Also, recent OpenShift versions (> 4.10) have adjusted the virtual memory of the machine by default.
*/}}
{{- if eq .Values.global.compatibility.openshift.adaptSecurityContext "force" -}}
{{- $_ := set .Values.elasticsearch.sysctlImage "enabled" false -}}
{{- end -}}
{{/*
OpenShift.
The label `tuned.openshift.io/elasticsearch` is added to ensure compatibility with the previous Camunda Helm charts.
Without this label, the Helm upgrade will fail for OpenShift because it is already set for the volumeClaimTemplate.
*/}}
{{- if eq .Values.global.compatibility.openshift.adaptSecurityContext "force" -}}
{{- if not (hasKey .Values.elasticsearch.commonLabels "tuned.openshift.io/elasticsearch") -}}
{{- $_ := set .Values.elasticsearch.commonLabels "tuned.openshift.io/elasticsearch" "" -}}
{{- end -}}
{{- end -}}
{{/*
Elasticsearch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
image: {{ include "camundaPlatform.imageByParams" (dict "base" .Values.global "overlay" .Values.zeebe) }}
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
{{- if .Values.zeebe.containerSecurityContext }}
securityContext: {{- toYaml .Values.zeebe.containerSecurityContext | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.zeebe.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CAMUNDA_LICENSE_KEY
Expand Down Expand Up @@ -254,7 +254,7 @@ spec:
dnsPolicy: {{ .Values.zeebe.dnsPolicy | quote }}
{{- end }}
{{- if .Values.zeebe.podSecurityContext }}
securityContext: {{- toYaml .Values.zeebe.podSecurityContext | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" $.Values.zeebe.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.zeebe.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
enableServiceLinks: true
initContainers:
- name: prepare-write-dirs
image: docker.io/bitnami/keycloak:25.0.4
image: docker.io/camunda/keycloak:25.0.4
imagePullPolicy: IfNotPresent
command:
- /bin/bash
Expand Down Expand Up @@ -100,30 +100,9 @@ spec:
volumeMounts:
- name: empty-dir
mountPath: /emptydir
- command:
- sh
- -c
- cp -a /app/keycloak-theme/* /mnt
image: 'camunda/identity:latest'
imagePullPolicy: 'Always'
name: copy-camunda-theme
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
volumeMounts:
- mountPath: /mnt
name: camunda-theme
containers:
- name: keycloak
image: docker.io/bitnami/keycloak:25.0.4
image: docker.io/camunda/keycloak:25.0.4
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down Expand Up @@ -213,15 +192,10 @@ spec:
- name: empty-dir
mountPath: /opt/bitnami/keycloak/data
subPath: app-data-dir
- mountPath: /opt/bitnami/keycloak/themes/identity
name: camunda-theme
- mountPath: /opt/bitnami/keycloak/data/tmp
name: data-tmp
volumes:
- name: empty-dir
emptyDir: {}
- emptyDir: {}
name: data-tmp
- emptyDir:
sizeLimit: 10Mi
name: camunda-theme
name: data-tmp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
SetValues: map[string]string{
"connectors.enabled": "true",
"connectors.containerSecurityContext.privileged": "true",
"connectors.containerSecurityContext.capabilities.add[0]": "NET_ADMIN",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}
Expand All @@ -347,7 +346,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
// then
securityContext := deployment.Spec.Template.Spec.Containers[0].SecurityContext
s.Require().True(*securityContext.Privileged)
s.Require().EqualValues("NET_ADMIN", securityContext.Capabilities.Add[0])
}

// https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
SetValues: map[string]string{
"console.enabled": "true",
"console.containerSecurityContext.privileged": "true",
"console.containerSecurityContext.capabilities.add[0]": "NET_ADMIN",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}
Expand All @@ -463,7 +462,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
// then
securityContext := deployment.Spec.Template.Spec.Containers[0].SecurityContext
s.Require().True(*securityContext.Privileged)
s.Require().EqualValues("NET_ADMIN", securityContext.Capabilities.Add[0])
}

// https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
options := &helm.Options{
SetValues: map[string]string{
"identity.containerSecurityContext.privileged": "true",
"identity.containerSecurityContext.capabilities.add[0]": "NET_ADMIN",
},
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace),
}
Expand All @@ -463,7 +462,6 @@ func (s *deploymentTemplateTest) TestContainerSetSecurityContext() {
// then
securityContext := deployment.Spec.Template.Spec.Containers[0].SecurityContext
s.Require().True(*securityContext.Privileged)
s.Require().EqualValues("NET_ADMIN", securityContext.Capabilities.Add[0])
}

// https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
Expand Down
Loading

0 comments on commit bcb1169

Please sign in to comment.