Skip to content

fix(helm): propagate commonLabels to RBAC resources#8818

Merged
arkodg merged 5 commits into
envoyproxy:mainfrom
mvanhorn:osc/8817-commonlabels-rbac
May 8, 2026
Merged

fix(helm): propagate commonLabels to RBAC resources#8818
arkodg merged 5 commits into
envoyproxy:mainfrom
mvanhorn:osc/8817-commonlabels-rbac

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

Thread commonLabels through the four RBAC resources declared in charts/gateway-helm/templates/envoy-gateway-rbac.yaml by adding the existing eg.labels helper to each of them - the same pattern already used in certgen-rbac.yaml and envoy-gateway-deployment.yaml.

Why this matters

Issue #8817 pointed at the concrete gap: helm template eg ... --set commonLabels.custom-label=custom-value renders ClusterRole eg-gateway-helm-envoy-gateway-role and ClusterRoleBinding eg-gateway-helm-envoy-gateway-rolebinding with custom-label: null. The cause is mechanical - those resources just didn't declare a labels: block, so the commonLabels merged in by eg.labels (at _helpers.tpl:43) never reached them. The cert-gen RBAC and the rest of the chart already have the labels block, so this PR just closes the last gap.

Changes

  • charts/gateway-helm/templates/envoy-gateway-rbac.yaml: add
    labels:
    {{- include "eg.labels" $ | nindent 4 }}
    on each of the four RBAC manifests (Role + RoleBinding inside the watched-namespaces range, ClusterRole + ClusterRoleBinding at the template root, and the two outer ClusterRole/ClusterRoleBinding in the {{ else }} branch). $ vs . matches the existing template-root scoping rules in the same file.

Testing

Local render:

$ helm dependency update charts/gateway-helm
$ envsubst < charts/gateway-helm/values.tmpl.yaml > charts/gateway-helm/values.yaml
$ helm template eg charts/gateway-helm \
    --set commonLabels.custom-label=custom-value | \
    yq eval-all '{"kind": .kind, "name": .metadata.name, "custom-label": .metadata.labels."custom-label"}'

After this change, all four envoy-gateway RBAC resources (plus the cert-gen set that was already wired) render custom-label: custom-value:

ClusterRole         eg-gateway-helm-envoy-gateway-role        custom-label=custom-value
ClusterRoleBinding  eg-gateway-helm-envoy-gateway-rolebinding custom-label=custom-value
Role                eg-gateway-helm-infra-manager             custom-label=custom-value
Role                eg-gateway-helm-leader-election-role      custom-label=custom-value
RoleBinding         eg-gateway-helm-infra-manager             custom-label=custom-value
RoleBinding         eg-gateway-helm-leader-election-rolebinding custom-label=custom-value

Matches the expected output in the issue's repro block.

Fixes #8817

This contribution was developed with AI assistance (Claude Code).

@mvanhorn mvanhorn requested a review from a team as a code owner April 22, 2026 08:14
@netlify

netlify Bot commented Apr 22, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 2b2076c
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69fd2a5c7eb2170008d403d2
😎 Deploy Preview https://deploy-preview-8818--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@zhaohuabing

Copy link
Copy Markdown
Member

Hi @mvanhorn Can you sign this commit?
You'll also need to run make gen-check and submit the generated files.

@zhaohuabing

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.77%. Comparing base (98a4def) to head (2b2076c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8818      +/-   ##
==========================================
+ Coverage   74.74%   74.77%   +0.03%     
==========================================
  Files         251      251              
  Lines       40372    40372              
==========================================
+ Hits        30176    30189      +13     
+ Misses       8130     8119      -11     
+ Partials     2066     2064       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Issue envoyproxy#8817 reported that 'helm template ... --set
commonLabels.custom-label=custom-value' left ClusterRole,
ClusterRoleBinding, Role, and RoleBinding resources unlabelled.
The other resources in the chart already include 'eg.labels' in
their metadata - which picks up 'commonLabels' via the helper
at _helpers.tpl:43 - but envoy-gateway-rbac.yaml didn't set any
labels block.

Add 'labels: {{- include "eg.labels" . | nindent 4 }}' on every
Role / RoleBinding / ClusterRole / ClusterRoleBinding declared in
envoy-gateway-rbac.yaml. Matches the existing labels pattern used
in certgen-rbac.yaml and envoy-gateway-deployment.yaml. Scopes are
'$' inside the watched-namespaces 'range' and '.' at the template
root, same rule the helper block inside the file already used.

Verified locally with:
  helm dependency update charts/gateway-helm
  envsubst < charts/gateway-helm/values.tmpl.yaml > \
    charts/gateway-helm/values.yaml
  helm template eg charts/gateway-helm \
    --set commonLabels.custom-label=custom-value | yq ...

All four RBAC resources now emit 'custom-label: custom-value' in
their metadata.labels, matching the issue's repro steps. Cert-gen
RBAC resources already carried it; this PR brings the core
envoy-gateway RBAC set into parity.

Fixes envoyproxy#8817

Signed-off-by: Matt Van Horn <[email protected]>
Run 'make helm-template.gateway-helm' to regenerate the snapshot fixtures
after the envoy-gateway-rbac.yaml labels change. Adds the 'labels:' block
to the RBAC resources in all 27 test cases.

Signed-off-by: Matt Van Horn <[email protected]>
@mvanhorn mvanhorn force-pushed the osc/8817-commonlabels-rbac branch from 29270b3 to 0af14ed Compare April 24, 2026 06:49
@mvanhorn

Copy link
Copy Markdown
Contributor Author

@zhaohuabing signed the commit in fee67e5 and regenerated the helm-template snapshots in 0af14ed - the 27 .out.yaml files under test/helm/gateway-helm/ now include the RBAC labels block. Force-pushed to the PR. Let me know if gen-check still flags anything.

@arkodg arkodg added this to the v1.8.0 Release milestone May 4, 2026
@kkk777-7

kkk777-7 commented May 7, 2026

Copy link
Copy Markdown
Member

Hi @mvanhorn, could you check and run make gen-check again?

@zhaohuabing zhaohuabing changed the title feat(helm): propagate commonLabels to RBAC resources fix(helm): propagate commonLabels to RBAC resources May 7, 2026
@zhaohuabing

zhaohuabing commented May 8, 2026

Copy link
Copy Markdown
Member

Hi @mvanhorn sorry for pushing directly to this PR. We would like to get it in v1.8.0.

@zhaohuabing zhaohuabing requested a review from a team May 8, 2026 00:19
@arkodg arkodg merged commit 9236db0 into envoyproxy:main May 8, 2026
59 of 63 checks passed
@mvanhorn

mvanhorn commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @zhaohuabing for taking it across the line, and @zirain @arkodg for the reviews. Glad it landed in v1.8.0. @kkk777-7 sorry I dropped the gen-check ball, thanks for the bump.

jukie added a commit that referenced this pull request May 13, 2026
* fix(api): increase RateLimitSelectCondition.headers MaxItems from 16 to 64 (#8906)

* fix(api): increase RateLimitSelectCondition.headers MaxItems from 16 to 64

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: wucm667 <[email protected]>
Signed-off-by: jukie <[email protected]>

* feat: policy field owner (#8538)

* feat: policy field owner

Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: jukie <[email protected]>

* skip invalid listener first in IR (#8577)

* skip invalid listener

Signed-off-by: zirain <[email protected]>

* fix specValid

Signed-off-by: zirain <[email protected]>

* nit

Signed-off-by: zirain <[email protected]>

* fix

Signed-off-by: zirain <[email protected]>

* MUST NOT pick one conflicting Listener as the winner

Signed-off-by: zirain <[email protected]>

* update

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix: remove cross ns policy attachment status (#8901)

* Revert "add warning for partially accepted targets"

This reverts commit 5d88fbb.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* remove warning condition for cross-ns policy attachments without referenceGrants

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: jukie <[email protected]>

* feat: add runner event metrics (#8802)

* add metrics for runner

Signed-off-by: zirain <[email protected]>

* rename

Signed-off-by: zirain <[email protected]>

* rename

Signed-off-by: zirain <[email protected]>

* reuse

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Co-authored-by: Arko Dasgupta <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix: respect backend endpoint hostname for health checks (#8929)

* fix: respect backend endpoint hostname for health checks

### Summary
- Keep BackendTrafficPolicy HTTP health check hostnames as explicit cluster-level hosts, and leave route-derived host fallback to xDS cluster translation.
- Preserve Backend endpoint hostnames as per-endpoint overrides via Endpoint.HealthCheckConfig.hostname, ahead of the route fallback.
- Update gatewayapi/xDS fixtures, release notes, and generated API docs/CRDs for the host selection order.

### Test plan
- go test ./internal/ir
- go test ./internal/xds/translator
- go test ./internal/gatewayapi -run TestTranslate/backendtrafficpolicy
- go test ./internal/gatewayapi -run TestTranslate/(clienttrafficpolicy-http-health-check|envoyextensionpolicy-with-extproc-with-retries|envoyextensionpolicy-with-extproc-with-traffic-features|envoyproxy-accesslog-with-traffic|envoyproxy-tracing-backend-uds|envoyproxy-tracing-backend|securitypolicy-with-jwt-backendcluster|securitypolicy-with-jwt-backendsettings)
- make generate
- make manifests
- git diff --check

Signed-off-by: Arko Dasgupta <[email protected]>
Co-authored-by: Codex <[email protected]>

* fix gen

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: zirain <[email protected]>
Co-authored-by: Codex <[email protected]>
Co-authored-by: zirain <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix(helm): propagate commonLabels to RBAC resources (#8818)

* feat(helm): propagate commonLabels to RBAC resources

Issue #8817 reported that 'helm template ... --set
commonLabels.custom-label=custom-value' left ClusterRole,
ClusterRoleBinding, Role, and RoleBinding resources unlabelled.
The other resources in the chart already include 'eg.labels' in
their metadata - which picks up 'commonLabels' via the helper
at _helpers.tpl:43 - but envoy-gateway-rbac.yaml didn't set any
labels block.

Add 'labels: {{- include "eg.labels" . | nindent 4 }}' on every
Role / RoleBinding / ClusterRole / ClusterRoleBinding declared in
envoy-gateway-rbac.yaml. Matches the existing labels pattern used
in certgen-rbac.yaml and envoy-gateway-deployment.yaml. Scopes are
'$' inside the watched-namespaces 'range' and '.' at the template
root, same rule the helper block inside the file already used.

Verified locally with:
  helm dependency update charts/gateway-helm
  envsubst < charts/gateway-helm/values.tmpl.yaml > \
    charts/gateway-helm/values.yaml
  helm template eg charts/gateway-helm \
    --set commonLabels.custom-label=custom-value | yq ...

All four RBAC resources now emit 'custom-label: custom-value' in
their metadata.labels, matching the issue's repro steps. Cert-gen
RBAC resources already carried it; this PR brings the core
envoy-gateway RBAC set into parity.

Fixes #8817

Signed-off-by: Matt Van Horn <[email protected]>

* chore: regenerate helm-template snapshots for RBAC labels

Run 'make helm-template.gateway-helm' to regenerate the snapshot fixtures
after the envoy-gateway-rbac.yaml labels change. Adds the 'labels:' block
to the RBAC resources in all 27 test cases.

Signed-off-by: Matt Van Horn <[email protected]>

* fix gen

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* add release note

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Matt Van Horn <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix(translator): set ListenerSet and listener Accepted:True for InvalidCertificateRef (#8871)

* fix(translator): set ListenerSet and listener Accepted:True for InvalidCertificateRef

When a ListenerSet listener has an unresolvable TLS certificate reference
(InvalidCertificateRef or RefNotPermitted), Accepted: False was incorrectly
set on both the listener and ListenerSet object. The Gateway API spec places
InvalidCertificateRef exclusively under ResolvedRefs, not Accepted — a missing
certificate is a reference resolution concern, not a structural one.

Fixes #8870

Signed-off-by: apkatsikas <[email protected]>

* chore: fix gofumpt formatting in validateListenerConditions

Signed-off-by: apkatsikas <[email protected]>

* fix(translator): separate RefNotPermitted from InvalidCertificateRef handling

Unlike InvalidCertificateRef, RefNotPermitted should not set Accepted:True.
Update unit test fixtures to match.

Signed-off-by: apkatsikas <[email protected]>

* fix gen

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: apkatsikas <[email protected]>
Signed-off-by: zirain <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix: do not downgrade ALPN for only hostnames-overlapping listeners (#8934)

fix: do not downgrade ALPN for overlapping hostnames withoug SANs overlapping

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: jukie <[email protected]>

* feat: enableDeferredCreationStats by default (#8937)

* feat: enableDeferredCreationStats by default

Signed-off-by: zirain <[email protected]>
Signed-off-by: jukie <[email protected]>

* fix: restore last transition time in merge status conditions (#8962)

* fix: restore last transition time in merge status conditions

Signed-off-by: Rudrakh Panigrahi <[email protected]>

* add release note

Signed-off-by: Rudrakh Panigrahi <[email protected]>

---------

Signed-off-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: jukie <[email protected]>

* [release/v1.8] v1.8.0 release notes

Cherry-picked release-notes/v1.8.0.yaml and VERSION bump from #8942.

Signed-off-by: jukie <[email protected]>

---------

Signed-off-by: wucm667 <[email protected]>
Signed-off-by: jukie <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: zirain <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Matt Van Horn <[email protected]>
Signed-off-by: apkatsikas <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>
Co-authored-by: wucm667 <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Kota Kimura <[email protected]>
Co-authored-by: zirain <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: Arko Dasgupta <[email protected]>
Co-authored-by: Codex <[email protected]>
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Andrew Katsikas <[email protected]>
Co-authored-by: Rudrakh Panigrahi <[email protected]>
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.

commonLabels helm chart value does not label all resources

5 participants