-
Notifications
You must be signed in to change notification settings - Fork 303
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
Adds annotation kubernetes.io/ingress.reserve-global-static-ip-name to signal GLBC to manage static IP #1182
Adds annotation kubernetes.io/ingress.reserve-global-static-ip-name to signal GLBC to manage static IP #1182
Conversation
Hi @vinicyusmacedo. Thanks for your PR. I'm waiting for a kubernetes 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vinicyusmacedo 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 |
/cc @prameshj |
@vinicyusmacedo We need to think about how to make sure the regression is not triggered again (as you mention in the "Things not taken in consideration" section). Can you please provide some options? Ideally, we are able to introduce an API without leaving the user the opportunity to shoot themselves in the foot. |
@rramkumar1 I was thinking about checking if the Ingress already has forwarding rules. If it has one already, the ReserveGlobalStaticIP logic is skipped. This way, we will be sure that ReserveGlobalStaticIP only has effect when the ingress is being created. The problem with this approach: it will probably fail during syncs, since the expected static IP name will differ. Another approach is checking with the cloud provider if the static IP name points to the same forwarding rules as the ones on the Ingress. If it doesn't, we can fallback to using the default static IP namer. |
@rramkumar1 I had an idea for ensuring a flip doesn't happen. Please check the last commit. When It won't work for Ingresses without TLS/Static IP though, as the IP will be ephemeral. |
/ok-to-test |
…, the annotation kubernetes.io/ingress.reserve-global-static-ip becomes available, but does nothing - Adds ReserveGlobalStaticIP to L7's runtime info and populates it on controller - Adds test cases for ReserveGlobalStaticIP, whether with existing and non-existent static ip - TestReserveGlobalStaticIPExistingValue changed - If the IP already exists and ReserveGlobalStaticIP is set, the behavior shouldn't be different. - Changes getEffectiveIP behavior to return true for managed if ReserveGlobalStaticIP is provided, changes checkStaticIP to use the provided static IP name - Changes the annotation ReserveGlobalStaticIPKey – instead of being a boolean, it is now a string specifing a static ip name - Checks if l.ip is null before using ReserveGlobalStaticIPName, ensuring that if the ingress has a static IP already, it shouldn't flip to using ReserveGlobalStaticIPName
pkg/annotations/ingress.go
Outdated
// GCE static ip for its forwarding rules. If specified, the Ingress controller | ||
// reserves and assigns the static ip by this name to the forwarding rules of the | ||
// given ingress. It differs from StaticIPNameKey, since the controller does manage | ||
// this ip. |
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.
Add that it is the user's responsibility to not use the same value for both "kubernetes.io/ingress.reserve-global-static-ip-name" and "kubernetes.io/ingress.global-static-ip-name" in the same or different ingresses.
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.
Does my comment make it clear? Do not use the same value for both this annotation and GlobalStaticIPNameKey.
. Or should I change it to It's the user responsibility not to use the same value for both this annotation and GlobalStaticIPNameKey
?
@@ -117,17 +124,12 @@ func FromIngress(ing *v1beta1.Ingress) *Ingress { | |||
return &Ingress{ing.Annotations} | |||
} | |||
|
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.
Add a comment
@spencerhance Can you take a look if this can be supported with ILB staticIP config as well? |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: 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. |
This PR is a follow-up of #1151
This PR adds the
kubernetes.io/ingress.reserve-global-static-ip-name
annotation, which is a string that specifies a static IP name and manages it, differing from the behaviour ofkubernetes.io/ingress.global-static-ip-name
.Things taken in consideration
The behaviour for
kubernetes.io/ingress.global-static-ip-name
is still the same: if the static IP doesn't exist on GCE, it will fail. However,kubernetes.io/ingress.reserve-global-static-ip-name
will bypass the failure and reserve the static IP with the name provided.This is different from the default behaviour seen in #1080: even if
kubernetes.io/ingress.global-static-ip-name
was provided, the static IP was reserved with a namer (that follows the patternk8s-resource--uid
) and if the user reserved the static IP with the name provided, GLBC would flip to using that, causing downtime.In the approach of this PR, however, if
kubernetes.io/ingress.global-static-ip-name
is provided, we use its value from the beginning.To avoid flipping to a managed static IP when already using a static IP, we check if there is already a static IP for an Ingress. If it exists, the
kubernetes.io/ingress.global-static-ip-name
behaviour is ignored.Things not taken in consideration
If the user supplieskubernetes.io/ingress.reserve-global-static-ip-name
at a later time, the regression will be triggered, causing the IP flip and downtime.