Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation: remove CEL for PolicyTargetRef to allow vendor extensions #3414

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ilrudie
Copy link
Contributor

@ilrudie ilrudie commented Jan 16, 2025

This PR removes CEL validation from PolicyTargetRef for two primary reasons:

  1. Allow vendor extensions by allowing Istio policy to target non-Istio references
  2. Allow Istio policy to target a GatewayClass

@ilrudie ilrudie requested a review from a team as a code owner January 16, 2025 19:05
@istio-testing istio-testing added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 16, 2025
@ilrudie ilrudie changed the base branch from target-ref-gwclass to master January 16, 2025 19:09
@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 16, 2025
//
// When binding to a GatewayClass resource using PolicyTargetReference, your policy must be in the root namespace.
//
// Supported kinds are core/Service, networking.istio.io/ServiceEntry, gateway.networking.k8s.io/Gateway, and gateway.networking.k8s.io/GatewayClass
Copy link
Member

Choose a reason for hiding this comment

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

This is documented on the individual usages. Like

networking/v1alpha3/envoy_filter.proto
871:  repeated istio.type.v1beta1.PolicyTargetReference targetRefs = 6;

We should update those. We might want to only include it there, in case there are per-policy supported types? If we know all will be the same then here is probably good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good shout. Actually, looking at this more closely it's probably most clear now with no CEL to simply not mention supported group/kind of the PolicyTargetRef message at all. Support likely varies by where it is used and should be mentioned where this message is used going forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would we want to allow binding resources which are not Authorization Policy to a GatewayClass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved supported group/kind from being centralized on the message to being in our higher lever resources where the PolicyTargetRef is used. TBH, after the move I'm feeling less certain about doing it this way but it is an improvement over having inconsistent group/kind information in different contexts.

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

Overall LGTM

- https://github.com/istio/istio/issues/54696
releaseNotes:
- |
**Removed** CEL validation of group/kind for PolicyTargetReference to enable vendor extensions
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're removing the CEL validation, should we add this to the OSS ValidatingWebhook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe status, "you tried to bind to a beep.boop.bop.io/beepboop and Istiod has not honored this"

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that would work; just some indication since CEL isn't going to be enforcing it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants