Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/annotations/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const (
// to the target proxies of the Ingress.
PreSharedCertKey = "ingress.gcp.kubernetes.io/pre-shared-cert"

// ILBGlobalAccessKey is the annotation key used to enable Global Access for the L7 ILB Forwarding Rule
ILBGlobalAccessKey = "ingress.gcp.kubernetes.io/ilb-allow-global-access"

// IngressClassKey picks a specific "class" for the Ingress. The controller
// only processes Ingresses with this annotation either unset, or set
// to either gceIngressClass or the empty string.
Expand Down
4 changes: 3 additions & 1 deletion pkg/loadbalancers/forwarding_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ func (l7 *L7) checkForwardingRule(protocol namer.NamerProtocol, name, proxyLink,
env := &translator.Env{VIP: ip, Network: l7.cloud.NetworkURL(), Subnetwork: l7.cloud.SubnetworkURL()}
fr := tr.ToCompositeForwardingRule(env, protocol, version, proxyLink, description, l7.runtimeInfo.StaticIPSubnet)

fr.AllowGlobalAccess = utils.IsGCEL7ILBIngressGlobalAccessEnabled(&l7.ingress)

existing, _ = composite.GetForwardingRule(l7.cloud, key, version, l7.logger)
if existing != nil && (fr.IPAddress != "" && existing.IPAddress != fr.IPAddress || existing.PortRange != fr.PortRange) {
if existing != nil && (fr.IPAddress != "" && existing.IPAddress != fr.IPAddress || existing.PortRange != fr.PortRange || existing.AllowGlobalAccess != fr.AllowGlobalAccess) {
l7.logger.Info("Recreating forwarding rule %v(%v), so it has %v(%v)",
"existingIp", existing.IPAddress, "existingPortRange", existing.PortRange,
"targetIp", fr.IPAddress, "targetPortRange", fr.PortRange)
Expand Down
12 changes: 12 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,18 @@ func IsGCEL7ILBIngress(ing *networkingv1.Ingress) bool {
return class == annotations.GceL7ILBIngressClass
}

// IsGCEL7ILBIngressGlobalAccessEnabled returns true if the given Ingress has
// ingress.class annotation set to "gce-l7-ilb" and has Global Access enabled
func IsGCEL7ILBIngressGlobalAccessEnabled(ing *networkingv1.Ingress) bool {
if !IsGCEL7ILBIngress(ing) {
return false
}
if ilbGlobalAccess, ilbGAExists := ing.Annotations[annotations.ILBGlobalAccessKey]; ilbGAExists && ilbGlobalAccess == "true" {
return true
}
return false
}

// IsGCEL7XLBRegionalIngress returns true if the given Ingress has
// ingress.class annotation set to "gce-regional-external"
func IsGCEL7XLBRegionalIngress(ing *networkingv1.Ingress) bool {
Expand Down