Skip to content

feat(helm): optional zitadelLinkSecret for the identity link client - #447

Merged
mashkovd merged 2 commits into
mainfrom
feat/435-helm-zitadel-link-secret
Oct 4, 2026
Merged

mashkovd merged 2 commits into
mainfrom
feat/435-helm-zitadel-link-secret

Conversation

@mashkovd

@mashkovd mashkovd commented Oct 4, 2026

Copy link
Copy Markdown
Member

Chart prerequisite for #435 (explicit identity linking, #446). It mirrors oidcProvidersSecret from #440.

What

Tests

  • go test ./helm/ adds three checks:
    • empty value renders unchanged;
    • both env entries render once each, from the secretKeyRef, with no literal value and optional: true;
    • helm lint passes with the value set.
  • Mutation check: dropping optional from the secret's ref fails the test.

Production is unaffected until mctl-gitops sets the value, which happens in the wiring PR after #446 is released.

Refs #435

🤖 Generated with Claude Code

https://claude.ai/code/session_01D1kGUJMWeA8hyhQuxKuHd2

#435 signs a person in to ZITADEL with a confidential client whose id and
secret the zitadel-iac Job writes into mctl-api-oidc-zitadel (mctl-gitops
#1592). The chart reads both keys from a named Secret, optionally, so a
missing key leaves the link flow answering 503 instead of failing the pod.

Refs #435

Claude-Session: https://claude.ai/code/session_01D1kGUJMWeA8hyhQuxKuHd2
Copilot AI balanced review requested due to automatic review settings October 4, 2026 11:27

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@claude

claude Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Claude finished @mashkovd's task in 1m 25s —— View job


Reviewing PR #447

  • Fetch pinned diff (70e3ad3...b035c33)
  • Check template logic against existing oidcProvidersSecret pattern it mirrors
  • Verify test coverage
  • Post inline findings
  • Submit verdict

Summary: This chart change mirrors the existing oidcProvidersSecret pattern closely (empty-by-default value, secretKeyRef with optional: true, no literal in the manifest), and the new tests correctly exercise byte-identical rendering, env sourcing, and helm lint.

One gap found:

  • P2 (helm/templates/deployment.yaml:123): the block it mirrors has a {{- fail ... }} guard (backed by TestDeploymentOIDCProvidersSecretConflictsWithLiteral) that prevents oidcProvidersSecret + a literal env.MCTL_OIDC_PROVIDERS from rendering two env entries with the same name. The new zitadelLinkSecret block has no equivalent guard for env.ZITADEL_LINK_CLIENT_ID / env.ZITADEL_LINK_CLIENT_SECRET, so setting both would silently render a duplicate env key, which server-side apply rejects.

Review verdict: Changes requested (1 P2, 0 P1, 0 P3).

Comment thread helm/templates/deployment.yaml

@claude claude Bot 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.

Has P1/P2 findings, changes requested: 1 P2 — the new zitadelLinkSecret env block mirrors oidcProvidersSecret's secretKeyRef pattern but omits the matching literal-vs-secret conflict guard (and test) that oidcProvidersSecret has for MCTL_OIDC_PROVIDERS.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Antigravity (agy) review — informational

Model: gemini-3.8-flash-medium · commit b035c33.

No significant issues found.

A literal env entry and the secretKeyRef would render two env entries
of the same name, which server-side apply refuses. Mirror the
oidcProvidersSecret guard: fail on a non-empty literal, and skip an
empty one in the env range.

Claude-Session: https://claude.ai/code/session_01D1kGUJMWeA8hyhQuxKuHd2
@claude

claude Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Claude finished @mashkovd's task in 1m 41s —— View job


Reviewing PR #447 (commit 4c68c7d)

  • Fetch pinned diff (70e3ad3...4c68c7d)
  • Check whether the previously-flagged P2 (missing conflict guard) was addressed
  • Verify test coverage for the fix
  • Post findings / verdict

Summary: Commit 4c68c7d ("fix(helm): refuse a literal ZITADEL_LINK_* env next to zitadelLinkSecret") resolves the P2 raised on the prior commit (b035c33): helm/templates/deployment.yaml:43-44 now adds a {{- fail ... }} guard when zitadelLinkSecret and a literal env.ZITADEL_LINK_CLIENT_ID/ZITADEL_LINK_CLIENT_SECRET are both set, and the .Values.env range exclusion (deployment.yaml:51-52) now skips those two keys the same way it already skipped MCTL_OIDC_PROVIDERS for oidcProvidersSecret — exactly mirroring the established pattern.

Test coverage added for the fix matches the existing oidcProvidersSecret suite:

  • TestDeploymentZitadelLinkSecretConflictsWithLiteral — asserts helm template fails when both the secret and a literal are set, for each key.
  • TestDeploymentZitadelLinkSecretSkipsAnEmptyLiteral — confirms an empty literal doesn't trip the guard but also doesn't duplicate the env entry.
  • TestDeploymentEmptyZitadelLinkSecretRendersUnchanged, TestDeploymentRendersZitadelLinkSecretEnv, and the helm lint matrix entry carry over from the earlier commits.

No remaining correctness, security, or test-coverage gaps found. Verdict submitted: Approved (0 P1, 0 P2, 0 P3).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Antigravity (agy) review — informational

Model: gemini-3.8-flash-medium · commit 4c68c7d.

No significant issues found.

@claude claude Bot 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.

No P1/P2 findings (0 P3). The prior P2 (missing conflict guard between zitadelLinkSecret and literal env.ZITADEL_LINK_CLIENT_ID/_SECRET) is now fixed: deployment.yaml adds the same fail-guard and range-exclusion pattern used by oidcProvidersSecret, with matching tests (conflict, empty-literal, byte-identical default, env-sourcing, lint). Good to merge.

@mashkovd
mashkovd merged commit 73569c4 into main Oct 4, 2026
10 checks passed
@mashkovd
mashkovd deleted the feat/435-helm-zitadel-link-secret branch October 4, 2026 20:12
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.

2 participants