Skip to content

feat(agent,shield): grant endpointslices RBAC for EndpointSlice watch - #2667

Open
matteo-porta wants to merge 7 commits into
sysdiglabs:mainfrom
matteo-porta:matteo/agent-endpointslices-rbac
Open

feat(agent,shield): grant endpointslices RBAC for EndpointSlice watch#2667
matteo-porta wants to merge 7 commits into
sysdiglabs:mainfrom
matteo-porta:matteo/agent-endpointslices-rbac

Conversation

@matteo-porta

@matteo-porta matteo-porta commented Jun 30, 2026

Copy link
Copy Markdown

What this PR does / why we need it

The agent watches Service endpoint data for its network-topology feature. It is moving from the deprecated core/v1 Endpoints API to discovery.k8s.io EndpointSlice. The ClusterRoles that run this watcher only grant the core endpoints resource, so once the agent issues EndpointSlice list/watch calls they are denied (Forbidden) and endpoint topology data is silently lost.

This grants get/list/watch on discovery.k8s.io/endpointslices in the roles that run the watcher. The existing core endpoints grant is intentionally retained so older agents keep working during rollout.

Scope

  • agent chart — the agent ClusterRole runs the watcher; add the rule.
  • shield chart, host role — Host Shield sets network_topology.enabled = network_security.enabled (see templates/host/_configmap_helpers.tpl), so the host agent runs the same watcher; add the rule.
  • shield chart, cluster role — already grants discovery.k8s.io/endpointslices (gated on kubernetes_metadata / network_security); no change needed.

Files

  • charts/agent/templates/clusterrole.yaml — add endpointslices rule.
  • charts/agent/tests/clusterrole_test.yaml — assert the rule.
  • charts/agent/Chart.yaml2.8.22.8.3.
  • charts/shield/templates/host/clusterrole.yaml — add endpointslices rule.
  • charts/shield/tests/host/clusterrole_test.yaml — assert the rule.
  • charts/shield/Chart.yaml1.45.01.45.1.

Test plan

  • helm unittest charts/agent and helm unittest charts/shield — existing suites pass, new assertions green.
  • helm template → agent ClusterRole and shield host ClusterRole each contain both endpoints and endpointslices.

Checklist

  • Title of the PR starts with type and scope (feat(agent,shield):)
  • Chart Version bumped (agent 2.8.2 → 2.8.3, shield 1.45.0 → 1.45.1)
  • Variables are documented in the README.md (no new values introduced)
  • Check GithubAction checks (like lint) to avoid merge-check stoppers
  • All test files are added in the tests folder of their respective chart and have a _test suffix

@matteo-porta
matteo-porta requested a review from a team as a code owner June 30, 2026 15:21
@github-actions

Copy link
Copy Markdown
Contributor

Hi @matteo-porta. Thanks for your PR.

After inspecting your changes someone with write access to this repo needs
to approve and run the workflow.

@matteo-porta matteo-porta changed the title feat(agent): grant endpointslices RBAC for EndpointSlice watch feat(agent,shield): grant endpointslices RBAC for EndpointSlice watch Jun 30, 2026
The agent now watches discovery.k8s.io/EndpointSlices instead of the
deprecated core/v1 Endpoints. Grant get/list/watch on endpointslices so
the network-topology informer is not denied. The core endpoints
permission is retained for rollout compatibility.
Host Shield enables network_topology when network_security is on, which
runs the endpoint watcher. That watcher now lists/watches
discovery.k8s.io/EndpointSlices instead of the deprecated core/v1
Endpoints, so grant get/list/watch on endpointslices. The core endpoints
grant is retained for rollout compatibility.
@matteo-porta
matteo-porta force-pushed the matteo/agent-endpointslices-rbac branch from cc4d409 to 57a40d1 Compare July 1, 2026 11:39
ct lint renders this template with envsubst. When SECURE_AGENT_TOKEN is
empty the unquoted value left a trailing space (accessKey: ), which
yamllint's trailing-spaces rule rejects and failed the agent chart lint.
Quoting renders accessKey: "" (empty) or the real value, both valid and
trailing-space free.
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.

1 participant