-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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 ILB FirewallRules to be consistent with other resource names. #84622
Conversation
/assign @MrHohn |
staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go
Show resolved
Hide resolved
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.
LGTM overall and left some comments.
staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go
Show resolved
Hide resolved
@@ -248,7 +248,17 @@ func (g *Cloud) ensureInternalLoadBalancerDeleted(clusterName, clusterID string, | |||
return err | |||
} | |||
|
|||
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting firewall for traffic", loadBalancerName) | |||
fwName := MakeFirewallName(loadBalancerName) |
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 wonder would it matter if we share firewall name between external/internal LB. Since we only check for existence on the rule during ensurance, would there be a chance that the firewall for the external one isn't deleted and we mistakenly think that is for the internal one?
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 was wondering the same.. even if we share the same prefix, we wouldn't share the same rule, since the loadbalancerName is a unique id? If that collided, it is an issue for all the other resources - backend service, forwarding rule etc?
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 was under the impression that the loadbalancerName would be the same if it is for the same service:
https://github.com/kubernetes/kubernetes/blob/d1d663096ba9180bb295b40b6b20f8ceb0e11ddc/staging/src/k8s.io/cloud-provider/cloud.go#L82-L91
But good point that this is already an issue for forwarding rule (not for backend service because ELB uses target pool). I just realize we in fact check whether firewall rule is equal, so this should be fine.
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.
correct. the name will be the same if it is for the same service. But we can only have either ILB or externalLB at a time for a service, so this should be ok. to your second point, that's correct - externalLB uses target pool.
staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go
Show resolved
Hide resolved
629d799
to
7bbd13d
Compare
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.
LGTM but will let Minhan take a look as well :)
/approve
@@ -248,7 +248,17 @@ func (g *Cloud) ensureInternalLoadBalancerDeleted(clusterName, clusterID string, | |||
return err | |||
} | |||
|
|||
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting firewall for traffic", loadBalancerName) | |||
fwName := MakeFirewallName(loadBalancerName) |
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 was under the impression that the loadbalancerName would be the same if it is for the same service:
https://github.com/kubernetes/kubernetes/blob/d1d663096ba9180bb295b40b6b20f8ceb0e11ddc/staging/src/k8s.io/cloud-provider/cloud.go#L82-L91
But good point that this is already an issue for forwarding rule (not for backend service because ELB uses target pool). I just realize we in fact check whether firewall rule is equal, so this should be fine.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrHohn, prameshj 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 |
@@ -328,6 +338,29 @@ func (g *Cloud) ensureInternalFirewall(svc *v1.Service, fwName, fwDesc string, s | |||
if err != nil && !isNotFound(err) { | |||
return err | |||
} | |||
// TODO Remove legacyFwName logic after 3 releases, so there would have been atleast 2 master upgrades that would |
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.
TODO needs issue number for tracking
TODO(12345): xxxxxxxxxx
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.
Done
7bbd13d
to
b13ce69
Compare
/kind bug |
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.
LGTM
just one nit.
@@ -248,7 +248,17 @@ func (g *Cloud) ensureInternalLoadBalancerDeleted(clusterName, clusterID string, | |||
return err | |||
} | |||
|
|||
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting firewall for traffic", loadBalancerName) | |||
fwName := MakeFirewallName(loadBalancerName) | |||
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting firewall %s for traffic", fwName, loadBalancerName) |
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.
Just nit:
consider this?
deleteFunc := func(fwName string) {
if err := ignoreNotFound(g.DeleteFirewall(fwName)); err != nil {
if isForbidden(err) && g.OnXPN() {
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): could not delete traffic firewall on XPN cluster. Raising event.", fwName)
g.raiseFirewallChangeNeededEvent(svc, FirewallToGCloudDeleteCmd(loadBalancerName, g.NetworkProjectID()))
} else {
return err
}
}
}
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting firewall %s for traffic", fwName, loadBalancerName)
deleteFunc(fwName)
klog.V(2).Infof("ensureInternalLoadBalancerDeleted(%v): deleting legacy name firewall for traffic", loadBalancerName)
deleteFunc(loadBalancerName)
b13ce69
to
4ae88e7
Compare
4ae88e7
to
f6e2a3c
Compare
ExternalLB and the healthcheck firewall rules follow this naming convention. addressed review comments.
f6e2a3c
to
a52125c
Compare
/lgtm |
/priority-important-soon |
/priority important-soon |
…22-upstream-release-1.16 Automated cherry pick of #84622: Create ILB firewall name with prefix "k8s-fw".
…22-upstream-release-1.15 Automated cherry pick of #84622: Create ILB firewall name with prefix "k8s-fw".
What type of PR is this?
What this PR does / why we need it:
This PR changes ILB firewall names to contain the "k8s-fw-" prefix like the rest of the firewall rules. This is needed for consistency and also for other components to identify the firewall rule as k8s/service-controller managed.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: