-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Check deletion_protection when type or scheme has changed #2942
Conversation
Hi @yasinlachiny. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #2942 +/- ##
==========================================
- Coverage 54.40% 54.06% -0.35%
==========================================
Files 145 145
Lines 8429 8483 +54
==========================================
Hits 4586 4586
- Misses 3512 3566 +54
Partials 331 331
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I'm a little confused by the logic here. If the scheme of an existing ALB cannot be changed, then changing the scheme in the specification requires removing and recreating the load balancer. Having deletion protection enabled on the old load balancer does not remove this need to replace the LB in order for it to be within spec. It looks like this PR causes LBC to silently leave the LB out of spec. This does not seem to be desirable behavior. If the current behavior is not desirable, then an admission webhook should probably prevent modifications to the spec that cannot be implemented with deletion protection when the LB has deletion protection enabled. So that the webhook doesn't have to query the AWS API for the status of the LB, the reconciler should probably store the LB's deletion protection status in the ingresses using it. Since the load balancer status doesn't have a useful field for this, it'd probably have to be an annotation on the Ingress. |
Hi @johngmyers I changed the logic and used webhook so if a user changes
I used |
@@ -19,6 +19,9 @@ import ( | |||
|
|||
const ( | |||
apiPathValidateNetworkingIngress = "/validate-networking-v1-ingress" | |||
lbAttrsDeletionProtectionEnabled = "deletion_protection.enabled" | |||
schemDefault = "internal" |
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.
defaultScheme
@@ -19,6 +19,9 @@ import ( | |||
|
|||
const ( | |||
apiPathValidateNetworkingIngress = "/validate-networking-v1-ingress" | |||
lbAttrsDeletionProtectionEnabled = "deletion_protection.enabled" | |||
schemDefault = "internal" | |||
defaultIngressClass = "alb" |
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.
Per the documentation, the default ingress class is the one with the ingressclass.kubernetes.io/is-default-class
annotation set to true
. It's not necessarily the one named alb
.
I can't find the code that uses that annotation, though.
} | ||
|
||
// Check if the scheme or type of the load balancer changed in the new Ingress object | ||
if rawSchemaold != rawSchema || ingClass != oldIngClass { |
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.
Incorrectly ignores any scheme set in the IngressClassParams
.
_, err := v.annotationParser.ParseStringMapAnnotation(annotations.IngressSuffixLoadBalancerAttributes, &lbAttributes, ing.Annotations) | ||
if err != nil { | ||
return "", err | ||
} |
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.
Incorectly ignores any deletion protection set through the loadBalancerAttributes
of the IngressClassParams
.
I do like the approach, though. A good question would be if this could reuse the controller's code for determining if the old and new ingresses would have deletion protection and/or the scheme changed. Even better would be to determine if the controller would have to reprovision the LB, to make the check cover issues other than scheme. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yasinlachiny 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 |
Hi @johngmyers
We can certainly use an existing function to determine whether we should delete I did half of the way to creating the model in
|
Signed-off-by: yasin.lachiny <yasin.lachiny@gmail.com>
Signed-off-by: yasin.lachiny <yasin.lachiny@gmail.com>
Hi @johngmyers @kishorj @M00nF1sh |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. 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 kubernetes/test-infra repository. |
Signed-off-by: yasin.lachiny yasin.lachiny@gmail.com
Issue
Fixes: 2940
Description
If we change the scheme of load balancer it will remove the load balancer and recreate it. but
deletion_protection
is enabled via an annotation in ingress.I check
deletion_protection
and based on that decide whether to recreate ALB or notChecklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯