Skip to content

Comments

fix(openshift): when es is disabled, fix templating error of label#5020

Open
leiicamundi wants to merge 3 commits intomainfrom
fix/openshift-es-false-common-labels
Open

fix(openshift): when es is disabled, fix templating error of label#5020
leiicamundi wants to merge 3 commits intomainfrom
fix/openshift-es-false-common-labels

Conversation

@leiicamundi
Copy link
Contributor

@leiicamundi leiicamundi commented Jan 14, 2026

Which problem does the PR fix?

closes #2779

Fixes Helm chart rendering failure when deploying on OpenShift with Elasticsearch disabled:

Error: INSTALLATION FAILED: template: camunda-platform/templates/zeebe/1/2/3/4/5/6/7/8/z_compatibility_helpers.tpl:87:30: 
at <.Values.elasticsearch.commonLabels>: wrong type for value; expected map[string]interface {}; got interface {}

This occurs with values like:

elasticsearch:
  enabled: false

global:
  compatibility:
    openshift:
      adaptSecurityContext: force

Root cause: The hasKey function was called on .Values.elasticsearch.commonLabels without ensuring it was a proper map. When elasticsearch was disabled without explicitly defining commonLabels: {}, the value became nil causing the template to fail.

What's in this PR?

Updated the compatibility helpers in charts 8.6 and 8.7 to match the already-correct implementation in 8.8/8.9:

  1. Combine conditions using and (elasticsearch.enabled AND adaptSecurityContext == "force")
  2. First check if commonLabels key exists, create empty dict if not
  3. Then safely check for the tuned.openshift.io/elasticsearch label

Before:

{{- if .Values.elasticsearch.enabled -}}
  {{- 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 -}}
{{- end -}}

After:

{{- if and (eq .Values.global.compatibility.openshift.adaptSecurityContext "force") .Values.elasticsearch.enabled -}}
    {{- if not (hasKey .Values.elasticsearch "commonLabels") -}}
        {{- $_ := set .Values.elasticsearch "commonLabels" (dict) -}}
    {{- end -}}
    {{- if not (hasKey .Values.elasticsearch.commonLabels "tuned.openshift.io/elasticsearch") -}}
        {{- $_ := set .Values.elasticsearch.commonLabels "tuned.openshift.io/elasticsearch" "" -}}
    {{- end -}}
{{- end -}}

Files changed:

Chart File
8.6 templates/zeebe/1/2/3/4/5/6/7/8/z_compatibility_helpers.tpl
8.7 templates/zeebe/1/2/3/4/5/6/7/8/z_compatibility_helpers.tpl

Unit tests added:

Chart File
8.6 test/unit/camunda/compatibility_helpers_test.go
8.7 test/unit/camunda/compatibility_helpers_test.go
8.8 test/unit/common/compatibility_helpers_test.go
8.9 test/unit/common/compatibility_helpers_test.go

Checklist

Please make sure to follow our Contributing Guide.

Before opening the PR:

  • In the repo's root dir, run make go.update-golden-only.
  • There is no other open pull request for the same update/change.
  • Tests for charts are added (if needed).
  • In-repo documentation are updated (if needed).

After opening the PR:

  • Did you sign our CLA (Contributor License Agreement)? It will show once you open the PR.
  • Did all checks/tests pass in the PR?

@leiicamundi leiicamundi requested a review from a team as a code owner January 14, 2026 11:04
@leiicamundi leiicamundi requested review from jessesimpson36 and removed request for a team January 14, 2026 11:04
@github-actions github-actions bot added component/zeebe version/8.6 Camunda applications/cycle version version/8.7 Camunda applications/cycle version version/8.8 Camunda applications/cycle version version/8.9 Camunda applications/cycle version labels Jan 14, 2026
@leiicamundi leiicamundi added the kind/bug Something isn't working as intended label Jan 16, 2026
@jessesimpson36 jessesimpson36 force-pushed the fix/openshift-es-false-common-labels branch from 684699f to 0471bcd Compare January 22, 2026 16:19
@jessesimpson36
Copy link
Contributor

I think the CI failures were unrelated so I'm rebasing so they rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/zeebe kind/bug Something isn't working as intended version/8.6 Camunda applications/cycle version version/8.7 Camunda applications/cycle version version/8.8 Camunda applications/cycle version version/8.9 Camunda applications/cycle version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ISSUE] Installation fails on Openshift when ES is not enabled

2 participants