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

Implementing policy attachment GEP #736

Merged
merged 4 commits into from
Aug 11, 2021

Conversation

robscott
Copy link
Member

@robscott robscott commented Jul 26, 2021

What type of PR is this?
/kind documentation
/kind feature

What this PR does / why we need it:
This adds documentation for the policy attachment pattern described in GEP #713 and adds the associated PolicyTargetReference type. When combined with #732, this should be all that's required to implement the GEP.

Does this PR introduce a user-facing change?:

A new policy attachment model has been added.

Deploy Preview: https://deploy-preview-736--kubernetes-sigs-gateway-api.netlify.app/v1alpha2/references/policy-attachment/

@k8s-ci-robot k8s-ci-robot added kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. labels Jul 26, 2021
@k8s-ci-robot k8s-ci-robot requested review from jpeach and thockin July 26, 2021 19:31
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 26, 2021
@jpeach jpeach mentioned this pull request Jul 27, 2021
@robscott robscott mentioned this pull request Jul 28, 2021
@robscott robscott added this to the v1alpha2 milestone Jul 28, 2021
@robscott robscott linked an issue Jul 28, 2021 that may be closed by this pull request
@robscott
Copy link
Member Author

Adding a hold to follow up with #732 (comment).

@robscott
Copy link
Member Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2021
Copy link
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

This is looking great, just a few small wording changes from me.

apis/v1alpha2/policy_types.go Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
@hbagdi hbagdi self-requested a review August 2, 2021 22:05
@hbagdi
Copy link
Contributor

hbagdi commented Aug 3, 2021

xref #98 #99 #91 #89 #114 #97 #611

site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
@robscott robscott force-pushed the policy-implementation branch from dd8737b to f25c417 Compare August 4, 2021 01:43
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 4, 2021
@robscott robscott force-pushed the policy-implementation branch 2 times, most recently from bf74cbe to b145f5c Compare August 4, 2021 01:52
@robscott
Copy link
Member Author

robscott commented Aug 4, 2021

Thanks for the great feedback on this @hbagdi and @youngnick! I think I've responded to all feedback now, PTAL.

apis/v1alpha2/policy_types.go Outdated Show resolved Hide resolved
apis/v1alpha2/policy_types.go Outdated Show resolved Hide resolved
apis/v1alpha2/policy_types.go Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
apis/v1alpha2/policy_types.go Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2021
@robscott robscott force-pushed the policy-implementation branch from b145f5c to 4f56cfe Compare August 10, 2021 01:38
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2021
Copy link
Contributor

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

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

nits and questions, this LGTM.

site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
// Namespace is the namespace of the referent. When unspecified, the local
// namespace is inferred. Even when policy targets a resource in a different
// namespace, it MUST only apply to traffic originating from the same
// namespace as the policy.
Copy link
Contributor

Choose a reason for hiding this comment

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

So, let's say we have gateway-a in gateway-ns namespace and route-b in route-ns namespace.

If I've a policy that in gateway-ns that targets a route-b and I also have a policy in route-ns that targets route-b, the hierarchy is policy in gateway-ns > policy in route-ns.
Is that right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's my interpretation, but you've got me thinking that we may want to add more restrictions around cross-namespace policy attachment. I think the primary use case was for a mesh implementation to be able to apply policy to requests originating from the local namespace to a given destination. There's clearly also use cases for Gateway as you described above, but they may become messier than intended and/or be difficult for an implementation to support. I was about to suggest that we should make this an "Extended" concept, but the whole idea of policy attachment is already extended. So that's a long way of saying that I think your interpretation is correct, but we probably need to communicate that implementations can choose to not support cross-namespace policy.

Copy link
Contributor

Choose a reason for hiding this comment

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

but we probably need to communicate that implementations can choose to not support cross-namespace policy.

Since we are not sure, I recommend keeping cross-namespace policy for gateway out of scope. There is a need for sure but punting on would be for the best. There are a lot of other features here and we shouldn't feel pressured.

@youngnick
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 10, 2021
@robscott robscott force-pushed the policy-implementation branch from 4f56cfe to ed15276 Compare August 11, 2021 02:31
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2021
@robscott
Copy link
Member Author

/hold cancel

@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 Aug 11, 2021
@robscott robscott force-pushed the policy-implementation branch from ed15276 to fa70c18 Compare August 11, 2021 02:36
site-src/v1alpha2/references/policy-attachment.md Outdated Show resolved Hide resolved
* The oldest Policy based on creation timestamp. For example, a Policy with a
creation timestamp of "2021-07-15 01:02:03" is given precedence over a Policy
with a creation timestamp of "2021-07-15 01:02:04".
* The Policy appearing first in alphabetical order by "<namespace>/<name>". For
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: during a conflict namespace should always be the same, right? due to the hierarchy.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's likely true, but I'd prefer to avoid any possibility of conflict here if any form of hierarchy changes in the future. This is the same guidance we've used for other conflict resolution throughout the API, so I think it makes sense to keep it the same.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: howardjohn, robscott

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

The pull request process is described here

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

@robscott
Copy link
Member Author

Thanks for the great feedback on this one! I think I've addressed everything now, PTAL.

@hbagdi
Copy link
Contributor

hbagdi commented Aug 11, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2021
@k8s-ci-robot k8s-ci-robot merged commit 73456c6 into kubernetes-sigs:master Aug 11, 2021
@robscott robscott deleted the policy-implementation branch January 8, 2022 01:05
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/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extensible Service policy and configuration
6 participants