Skip to content

Hotfix: allows new secret creation when service enabled - #539

Merged
ArtisKrumins merged 5 commits into
masterfrom
hotfix/release-env
Aug 18, 2026
Merged

Hotfix: allows new secret creation when service enabled#539
ArtisKrumins merged 5 commits into
masterfrom
hotfix/release-env

Conversation

@ArtisKrumins

@ArtisKrumins ArtisKrumins commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Drupal Helm chart’s pre-/post-release hook Jobs to stop using the shared drupal.php-container helper and instead render the PHP image and environment variables explicitly, while factoring shared env vars into a new drupal.env-common helper.

Changes:

  • Updated pre-release and post-release Job templates to set image and env directly rather than including drupal.php-container.
  • Introduced drupal.env-common and drupal.pre-release-env helpers and refactored drupal.env to reuse the common env block.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
drupal/templates/pre-release.yaml Switches pre-release Job container rendering to explicit image + included env helper.
drupal/templates/post-release.yaml Switches post-release Job container rendering to explicit image + included env helper.
drupal/templates/_helpers.tpl Refactors env helpers by introducing drupal.env-common and a new hook env helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread drupal/templates/pre-release.yaml Outdated
Comment thread drupal/templates/_helpers.tpl Outdated
Comment on lines +221 to +227
{{- define "drupal.pre-release-env" }}
{{- if .Values.timezone }}
- name: TZ
value: {{ .Values.timezone | quote }}
{{- end }}
{{- include "drupal.env-common" . }}
{{- end }}
Comment thread drupal/templates/post-release.yaml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

drupal/templates/post-release.yaml:27

  • The post-release hook runs after regular release resources have been applied, so it should keep the full runtime environment. Pointing it at the pre-release-specific helper either leaves that helper identical (and preserves the pre-upgrade bug) or, once the helper is correctly reduced, deprives post-install/post-upgrade commands of service credentials. Use drupal.env here and reserve drupal.pre-release-env for the pre-upgrade Job.
        {{- include "drupal.pre-release-env" . | nindent 8 }}

Comment thread drupal/templates/_helpers.tpl Outdated
Comment on lines +205 to +206
{{- define "drupal.pre-release-env" }}
{{- include "drupal.env-common" . }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your suggestion for solution?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

drupal/templates/post-release.yaml:27

  • A post-install/post-upgrade hook runs after the chart resources have been submitted, so it should keep the normal required Secret references. Making them optional here means the Job can start before a delayed Secret exists; Kubernetes then permanently omits that environment variable from this container, and the post-release commands can run with missing Redis/SMTP/Varnish credentials instead of waiting. Use drupal.env here and reserve drupal.pre-release-env for the pre-upgrade hook.
        {{- include "drupal.pre-release-env" . | nindent 8 }}

drupal/templates/_helpers.tpl:212

  • The pre-release context still leaves the conditional database Secrets required: drupal.db-env emits mandatory *-mariadb and PXC secretKeyRefs. For example, upgrading with pxc-db.enabled=true while MariaDB remains primary guarantees that the pre-upgrade Job references the new PXC Secret before that resource can be created, so the same CreateContainerConfigError remains for this service. Propagate optionalSecrets to all four conditional database references (or omit auxiliary DB credentials from this hook); if changing the primary database is supported, the hook also needs to retain the old primary connection rather than wait for the not-yet-created service.
{{- include "drupal.env-common" (merge (dict "optionalSecrets" true) .) }}

@ArtisKrumins
ArtisKrumins requested a review from Jancis August 10, 2026 12:16

@Jancis Jancis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionalSecrets.opional is an excellent idea!

@ArtisKrumins
ArtisKrumins merged commit 908224c into master Aug 18, 2026
8 checks passed
@ArtisKrumins
ArtisKrumins deleted the hotfix/release-env branch August 18, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants