Skip to content

Conversation

ldelossa
Copy link
Contributor

@ldelossa ldelossa commented Aug 19, 2025

This PR is a precursor for integrating with the ztunnel mTLS proxy.

Ztunnel's control plane expects a cluster-wide view of endpoints. It groups endpoints into trust anchors via their namespace and service account details.

Historically, the service account details for remote endpoints were not communicated via the agent.
In this PR we update the necessary identity structures to push the service account's visible into the agent.

In the ztunnel integration proper, the ztunnel control plane component will hook into the K8s watcher to inform ztunnel of created or deleted endpoints. Support for kvstore involves more work around the Identity watcher and will be deferred for the time being.

Add Kubernetes ServiceAccount to CiliumEndpoint and CiliumEndpointSlice structures

@ldelossa ldelossa requested review from a team as code owners August 19, 2025 15:08
@ldelossa ldelossa requested review from aanm and bimmlerd August 19, 2025 15:08
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Aug 19, 2025
@ldelossa ldelossa added the release-note/misc This PR makes changes that have no direct user impact. label Aug 19, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Aug 19, 2025
@ldelossa ldelossa added area/kvstore Impacts the KVStore package interactions. area/agent Cilium agent related. labels Aug 19, 2025
@github-actions github-actions bot added the sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. label Aug 19, 2025
@aanm aanm requested a review from giorio94 August 19, 2025 15:22
@joestringer joestringer requested a review from a team August 19, 2025 17:06
@ldelossa ldelossa force-pushed the ztunnel/populate-service-account branch 3 times, most recently from 6769fe6 to b7dd66a Compare August 20, 2025 01:10
@ldelossa
Copy link
Contributor Author

/test

Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

A couple of minor comments inline, but overall makes sense to me.

@ldelossa ldelossa force-pushed the ztunnel/populate-service-account branch 3 times, most recently from f414c3e to a4092fc Compare August 20, 2025 12:40
@ldelossa ldelossa requested a review from a team as a code owner August 20, 2025 12:40
@ldelossa ldelossa requested a review from MrFreezeex August 20, 2025 12:40
@ldelossa ldelossa force-pushed the ztunnel/populate-service-account branch from a4092fc to adbff1b Compare August 20, 2025 12:44
@ldelossa ldelossa requested a review from giorio94 August 20, 2025 12:44
@ldelossa ldelossa force-pushed the ztunnel/populate-service-account branch from adbff1b to aa15582 Compare August 20, 2025 12:57
In preparation for ztunnel integration, make a CEP's service account
visible to the k8s CEP watcher.

ZTunnel identifies workloads by their namespace/service account pair.
It also requires the Cilium agent to forward CEP add/delete events to
it, so it can keep its own proxy cache. Therefore, we need the service
account of a CEP present to forward this information to ztunnel.

While we can obtain the namespace from the object's meta, the service
account is not available. Therefore, populate the service account
information during endpoint manager synchornization. This pushes the CEP
CRD up to the control plane with the service account field populated.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
To support ztunnel integration with Cilium in CiliumEndpointSlice mode we
must populate the service account field in the CoreCiliumEndpoint
structure.

This allows agents to obtain the service account of a endpoint when the
endpoint is encoded as a CoreCiliumEndpoint within
a CiliumEndpointSlice.

The agent will require this field when integrating ztunnel, since
ztunnel considers this a key component of an Endpoint's identifier.

Note: the 'omitempty` json tag on the Encryption field within this
patchset was done to silence a linting error stating is was
redundant for struct field members

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
In preparation for ztunnel integration when Cilium is in kvstore mode we
populate the distributed identity structures with a servivce account.

This allows an agent to understand the service account of a remote
identity, which is a requirement for ztunnel.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
@ldelossa ldelossa force-pushed the ztunnel/populate-service-account branch from aa15582 to 5d60c7b Compare August 20, 2025 13:03
@ldelossa
Copy link
Contributor Author

/test

@giorio94 giorio94 removed the request for review from MrFreezeex August 21, 2025 06:51
Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

/lgtm, thanks!

Copy link
Member

@bimmlerd bimmlerd left a comment

Choose a reason for hiding this comment

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

I think I'm lacking some amount of context on this change - is there a CFP or something that I can read to understand the design a bit more?

Copy link
Member

@bimmlerd bimmlerd left a comment

Choose a reason for hiding this comment

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

concerns addressed, thanks!

Adding the discussion label for the upgrade discussion which is ongoing - feel free to remove once that's resolved. (Also the mergeability check was stuck, this should get it unstuck 😁)

@bimmlerd bimmlerd added the dont-merge/discussion A discussion is ongoing and should be resolved before merging, regardless of reviews & tests status. label Aug 22, 2025
@ldelossa ldelossa removed the dont-merge/discussion A discussion is ongoing and should be resolved before merging, regardless of reviews & tests status. label Aug 22, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Aug 22, 2025
@ldelossa ldelossa added this pull request to the merge queue Aug 22, 2025
Merged via the queue into main with commit b932724 Aug 22, 2025
393 of 398 checks passed
@ldelossa ldelossa deleted the ztunnel/populate-service-account branch August 22, 2025 16:16
@joestringer
Copy link
Member

I'd suggest adjusting the release note to just something like "Add Kubernetes ServiceAccount to CiliumEndpoint and CiliumEndpointSlice structures" since this is a generic change.

@ldelossa
Copy link
Contributor Author

ldelossa commented Sep 2, 2025

@joestringer done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/agent Cilium agent related. area/kvstore Impacts the KVStore package interactions. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants