-
Notifications
You must be signed in to change notification settings - Fork 68
OCPBUGS-16728: Add admission policy to deny changing an AWS LB type on an existing service #362
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
base: main
Are you sure you want to change the base?
Conversation
@JoelSpeed: This pull request references Jira Issue OCPBUGS-16728, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@JoelSpeed: This pull request references Jira Issue OCPBUGS-16728, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
- expression: | | ||
(has(object.objectMeta.annotations) && 'service.beta.kubernetes.io/aws-load-balancer-type' in object.objectMeta.annotations) == | ||
(has(oldObject.objectMeta.annotations) && 'service.beta.kubernetes.io/aws-load-balancer-type' in oldObject.objectMeta.annotations) && | ||
object.objectMeta.annotations['service.beta.kubernetes.io/aws-load-balancer-type'] == oldObject.objectMeta.annotations['service.beta.kubernetes.io/aws-load-balancer-type'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% following how this works, so this is more for my understanding - shout if I'm wrong:
We assert that our old object and our new object have both got the annotation matching service.beta.kubernetes.io/aws-load-balancer-type
. We need this because otherwise the controller would not be able to set the value initially?
Then we check the value of the annotation remains equal:
object.objectMeta.annotations['service.beta.kubernetes.io/aws-load-balancer-type'] == oldObject.objectMeta.annotations['service.beta.kubernetes.io/aws-load-balancer-type']
If this annotation were being changed, we would fail the validation - so we would fail that update, disasllowing changing it's value.
Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assert that our old object and our new object have both got the annotation matching service.beta.kubernetes.io/aws-load-balancer-type. We need this because otherwise the controller would not be able to set the value initially?
You're close but missing one nuance, we check that whether "they have the annotation or not" is equal. If one has the annotation and the other does not, then the user changed something, and we aren't allowing that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh gotcha! Makes sense!
/lgtm |
/hold This needs testing CC @sunzhaohua2 I'd be interested to see if any QE cases are affected by this change as well, I'll give you a ping when it's ready to test |
New changes are detected. LGTM label has been removed. |
051246e
to
3cded47
Compare
3cded47
to
a21723c
Compare
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
@JoelSpeed: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/remove-lifecycle stale |
The AWS CCM does not account for changes to the type of the load balancer. The recommended and supportable approach is for users to delete and recreate the service, rather than changing the annotation live.
This PR adds policy to prevent services from adding/removing/changing the annotation to control which kind of load balancer the service represents, such that the annotation must be set on create for NLB load balancers.
This should prevent any leaking of NLB/CLB resources when users mistakenly change the load balancer type.