Skip to content

feat(keycloak): add Vault Kubernetes and AppRole auth for the encryption proxy - #3239

Merged
Kirill Ilin (sircthulhu) merged 10 commits into
mainfrom
feat/keycloak-proxy-approle
Jul 8, 2026
Merged

feat(keycloak): add Vault Kubernetes and AppRole auth for the encryption proxy#3239
Kirill Ilin (sircthulhu) merged 10 commits into
mainfrom
feat/keycloak-proxy-approle

Conversation

@sircthulhu

@sircthulhu Kirill Ilin (sircthulhu) commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Makes the optional keycloak-kms-proxy PII-encryption feature production-usable.

Vault auth — new encryption.kms.vault.auth switch:

  • kubernetesrecommended. The proxy logs in with its own dedicated ServiceAccount (keycloak-kms-proxy; bind the Vault role to system:serviceaccount:<ns>:keycloak-kms-proxy), so no credential is stored in a Secret.
  • approleKKP_VAULT_ROLE_ID / KKP_VAULT_SECRET_ID from encryption.kms.vault.appRole.secretName.
  • token (default, unchanged) — Vault token from tokenSecretName.

The proxy pod runs under a dedicated ServiceAccount (never the namespace default), with its token mounted only for Kubernetes auth.

Shared DEK setencryption.deksetSecretNameKKP_DEKSET_FILE (mounted read-only), and encryption.replicas is now configurable. Without a dekset the proxy mints an ephemeral DEK (only safe on a fresh, empty database, single replica). A shared wrapped DEK set — minted by the proxy's backfill tool — is required to migrate an existing populated Keycloak and to run HA; a guard rejects replicas > 1 without one.

Render-time validation requires each mode's settings and rejects unknown values. helm-unittest covers all auth modes, the ServiceAccount/token toggle, and the dekset/replicas paths. Uses keycloak-kms-proxy v0.2.0.

Release note

feat(keycloak): Vault Kubernetes/AppRole auth, a dedicated ServiceAccount, and a shared DEK set (migration + HA) for the optional PII-encryption proxy

Summary by CodeRabbit

  • New Features
    • Expanded Keycloak KMS proxy Vault authentication to support token, AppRole, and Kubernetes modes.
    • Added multi-replica/HA support via configurable DEK-set reuse, including selecting a custom DEK-set key.
    • Introduced a dedicated proxy ServiceAccount with conditional token automount for Kubernetes auth.
  • Bug Fixes
    • Added stricter validation for missing/unsupported Vault auth settings.
    • Prevented Vault credential environment variables from leaking across auth modes.
    • Updated rendering behavior and test expectations for proxy resources (including KEK/ServiceAccount documents).
  • Chores
    • Updated the Keycloak KMS proxy container image version.

The keycloak-kms-proxy Vault Transit backend only supported a static
token. Add an encryption.kms.vault.auth switch — "token" (default,
unchanged) or "approle" — wiring KKP_VAULT_ROLE_ID / KKP_VAULT_SECRET_ID
/ KKP_VAULT_APPROLE_MOUNT from a Secret. With AppRole the proxy logs in
and re-authenticates on demand, so no long-lived token is stored.

Requires a keycloak-kms-proxy image with AppRole support (> v0.1.0).

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c99c1f45-cd4d-4363-b274-44f52c6b4efb

📥 Commits

Reviewing files that changed from the base of the PR and between 2805180 and 158e85a.

📒 Files selected for processing (1)
  • packages/system/keycloak/values.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/system/keycloak/values.yaml

📝 Walkthrough

Walkthrough

This PR updates the Keycloak KMS proxy chart for multi-mode Vault auth, adds a dedicated proxy ServiceAccount, introduces replica and DEK-set configuration, and expands encryption coverage in tests.

Changes

Vault auth and encryption wiring for KMS proxy

Layer / File(s) Summary
Values schema and proxy defaults
packages/system/keycloak/values.yaml
Updates the proxy image tag and adds replica, DEK-set, and multi-mode Vault auth configuration under encryption.
Proxy ServiceAccount and pod wiring
packages/system/keycloak/templates/proxy.yaml
Adds auth-mode variables, a dedicated keycloak-kms-proxy ServiceAccount, conditional token automount, and replica gating on a shared DEK-set secret.
Vault env vars per auth mode
packages/system/keycloak/templates/proxy.yaml
Validates vault.auth and renders token, approle, or kubernetes env wiring for the proxy while preserving the static KEK path.
DEK-set mounts and replica checks
packages/system/keycloak/templates/proxy.yaml, packages/system/keycloak/tests/encryption_test.yaml
Adds conditional dekset mounts and covers ephemeral DEK defaults, dekset-backed wiring, custom DEK keys, and replica validation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Helm as Helm template
  participant ProxyTpl as proxy.yaml
  participant ServiceAccount as keycloak-kms-proxy
  participant Pod as Proxy Pod

  Helm->>ProxyTpl: render encryption settings
  ProxyTpl->>ProxyTpl: derive vaultAuth and k8sAuth
  ProxyTpl->>ServiceAccount: render ServiceAccount
  ProxyTpl->>Pod: set serviceAccountName
  ProxyTpl->>Pod: set automountServiceAccountToken
Loading

Possibly related PRs

  • cozystack/cozystack#3003: Extends the same Keycloak KMS proxy template and encryption test area with Vault-related environment wiring.

Suggested labels: security, kind/api-change, area/keycloak

Suggested reviewers: lllamnyp, androndo, myasnikovdaniil

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding Vault Kubernetes and AppRole auth to the Keycloak encryption proxy.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/keycloak-proxy-approle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/feature Categorizes issue or PR as related to a new feature size/L This PR changes 100-499 lines, ignoring generated files labels Jul 8, 2026
@sircthulhu Kirill Ilin (sircthulhu) added the do-not-merge/hold Indicates that a PR should not merge because someone has issued /hold label Jul 8, 2026
The notContains checks matched whole array elements, so a name-only
content never equaled the valueFrom entry and the assertion could never
fail. Add any:true so "AppRole stores no static token" and, symmetrically,
"token mode renders no AppRole vars" are actually verified (confirmed by
mutation-testing the template).

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Extend encryption.kms.vault.auth with "kubernetes" (recommended): the
proxy logs in with its own ServiceAccount token, so no credential is
stored in a Secret. "approle" and "token" remain. Render-time
validation requires kubernetes.role and rejects unknown methods;
helm-unittest covers the new path and the mutual absence of the other
modes' env vars.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@sircthulhu Kirill Ilin (sircthulhu) changed the title feat(keycloak): add Vault AppRole auth for the encryption proxy feat(keycloak): add Vault Kubernetes and AppRole auth for the encryption proxy Jul 8, 2026
Address review: the proxy pod ran under the namespace default ServiceAccount,
which the keycloak StatefulSet also uses. Binding a Vault Kubernetes-auth role
to default would hand the keycloak pod itself Transit access, defeating the
isolation the proxy exists to provide. Add a dedicated keycloak-kms-proxy
ServiceAccount, run the proxy pod under it, and mount its token only in the
kubernetes auth mode (off otherwise, to minimise the credential surface).
Docs name the SA to bind the Vault role to.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
…ount

Lock in the SA-object token toggle (off by default, on only for kubernetes
auth), complementing the pod-level assertions.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
v0.2.0 is the first release carrying the Kubernetes/AppRole auth modes
this chart wires, so encryption.kms.vault.auth is now usable with the
default image.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the keycloak-kms-proxy integration by introducing flexible Vault authentication options. By supporting Kubernetes and AppRole auth, users can now avoid storing long-lived Vault tokens in Kubernetes Secrets. The changes include infrastructure updates to use a dedicated ServiceAccount and rigorous testing to ensure secure and correct configuration across all supported modes.

Highlights

  • Vault Authentication Modes: Added support for 'kubernetes' and 'approle' authentication methods for the keycloak-kms-proxy, alongside the existing 'token' method.
  • Security Improvements: Introduced a dedicated ServiceAccount for the proxy, with token automounting enabled only when using Kubernetes authentication to reduce credential exposure.
  • Dependency Update: Updated the keycloak-kms-proxy image to v0.2.0 to support the new authentication mechanisms.
  • Configuration and Testing: Updated values.yaml with new configuration options and added comprehensive helm-unittest cases to validate all authentication modes and error handling.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Keycloak KMS proxy to version v0.2.0 and introduces support for Vault approle and kubernetes authentication methods alongside the existing token auth. It also creates a dedicated ServiceAccount for the proxy, mounting its token only when Kubernetes authentication is enabled, and adds extensive unit tests to validate these configurations. The reviewer feedback suggests quoting dynamic Helm template values (such as secret names and keys) to ensure correct YAML parsing.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +146 to +155
- name: KKP_VAULT_ROLE_ID
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: {{ $appRole.roleIdKey | default "role-id" }}
- name: KKP_VAULT_SECRET_ID
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: {{ $appRole.secretIdKey | default "secret-id" }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

It is a best practice in Helm templates to quote dynamic values (like secret names and keys) to ensure they are always treated as valid YAML strings and to prevent any parsing issues.

            - name: KKP_VAULT_ROLE_ID
              valueFrom:
                secretKeyRef:
                  name: {{ $secretName | quote }}
                  key: {{ $appRole.roleIdKey | default "role-id" | quote }}
            - name: KKP_VAULT_SECRET_ID
              valueFrom:
                secretKeyRef:
                  name: {{ $secretName | quote }}
                  key: {{ $appRole.secretIdKey | default "secret-id" | quote }}

valueFrom:
secretKeyRef:
name: {{ required "encryption.kms.vault.tokenSecretName is required when kms.backend=vault-transit" $vault.tokenSecretName }}
name: {{ required "encryption.kms.vault.tokenSecretName is required when vault.auth=token" $vault.tokenSecretName }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

Quote the dynamic secret name to ensure it is parsed correctly as a string in YAML.

                  name: {{ required "encryption.kms.vault.tokenSecretName is required when vault.auth=token" $vault.tokenSecretName | quote }}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/system/keycloak/tests/encryption_test.yaml (1)

154-160: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a positive assertion for KKP_VAULT_TOKEN in the token-auth test.

The test verifies KKP_VAULT_ADDR is present and KKP_VAULT_ROLE_ID is absent, but never confirms that KKP_VAULT_TOKEN is actually rendered with the correct secretKeyRef (name: keycloak-vault-token, key: token). Adding this assertion would close the loop on the token auth path.

✨ Suggested addition
     asserts:
       - contains:
           path: spec.template.spec.containers[0].env
           content:
             name: KKP_VAULT_ADDR
             value: https://vault.vault.svc:8200
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: KKP_VAULT_TOKEN
+            valueFrom:
+              secretKeyRef:
+                name: keycloak-vault-token
+                key: token
       # Token auth must not leak AppRole env vars. any:true matches on the
       # element name alone (helm-unittest otherwise deep-equals whole elements).
       - notContains:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/keycloak/tests/encryption_test.yaml` around lines 154 - 160,
The token-auth test in encryption_test.yaml only checks that KKP_VAULT_ROLE_ID
is absent, but it never verifies that KKP_VAULT_TOKEN is rendered correctly. Add
a positive assertion in the same token-auth test to check the env entry for
KKP_VAULT_TOKEN in spec.template.spec.containers[0].env, and ensure its value
comes from the expected secretKeyRef with name keycloak-vault-token and key
token. Use the existing encryption_test.yaml token-auth block and the
KKP_VAULT_TOKEN env symbol to locate the right place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/system/keycloak/tests/encryption_test.yaml`:
- Around line 154-160: The token-auth test in encryption_test.yaml only checks
that KKP_VAULT_ROLE_ID is absent, but it never verifies that KKP_VAULT_TOKEN is
rendered correctly. Add a positive assertion in the same token-auth test to
check the env entry for KKP_VAULT_TOKEN in spec.template.spec.containers[0].env,
and ensure its value comes from the expected secretKeyRef with name
keycloak-vault-token and key token. Use the existing encryption_test.yaml
token-auth block and the KKP_VAULT_TOKEN env symbol to locate the right place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9eaa81cf-e186-48b7-b311-061cf5af1506

📥 Commits

Reviewing files that changed from the base of the PR and between 83cc800 and 95cdbf2.

📒 Files selected for processing (3)
  • packages/system/keycloak/templates/proxy.yaml
  • packages/system/keycloak/tests/encryption_test.yaml
  • packages/system/keycloak/values.yaml

…roxy

Wire encryption.deksetSecretName -> KKP_DEKSET_FILE (mounted read-only) and
make encryption.replicas configurable. Without a dekset the proxy mints an
ephemeral DEK, which only works on a fresh database and a single replica.
A shared wrapped DEK set is required to migrate an existing populated
Keycloak (the proxy must reuse the DEK the backfill wrapped rows with) and
to run more than one replica; a guard rejects replicas>1 without one.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/system/keycloak/tests/encryption_test.yaml (1)

134-160: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Strengthen env var isolation assertions across auth mode tests.

The PR objective states tests should "verify that unrelated environment variables are not rendered," but each auth mode test is missing some notContains assertions for env vars belonging to other modes:

  • Token auth test (line 134-160): asserts KKP_VAULT_ROLE_ID is absent but doesn't assert KKP_VAULT_TOKEN is present, nor that KKP_VAULT_SECRET_ID, KKP_VAULT_KUBERNETES_ROLE, or KKP_VAULT_APPROLE_MOUNT are absent.
  • AppRole test (line 232-276): asserts KKP_VAULT_TOKEN is absent but doesn't assert KKP_VAULT_KUBERNETES_ROLE or KKP_VAULT_KUBERNETES_MOUNT are absent.
  • Kubernetes test (line 293-329): asserts KKP_VAULT_TOKEN and KKP_VAULT_ROLE_ID are absent but doesn't assert KKP_VAULT_SECRET_ID or KKP_VAULT_APPROLE_MOUNT are absent.

Adding these assertions is low-cost and closes the gap on the stated objective.

♻️ Suggested additions
 # Token auth test (after line 160)
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_SECRET_ID
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_KUBERNETES_ROLE
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_APPROLE_MOUNT
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: KKP_VAULT_TOKEN
+            valueFrom:
+              secretKeyRef:
+                name: keycloak-vault-token
+                key: token

 # AppRole test (after line 276)
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_KUBERNETES_ROLE
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_KUBERNETES_MOUNT

 # Kubernetes test (after line 329)
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_SECRET_ID
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          any: true
+          content:
+            name: KKP_VAULT_APPROLE_MOUNT

Also applies to: 232-276, 293-329

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/keycloak/tests/encryption_test.yaml` around lines 134 - 160,
Strengthen the Vault auth mode coverage in the encryption tests by updating the
token, AppRole, and Kubernetes cases in encryption_test.yaml to explicitly
assert both presence of the mode-specific env var and absence of env vars from
the other modes. In the Vault Transit/token-auth test, keep the KKP_VAULT_ADDR
check, add an assertion that KKP_VAULT_TOKEN is rendered, and add notContains
checks for KKP_VAULT_SECRET_ID, KKP_VAULT_KUBERNETES_ROLE, and
KKP_VAULT_APPROLE_MOUNT alongside the existing KKP_VAULT_ROLE_ID exclusion. In
the AppRole and Kubernetes test blocks, add the missing notContains assertions
for the other modes’ env vars so each auth path only renders its own variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/system/keycloak/tests/encryption_test.yaml`:
- Around line 134-160: Strengthen the Vault auth mode coverage in the encryption
tests by updating the token, AppRole, and Kubernetes cases in
encryption_test.yaml to explicitly assert both presence of the mode-specific env
var and absence of env vars from the other modes. In the Vault
Transit/token-auth test, keep the KKP_VAULT_ADDR check, add an assertion that
KKP_VAULT_TOKEN is rendered, and add notContains checks for KKP_VAULT_SECRET_ID,
KKP_VAULT_KUBERNETES_ROLE, and KKP_VAULT_APPROLE_MOUNT alongside the existing
KKP_VAULT_ROLE_ID exclusion. In the AppRole and Kubernetes test blocks, add the
missing notContains assertions for the other modes’ env vars so each auth path
only renders its own variables.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1fdcf925-ae57-4b1d-9398-da13ecd3a95a

📥 Commits

Reviewing files that changed from the base of the PR and between 95cdbf2 and 0b4b981.

📒 Files selected for processing (3)
  • packages/system/keycloak/templates/proxy.yaml
  • packages/system/keycloak/tests/encryption_test.yaml
  • packages/system/keycloak/values.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/system/keycloak/templates/proxy.yaml

Assert KKP_DEKSET_FILE honors a non-default deksetSecretKey, closing the
last uncovered branch of the dekset wiring.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
The release workflow publishes the OCI tag as 0.2.0 (docker/metadata-action
strips the leading v from the git tag), so the chart default of v0.2.0 does
not exist and pulls fail. Pin the real tag.

Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@IvanHunters

Copy link
Copy Markdown
Collaborator

Verdict

LGTM with non-blocking notes

The change is coherent, needed (the old proxy was token-auth-only, single-replica-only, and could not migrate a populated DB), off-by-default, well covered by helm-unittest (45 tests pass), and renders correctly for every auth mode; only minor documentation/convention debt remains.

Findings

[MINOR] packages/system/keycloak/values.yaml:95 — proxy image is tag-pinned, not digest-pinned, and not registry-routed.

image: ghcr.io/cozystack/keycloak-kms-proxy:0.2.1 carries no @sha256: digest and the Deployment consumes it as a raw {{ .Values.encryption.image }} (templates/proxy.yaml:82) rather than through {{ include "cozy-lib.image" (list ... $) }}. This breaks air-gapped / mirrored-registry installs and leaves the tag mutable. Note this is a pre-existing chart-wide pattern (the main quay.io/keycloak/keycloak:26.6.3 and sts.yaml images are equally unpinned, and no packages/system/* template currently uses cozy-lib.image), so this is debt the PR inherits rather than introduces — but the PR touches this exact line, so it is the natural place to fix it. If pinned/routed, also extend Renovate managerFilePatterns so future bumps stay automated.

Claim mismatches

[PARTIAL] "Uses keycloak-kms-proxy v0.2.0" (PR body) — the committed value is 0.2.1 (no v prefix), not v0.2.0. Verified against the upstream registry: the OCI tags are 0.1.0 / 0.2.0 / 0.2.1 (no v); GET manifests/0.2.1 -> HTTP 200, manifests/v0.2.1 -> HTTP 404. The code is correct and pullable; only the PR-body text is stale. Update the PR body before merge.

Caveats

  • Phase 5b — existing-customer upgrade (verified): feature is enabled: false by default, so only opted-in eval clusters are touched. For those, the diff adds a dedicated ServiceAccount + sets serviceAccountName (additive, non-breaking); defaults automountServiceAccountToken: false (safe — token/static/approle take credentials from a Secret, not the SA token); bumps image v0.1.0 -> 0.2.1. Verified v0.1.0 was never a valid OCI tag, so any running opted-in customer was already on the corrected no-v tag. No migration script needed, no RBAC contraction, no make generate staleness (chart ships no schema/README).
  • Phase 5b — fresh install (verified): helm template renders SA + Deployment + Service for all three modes, gates the DEK-set volume/mount correctly, and the replicas>1 && !deksetSecretName guard fires as intended. Image 0.2.1 confirmed pullable. No new cert-manager/CNPG cold-start dep, no new _cluster/_namespace keys.
  • AppRole secret-ref key: values (templates/proxy.yaml:155,159) are emitted unquoted; valid YAML for defaults, but an operator key with YAML-special chars would need quoting. Low risk, noted only.

@sircthulhu
Kirill Ilin (sircthulhu) merged commit 88c0cc3 into main Jul 8, 2026
16 of 17 checks passed
@sircthulhu
Kirill Ilin (sircthulhu) deleted the feat/keycloak-proxy-approle branch July 8, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/feature Categorizes issue or PR as related to a new feature size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants