← Back to Pull requests

feat(helm): add rbac and service account toggles #10681

Merged
eveniota merged 11 files (448 lines) on Nov 27, 2026 07:29 UTC
View on GitHub
eveniota eveniota commented on Nov 24, 2026 18:22 UTC
Author

Fixes #7750

<!--
Your PR title should be descriptive, and generally start with a type that contains a subsystem name with () if necessary
and a summary followed by a colon. format chore/docs/api/feat/fix/refactor/style/test: summary.
Examples:
"docs: fix grammar error"
"feat(translator): add new feature"
"fix: fix xx bug"
"chore: change ci & build tools etc"
"api: add xxx fields in ClientTrafficPolicy"
-->

<!--
NOTE: If your PR contains any API changes (changes under /api), the API must be discussed and
agreed before the implementation. We strongly recommend separating API changes into their own PR so
we can review the API first, but the API may also live in the same PR as long as it was agreed
beforehand. This will save you a lot of implementation time if the API gets accepted.
-->

What this PR does / why we need it:
<!--
Briefly describe what this PR changes and the motivation behind it. Include enough context for a
reviewer to understand the problem being solved and the approach taken, e.g. what behavior changes,
any alternatives considered, and anything reviewers should pay special attention to.
-->
Currently, the gateway-helm chart unconditionally creates the controller ServiceAccount and all RBAC resources (ClusterRole, ClusterRoleBinding, Role, RoleBinding). In restricted or multi-tenant enterprise Kubernetes environments, operators do not have cluster-admin privileges to create cluster-scoped RBAC, and security policies require service accounts and permissions to be provisioned out-of-band.

This PR adds toggles and configuration options to the Helm chart:
- rbac.create (default: true): Allows disabling the creation of all RBAC resources across the chart when RBAC is managed externally.
- serviceAccount.create (default: true): Allows disabling the creation of the ServiceAccount manifest.
- serviceAccount.name (default: envoy-gateway): Allows supplying an existing pre-provisioned ServiceAccount name, dynamically wired into the Deployment pod spec and RoleBindings.
- Adds maintainer-requested warning docstrings in values.tmpl.yaml indicating that disabling these requires proper external provisioning.
- Updates documentation via helm-docs.
- Adds automated Helm snapshot tests (rbac-disabled and serviceaccount-disabled).
- Adds a release note fragment.

Note: This completes the earlier work from #8032 by @jonasHanhan, which was agreed upon in the community meeting and closed due to
inactivity.

Which issue(s) this PR fixes:
<!--
Automatically closes linked issue when PR is merged.
Usage: Fixes #<issue number>, or Fixes (paste link of issue).
-->
Fixes #7750

---

PR Checklist
<!--
Please tick the boxes below before requesting a review. PRs that leave required items unchecked may
be delayed or closed. Replace [ ] with [x] to check a box. If an item does not apply, check it
and add "N/A: <reason>".
-->

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.

  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.

  • API agreed first: N/A: Helm chart configuration change,

  • discussed and approved in community meeting (see #8032).
  • Required checks pass: helm lint and helm template tests pass.

  • Tests added/updated: Added rbac-disabled and serviceaccount-disabled test scenarios under test/helm/gateway-helm/.

  • Docs: Updated README.md and site/content/en/latest/install/gateway-helm-api.md via make helm-readme-gen.

  • Release notes: Added release-notes/current/new_features/7750-helm-rbac-serviceaccount-toggles.md.

  • Generated files committed: Generated values, docs, and test snapshots committed.

  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.

  • Codex review: Requested a Codex review and addressed all of its comments.

  • Copilot review: Requested a Copilot review and addressed all of its comments.
  • Diff: 448 lines (+445 / -3) across 11 files Reviewer: zhaohuabing Review duration: 3666m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.77) × (1 − Review Confidence (0.82)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.77 · 448 lines diff across 11 files
    0.77
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.70 · 5 substantive comment(s)
    0.70
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    82%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Sensitive Paths sensitive_paths
    0.077
    Real PR Conversation Timeline
    22 items
    netlify[bot] netlify[bot] commented on Nov 24, 2026 18:22 UTC
    Bot

    <span aria-hidden="true">✅</span> Deploy Preview for cerulean-figolla-1f9435 ready!


    Built without sensitive environment variables

    | Name | Link |
    |:-:|------------------------|
    |<span aria-hidden="true">🔨</span> Latest commit | 22fe22bfd06868d8615624690a2858629be16308 |
    |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6b085a110bbc03a431bb4633 |
    |<span aria-hidden="true">😎</span> Deploy Preview | https://deploy-preview-10681--cerulean-figolla-1f9435.netlify.app |
    |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />!QR Code<br /><br />_Use your smartphone camera to open QR code link._</details> |
    ---
    <!-- cerulean-figolla-1f9435 Preview -->
    _To edit notification comments on pull requests, go to your Netlify project configuration._

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 24, 2026 18:29 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"22fe22bfd06868d8615624690a2858629be16308","has_any_findings":true,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-26T16:14:40.673614Z">2026-11-26T16:14:40.673614Z</relative-time> | 22fe22b | New commits |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 24, 2026 18:33 UTC
    Code Review
    charts/gateway-helm/templates/certgen-rbac.yaml:1
    @@ -1,3 +1,6 @@
    +{{- $rbac := .Values.rbac | default dict -}}
    +{{- $rbacCreate := ternary $rbac.create true (hasKey $rbac "create") -}}
    +{{- if $rbacCreate }}

    <sub><sub>!P1 Badge</sub></sub> Keep the certgen service account outside the RBAC guard

    When rbac.create=false while serviceAccount.create remains at its default, this guard removes the ...-certgen ServiceAccount together with the RBAC objects. The still-rendered pre-install/pre-upgrade Job in certgen.yaml explicitly uses that account, so its pod creation fails unless operators provision an additional undocumented account even though the chart is still configured to create service accounts; leave the ServiceAccount portion outside this RBAC guard.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 24, 2026 18:33 UTC
    Code Review
    charts/gateway-helm/templates/envoy-gateway-deployment.yaml:1
    @@ -123,7 +123,7 @@ spec:
           {{- with .Values.deployment.priorityClassName }}
           priorityClassName: {{ . | quote }}
           {{- end }}
    -      serviceAccountName: envoy-gateway
    +      serviceAccountName: {{ include "eg.serviceAccountName" . }}

    <sub><sub>!P2 Badge</sub></sub> Quote the configurable service account name

    When serviceAccount.name is supplied as a valid DNS name such as the string true (or a numeric-only name), this unquoted interpolation renders a YAML boolean/number rather than a string. Helm/Kubernetes therefore rejects the Deployment, and the ServiceAccount template has the same unquoted interpolation, while the new RoleBinding subjects do quote it; quote the helper result at both YAML call sites.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 24, 2026 18:33 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: afd0e1895e

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 24, 2026 18:58 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: caca7ad241

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 24, 2026 18:58 UTC
    Code Review
    charts/gateway-helm/templates/envoy-gateway-deployment.yaml:1
    @@ -123,7 +123,7 @@ spec:
           {{- with .Values.deployment.priorityClassName }}
           priorityClassName: {{ . | quote }}
           {{- end }}
    -      serviceAccountName: envoy-gateway
    +      serviceAccountName: '{{ include "eg.serviceAccountName" . }}'

    <sub><sub>!P1 Badge</sub></sub> Regenerate existing Helm snapshots after quoting the account name

    In the repository's gen-check job (.github/workflows/build_and_test.yaml:52-57), helm-template rewrites every *.out.yaml from each input (tools/make/helm.mk:84-92) and the target rejects any resulting diff (tools/make/lint.mk:81-85). This line and the ServiceAccount template now emit quoted 'envoy-gateway', but only the two newly added snapshots were regenerated; for example, test/helm/gateway-helm/default-config.out.yaml:10,537 still contains the old unquoted output. Consequently every PR run dirties the existing snapshots and fails gen-check; regenerate all gateway-helm snapshots.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    eveniota eveniota commented on code on Nov 24, 2026 19:21 UTC
    Code Review
    charts/gateway-helm/templates/envoy-gateway-deployment.yaml:1
    @@ -123,7 +123,7 @@ spec:
           {{- with .Values.deployment.priorityClassName }}
           priorityClassName: {{ . | quote }}
           {{- end }}
    -      serviceAccountName: envoy-gateway
    +      serviceAccountName: {{ include "eg.serviceAccountName" . }}

    Kept unquoted to stay consistent with the rest of the chart (where resource names and serviceAccountName interpolations are unquoted across all templates) and to avoid cosmetic diff churn across all 36 existing snapshot files. ServiceAccount names follow RFC 1123 DNS subdomain constraints in Kubernetes.

    eveniota eveniota commented on code on Nov 24, 2026 19:21 UTC
    Code Review
    charts/gateway-helm/templates/envoy-gateway-deployment.yaml:1
    @@ -123,7 +123,7 @@ spec:
           {{- with .Values.deployment.priorityClassName }}
           priorityClassName: {{ . | quote }}
           {{- end }}
    -      serviceAccountName: envoy-gateway
    +      serviceAccountName: '{{ include "eg.serviceAccountName" . }}'

    Keeping the template interpolation unquoted consistent with the rest of the chart avoids dirtying existing snapshots. The snapshot test suite is fully regenerated and clean, containing only the two new snapshots added for this feature.

    codecov[bot] codecov[bot] commented on Nov 26, 2026 01:20 UTC
    Bot

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.
    :white_check_mark: Project coverage is 82.82%. Comparing base (45442d4) to head (22fe22b).
    :warning: Report is 14 commits behind head on main.

    <details><summary>Additional details and impacted files</summary>

    @@            Coverage Diff             @@
    ##             main   #10681      +/-   ##
    ==========================================
    - Coverage   82.82%   82.82%   -0.01%     
    ==========================================
      Files         278      278              
      Lines       44620    44657      +37     
    ==========================================
    + Hits        36957    36986      +29     
    - Misses       7662     7670       +8     
      Partials        1        1              
    

    </details>

    :umbrella: View full report in Codecov by Harness.
    :loudspeaker: Have feedback on the report? Share it here.
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

  • </details>

    zhaohuabing zhaohuabing commented on code on Nov 26, 2026 01:30 UTC
    Code Review
    charts/gateway-helm/values.tmpl.yaml:1
    @@ -207,6 +207,18 @@ namespaceOverride: ""
     
     kubernetesClusterDomain: cluster.local
     
    +# -- ServiceAccount configuration. If disabled (`serviceAccount.create=false`), you must supply an existing ServiceAccount via `serviceAccount.name` with the necessary permissions. Warning: Disabling ServiceAccount creation without providing a properly configured existing ServiceAccount may cause Envoy Gateway to fail to start or operate correctly.
    +serviceAccount:
    +  # -- Specifies whether a ServiceAccount should be created
    +  create: true
    +  # -- The name of the ServiceAccount to use
    +  name: envoy-gateway

    Is the ServiceAccount toggle needed for #7750? rbac.create alone seems to cover the cluster-admin case, since the chart can still create the namespace-scoped ServiceAccount. Maybe serviceAccount.create/name could wait until a concrete use case comes up, since adding it later wouldn't break anything?

    eveniota eveniota commented on code on Nov 26, 2026 02:42 UTC
    Code Review
    charts/gateway-helm/values.tmpl.yaml:1
    @@ -207,6 +207,18 @@ namespaceOverride: ""
     
     kubernetesClusterDomain: cluster.local
     
    +# -- ServiceAccount configuration. If disabled (`serviceAccount.create=false`), you must supply an existing ServiceAccount via `serviceAccount.name` with the necessary permissions. Warning: Disabling ServiceAccount creation without providing a properly configured existing ServiceAccount may cause Envoy Gateway to fail to start or operate correctly.
    +serviceAccount:
    +  # -- Specifies whether a ServiceAccount should be created
    +  create: true
    +  # -- The name of the ServiceAccount to use
    +  name: envoy-gateway

    Makes sense! I'll remove serviceAccount.create and serviceAccount.name to keep this PR strictly focused on rbac.create for the cluster-admin use case.

    eveniota eveniota commented on code on Nov 26, 2026 05:00 UTC
    Code Review
    charts/gateway-helm/values.tmpl.yaml:1
    @@ -207,6 +207,18 @@ namespaceOverride: ""
     
     kubernetesClusterDomain: cluster.local
     
    +# -- ServiceAccount configuration. If disabled (`serviceAccount.create=false`), you must supply an existing ServiceAccount via `serviceAccount.name` with the necessary permissions. Warning: Disabling ServiceAccount creation without providing a properly configured existing ServiceAccount may cause Envoy Gateway to fail to start or operate correctly.
    +serviceAccount:
    +  # -- Specifies whether a ServiceAccount should be created
    +  create: true
    +  # -- The name of the ServiceAccount to use
    +  name: envoy-gateway

    @zhaohuabing done

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 26, 2026 05:03 UTC
    Code Review
    charts/gateway-helm/templates/certgen-rbac.yaml:1
    @@ -19,6 +19,9 @@ metadata:
         {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}}
       {{- end }}
     ---
    +{{- $rbac := .Values.rbac | default dict -}}
    +{{- $rbacCreate := ternary $rbac.create true (hasKey $rbac "create") -}}
    +{{- if $rbacCreate }}

    <sub><sub>!P2 Badge</sub></sub> Remove certgen hook RBAC when disabling managed RBAC

    When a release installed with the default RBAC is upgraded with rbac.create=false, this guard omits the certgen Role/RoleBinding and topology ClusterRole/ClusterRoleBinding, but those resources are annotated below as pre-install, pre-upgrade hooks. Helm's hook documentation states that “The resources that a hook creates are currently not tracked or managed as part of the release”; because the disabled upgrade supplies no replacement hook to trigger before-hook-creation, the old bindings remain and continue granting secret/webhook privileges after the ordinary controller RBAC is removed. Add an upgrade cleanup/migration, or document the required manual deletion, so existing releases can actually transition away from chart-created RBAC.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 26, 2026 05:03 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: f9906242a2

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

    </details>

    eveniota eveniota commented on code on Nov 26, 2026 05:23 UTC
    Code Review
    charts/gateway-helm/templates/certgen-rbac.yaml:1
    @@ -19,6 +19,9 @@ metadata:
         {{- toYaml .Values.certgen.rbac.annotations | nindent 4 -}}
       {{- end }}
     ---
    +{{- $rbac := .Values.rbac | default dict -}}
    +{{- $rbacCreate := ternary $rbac.create true (hasKey $rbac "create") -}}
    +{{- if $rbacCreate }}

    This is standard Helm hook lifecycle behavior (Helm does not garbage-collect unmanaged hook resources on upgrade). Operators transitioning an existing release to external RBAC can delete lingering hook resources out-of-band alongside their external RBAC setup.

    zhaohuabing zhaohuabing commented on Nov 26, 2026 06:34 UTC
    Reviewer

    LGTM thanks.

    zirain zirain commented on Nov 26, 2026 08:57 UTC
    Contributor

    please make CI happy.

    eveniota eveniota commented on Nov 26, 2026 17:32 UTC
    Author

    @zirain please check now.

    zhaohuabing zhaohuabing approved these changes on Nov 27, 2026 02:09 UTC
    Approved Reviewer

    Approved these changes.

    zirain zirain approved these changes on Nov 27, 2026 02:18 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    eveniota eveniota
    Labels
    risk: low confidence: 82.1% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 77.4% (HIGH) · Higher = larger blast radius
    77.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 82.1% · Lower = rushed or shallow review
    82.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 13.8% · Safe to merge
    13.8%