Skip to content

Fix-Helm-UTF8-env#15211

Open
samiat4911 wants to merge 1 commit into
DefectDojo:devfrom
samiat4911:fix/helm-utf8-env
Open

Fix-Helm-UTF8-env#15211
samiat4911 wants to merge 1 commit into
DefectDojo:devfrom
samiat4911:fix/helm-utf8-env

Conversation

@samiat4911

@samiat4911 samiat4911 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #14979.

This PR fixes Helm deployments where non-ASCII values in environment-backed Django settings can fail at runtime because the container locale is not explicitly UTF-8.

The Helm ConfigMap now defines UTF-8 defaults for Python and the process locale:

  PYTHONUTF8: {{ ternary (index .Values.extraConfigs "PYTHONUTF8") "1" (hasKey .Values.extraConfigs "PYTHONUTF8") | quote }}
  LANG: {{ ternary (index .Values.extraConfigs "LANG") "C.UTF-8" (hasKey .Values.extraConfigs "LANG") | quote }}
  LC_ALL: {{ ternary (index .Values.extraConfigs "LC_ALL") "C.UTF-8" (hasKey .Values.extraConfigs "LC_ALL") | quote }}

The existing extraConfigs rendering was also adjusted so users can still override those values without rendering duplicate ConfigMap keys:

{{- with omit .Values.extraConfigs "PYTHONUTF8" "LANG" "LC_ALL" }}
  {{- toYaml . | nindent 2 }}
{{- end }}

Test results

Validated the Helm chart with a local Helm 3.16.4 binary:

C:\tmp\helm-3164\windows-amd64\helm.exe template defectdojo .tmp\dd-helm-validate-utf8 --show-only templates/configmap.yaml
C:\tmp\helm-3164\windows-amd64\helm.exe template defectdojo .tmp\dd-helm-validate-utf8 --show-only templates/configmap.yaml --set extraConfigs.PYTHONUTF8=0 --set extraConfigs.LANG=en_US.UTF-8 --set extraConfigs.LC_ALL=en_US.UTF-8
C:\tmp\helm-3164\windows-amd64\helm.exe lint .tmp\dd-helm-validate-utf8
git diff --check

The default render includes:

  PYTHONUTF8: "1"
  LANG: "C.UTF-8"
  LC_ALL: "C.UTF-8"

The override render preserves explicit user-provided values:

  PYTHONUTF8: "0"
  LANG: "en_US.UTF-8"
  LC_ALL: "en_US.UTF-8"

Documentation

Please update any documentation when needed in the documentation folder)

Checklist

This checklist is for your information.

  • Make sure to rebase your PR against the very latest dev.
  • Features/Changes should be submitted against the dev.
  • Bugfixes should be submitted against the bugfix branch.
  • Give a meaningful name to your PR, as it may end up being used in the release notes.
  • Your code is Ruff compliant (see ruff.toml).
  • Your code is python 3.13 compliant.
  • If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
  • Model changes must include the necessary migrations in the dojo/db_migrations folder.
  • Add applicable tests to the unit tests.
  • Add the proper label to categorize your PR.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant