Skip to content

Add API details GEP-3779 - E/W Authorization#3891

Merged
k8s-ci-robot merged 22 commits into
kubernetes-sigs:mainfrom
LiorLieberman:gep-3779-apis
Nov 25, 2025
Merged

Add API details GEP-3779 - E/W Authorization#3891
k8s-ci-robot merged 22 commits into
kubernetes-sigs:mainfrom
LiorLieberman:gep-3779-apis

Conversation

@LiorLieberman
Copy link
Copy Markdown
Member

@LiorLieberman LiorLieberman commented Jun 30, 2025

Add API details for GEP-3779.

More comprehensive comparison of targetRef and options for L4 and L7 authz apis is available here in https://docs.google.com/document/d/1CeagBnHDPbzpYAxBmtJqTshxAW8l-aRPwvwgAGbnv2I/edit?tab=t.0

/kind gep

Related #3779

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/gep PRs related to Gateway Enhancement Proposal(GEP) cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jun 30, 2025
@k8s-ci-robot k8s-ci-robot requested review from gcs278 and kflynn June 30, 2025 17:09
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 30, 2025
@LiorLieberman LiorLieberman changed the title Add API details GEP-3779 Add API details GEP-3779 - E/W Authorization Jun 30, 2025
Copy link
Copy Markdown
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @LiorLieberman!

Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment on lines +445 to +448
// While the exact workload identifier structure is implementation-specific,
// implementations are encouraged to follow the convention of
// `spiffe://<trust_domain>/ns/<namespace>/sa/<serviceaccount>`
// when representing Kubernetes workload identities.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why would someone use this matcher to refer to Kubernetes identities when the serviceAccounts list is below? Is this intended primarily for cross-cluster use cases?

Copy link
Copy Markdown

@ilrudie ilrudie Jul 2, 2025

Choose a reason for hiding this comment

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

I think cross-cluster or external workloads are reasonable examples which might apply.

It's niche at the moment, but I have seen users express desire to be able to assert policy at a sub-serviceAccount granularity. This seems to leave the door open for an implementation to support that use case.

Copy link
Copy Markdown
Contributor

@kflynn kflynn Aug 22, 2025

Choose a reason for hiding this comment

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

I'm really torn about this.

Ultimately this GEP boils down to attaching authorization policy to things described at layer 4, and what we're specifically looking at in this clause is the definition of a an authorization principal. Do we really want different stanzas for every possible kind of principal? If we split out ServiceAccounts and SPIFFE IDs, should we also split out JWT IDs? What if a given mesh can support Unix IDs in some way, or, I dunno, PGP keys or the like?

Likewise, having the different stanzas reflect where the implementation is getting the information feels very strange to me – forcing Chihiro to think about the way ServiceAccounts come from the mTLS handshake but oh right the JWT ID happens after that seems kind of surreal.

In a lot of ways, I'd rather just have a single set of principals that uses a URI-style specification. SPIFFE already definies this with the spiffe:// URI scheme, and it's not hard to imagine defining a parallel scheme for ServiceAccounts (k8s-sa:// maybe?). It's true that a given implementation might not support a given scheme, but then it's already true that a given implementation might not support the Identities stanza because it doesn't support SPIFFE IDs...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

JWTs are explicitly higher level, and would probably have their own definition.

I dont think we are actually opinionated on where implementation is getting the info in this API. we just listed a few options.

ServiceAccounts is just a way to make things more convenient for users with less-advanced needs. Istio has it, and I am pretty sure linkerd as well. So think of it as a way for the user to provide the service accounts (constructs they are probably more familiar with) then knowing and specifying the full identity in the required URI format.

For more context, initially I had also proposed Namespace field, but based on previous feedback here, we settled on ServiceAccounts as an easier way for common auth usecases -- see this as well.

Coming up with yet another reserved string prefix for serviceAccounts is more confusing imo, and will probably as well come at a cost of looser validation

Copy link
Copy Markdown
Contributor

@mikemorris mikemorris Oct 10, 2025

Choose a reason for hiding this comment

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

Magic strings are relatively more common in Istio config, but definitely go against the UX Gateway API has established, would strongly prefer to avoid them as a primary UX, instead reserving just for impl-specific edge cases like @ilrudie described.

I like having Service Accounts as a clean interface that masks the details of how each implementation has slightly different SPIFFE URIs, but I do think the separate stanzas are awkward - I think ideally I'd want some sort of union type where identities could hold objects that express different identity types (similar to https://gateway-api.sigs.k8s.io/reference/spec/#httproutefilter), but I'm not sure how feasible that might be...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

chiming in from SPIFFE over here (but if i'm missing context, let me know). I can imagine that Identities can be useful for cross-cluster or more granular expressivity than the ServiceAccounts below.
However, thinking more about it, for the cross-cluster case, I have a problem with how one can establish trust with the foreign trust domain and actually verify the identity properly. In addition to the Identity string, there would need to be (either here or somewhere else) some information about that foreign trust domain. We cannot simply trust that the extracted name is correct but validate against some out-of-band knowledge. Where is that information supposed to come from?

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.

In addition to the Identity string, there would need to be (either here or somewhere else) some information about that foreign trust domain.

Agreed @maia-iyer - I don't think cross-cluster with separate roots of trust ("mesh federation") is in scope yet, but we may want to consider this user story when thinking about how to express CA root(s) in the Mesh resource @LiorLieberman

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1, also cc: @kflynn for vis

Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
Comment thread geps/gep-3779/index.md Outdated
@LiorLieberman LiorLieberman requested review from ilrudie and robscott July 9, 2025 23:09
@LiorLieberman
Copy link
Copy Markdown
Member Author

/cc @kflynn @mikemorris

@k8s-ci-robot k8s-ci-robot requested a review from mikemorris July 9, 2025 23:09
Comment thread geps/gep-3779/index.md Outdated
@LiorLieberman
Copy link
Copy Markdown
Member Author

/cc @howardjohn

@k8s-ci-robot k8s-ci-robot requested a review from howardjohn July 11, 2025 23:57
@LiorLieberman
Copy link
Copy Markdown
Member Author

/label v1.4-release/targeting-experimental

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@LiorLieberman: The label(s) /label v1.4-release/targeting-experimental cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor, ci-short, ci-extended, ci-full. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

/label v1.4-release/targeting-experimental

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@shaneutt shaneutt added the v1.4-release/targeting-experimental This issue is targeting a transition to EXPERIMENTAL as part of the v1.4 release. label Jul 16, 2025
@shaneutt shaneutt added this to the v1.4.0 milestone Jul 16, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 21, 2025
Comment thread geps/gep-3779/index.md
Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
@kflynn
Copy link
Copy Markdown
Contributor

kflynn commented Nov 25, 2025

@LiorLieberman, I've commented on a few things that I think you can very easily tweak, but I'm going to go ahead and approve so that @mikemorris can LGTM with one more round. Thanks for sticking with it! 🙂

/approve

LiorLieberman and others added 3 commits November 25, 2025 08:04
Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
@mikemorris
Copy link
Copy Markdown
Contributor

I think this is in a pretty good place for an initial implementation now - we should track the ongoing work in kubernetes-sigs/network-policy-api#297 and kubernetes-sigs/network-policy-api#342 for how we might want to consider modelling more complex port rules (ranges, named ports, etc) but overall this feels fine to get started.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 25, 2025
@LiorLieberman
Copy link
Copy Markdown
Member Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2025
@robscott
Copy link
Copy Markdown
Member

🎉

Thanks for all the work on this @LiorLieberman and for all the detailed review, particularly from @kflynn and @mikemorris.

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kflynn, LiorLieberman, robscott

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2025
@k8s-ci-robot k8s-ci-robot merged commit 94655a1 into kubernetes-sigs:main Nov 25, 2025
20 checks passed
@mikemorris
Copy link
Copy Markdown
Contributor

mikemorris commented Nov 25, 2025

For future reference and alignment/discussion between specs, I just wanted to note that ClusterNetworkPolicy is facing a very similar challenge on how to safely layer additional attributes onto coarse allow/deny rules (related to challenges we might have with how to handle adding L7 rules to the spec later, and how to handle those in implementations unaware of them).

tylerauerbeck pushed a commit to tylerauerbeck/gateway-api that referenced this pull request Nov 27, 2025
* add api details gep-3779

* fmting

* some-fixes

* some-fixes

* add Namespace wide section and more clarifications

* add clarifications and link to google doc for targetRef

* more feedback

* more feedback

* add feedback and agreements from meeting

* formatting

* add guardrails

* organize the GEP

* remove l7 and deny language from the gep

* flynns feedback

* clarify whats being targeted in a namespace-wide policy

* Apply suggestions from code review

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* feedback from kubecon

* more feedback

* added label selector in GEP-713 as a graduation criteria

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* Update geps/gep-3779/index.md

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* Update geps/gep-3779/index.md

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* add enforecementLevel to the API and ports clarifications

---------

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
RoseWrightdev pushed a commit to RoseWrightdev/gateway-api that referenced this pull request Jan 8, 2026
* add api details gep-3779

* fmting

* some-fixes

* some-fixes

* add Namespace wide section and more clarifications

* add clarifications and link to google doc for targetRef

* more feedback

* more feedback

* add feedback and agreements from meeting

* formatting

* add guardrails

* organize the GEP

* remove l7 and deny language from the gep

* flynns feedback

* clarify whats being targeted in a namespace-wide policy

* Apply suggestions from code review

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* feedback from kubecon

* more feedback

* added label selector in GEP-713 as a graduation criteria

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* Update geps/gep-3779/index.md

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* Update geps/gep-3779/index.md

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>

* add enforecementLevel to the API and ports clarifications

---------

Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/gep PRs related to Gateway Enhancement Proposal(GEP) lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.