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

rename TargetRefWithSectionName, add PolicyTargetReference #536

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions api/core/v1/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,28 @@ message ObjectSelector {
}
}

// TargetRef identifies Gateway API objects to apply a direct policy to.
// PolicyTargetReference identifies Gateway API objects to directly apply policy to.
// This is a copy of the upstream K8s Gateway API `targetRef` API.
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment is out of date, should be PolicyTargetReference API?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the intent was the call out the generic targetRef concept not the specific message it is using. will update though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

That link works- I must have miscopied it when trying to find it!

// See the following for more information:
// * https://gateway-api.sigs.k8s.io/geps/gep-713/
// * https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1alpha2.PolicyTargetReference
// * https://github.com/kubernetes-sigs/gateway-api/blob/b4f0307cc9269e73187300e72979e7e111ab74ab/apis/v1alpha2/policy_types.go#L34-L56
message PolicyTargetReference {
string group = 1;
string kind = 2;
string name = 3;

// Optional, if unspecified, the local namespace of the policy is inferred.
google.protobuf.StringValue namespace = 4;
}

// PolicyTargetReferenceWithSectionName identifies Gateway API objects, and optionally a specific section of those objects, to directly apply policy to.
// This is a copy of the upstream K8s Gateway API `targetRef` API.
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment is out of date, should be PolicyTargetReferenceWithSectionName API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the intent was the call out the generic targetRef concept not the specific message it is using.
I can update this though

// Note that we are only using the upstream `PolicyTargetReferenceWithSectionName` type as currently our policies will distinguish between sections.
// See the following for more information:
// * https://gateway-api.sigs.k8s.io/geps/gep-713/
// * https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1alpha2.PolicyTargetReferenceWithSectionName
// * https://github.com/kubernetes-sigs/gateway-api/blob/444631bfe06f3bcca5d0eadf1857eac1d369421d/apis/v1alpha2/policy_types.go#L58-L83
message TargetRefWithSectionName {
// * https://github.com/kubernetes-sigs/gateway-api/blob/b4f0307cc9269e73187300e72979e7e111ab74ab/apis/v1alpha2/policy_types.go#L58-L83
message PolicyTargetReferenceWithSectionName {
string group = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can not have anonymous nested objects in proto (as opposed to go struct)
have you seen a way to accomplish this?

string kind = 2;
string name = 3;
Expand Down
4 changes: 4 additions & 0 deletions changelog/v0.36.5/add-target-ref.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since this is breaking, you could move to v0.37.0 and use type BREAKING_CHANGE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the goal was to fix this before it became a breaking change as no one has consumed this message yet (see PR description for references to edge & GME)
the versioning is a bit flimsy in this repo (e.g. there is currently not a v0.36.x brach) so it seemed easiest to just break it now while there are no consumers.

that being said, it is technically a break from a semver perspective, so I'm not sure the best approach

- type: NEW_FEATURE
issueLink: https://github.com/solo-io/skv2/issues/529
description: rename TargetRefWithSectionName, add PolicyTargetReference
29 changes: 26 additions & 3 deletions pkg/api/core.skv2.solo.io/v1/core.pb.clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 49 additions & 3 deletions pkg/api/core.skv2.solo.io/v1/core.pb.equal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading