Skip to content

Commit 26f1311

Browse files
committed
Add AllowGlobalAccess support for InternalLoadBalancer.
1 parent f24b413 commit 26f1311

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

api/v1beta1/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,12 @@ type LoadBalancer struct {
371371
// required for the Load Balancer, if not defined the first configured subnet will be
372372
// used.
373373
Subnet *string `json:"subnet,omitempty"`
374+
375+
// AllowGlobalAccess. If set to true, clients can access the internal
376+
// passthrough Network Load Balancers, the regional internal Application Load
377+
// Balancer, and the regional internal proxy Network Load Balancer from all
378+
// regions. If false, only allows access from the local region the load
379+
// balancer is located at. Note that for INTERNAL_MANAGED forwarding rules,
380+
// this field cannot be changed after the forwarding rule is created.
381+
AllowGlobalAccess bool `json:"allowGlobalAccess,omitempty"`
374382
}

cloud/services/compute/loadbalancers/reconcile.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ func (s *Service) createOrGetRegionalForwardingRule(ctx context.Context, lbname
599599
log := log.FromContext(ctx)
600600
spec := s.scope.ForwardingRuleSpec(lbname)
601601
spec.LoadBalancingScheme = string(loadBalanceTrafficInternal)
602+
if lbSpec := s.scope.LoadBalancer(); lbSpec.InternalLoadBalancer != nil {
603+
spec.AllowGlobalAccess = lbSpec.InternalLoadBalancer.AllowGlobalAccess
604+
}
602605
spec.Region = s.scope.Region()
603606
spec.BackendService = backendSvc.SelfLink
604607
// Ports is used instead or PortRange for passthrough Load Balancer

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclusters.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ spec:
122122
description: InternalLoadBalancer is the configuration for an
123123
Internal Passthrough Network Load Balancer.
124124
properties:
125+
allowGlobalAccess:
126+
description: |-
127+
AllowGlobalAccess. If set to true, clients can access the internal
128+
passthrough Network Load Balancers, the regional internal Application Load
129+
Balancer, and the regional internal proxy Network Load Balancer from all
130+
regions. If false, only allows access from the local region the load
131+
balancer is located at. Note that for INTERNAL_MANAGED forwarding rules,
132+
this field cannot be changed after the forwarding rule is created.
133+
type: boolean
125134
name:
126135
description: |-
127136
Name is the name of the Load Balancer. If not set a default name

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclustertemplates.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ spec:
138138
description: InternalLoadBalancer is the configuration
139139
for an Internal Passthrough Network Load Balancer.
140140
properties:
141+
allowGlobalAccess:
142+
description: |-
143+
AllowGlobalAccess. If set to true, clients can access the internal
144+
passthrough Network Load Balancers, the regional internal Application Load
145+
Balancer, and the regional internal proxy Network Load Balancer from all
146+
regions. If false, only allows access from the local region the load
147+
balancer is located at. Note that for INTERNAL_MANAGED forwarding rules,
148+
this field cannot be changed after the forwarding rule is created.
149+
type: boolean
141150
name:
142151
description: |-
143152
Name is the name of the Load Balancer. If not set a default name

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ spec:
117117
description: InternalLoadBalancer is the configuration for an
118118
Internal Passthrough Network Load Balancer.
119119
properties:
120+
allowGlobalAccess:
121+
description: |-
122+
AllowGlobalAccess. If set to true, clients can access the internal
123+
passthrough Network Load Balancers, the regional internal Application Load
124+
Balancer, and the regional internal proxy Network Load Balancer from all
125+
regions. If false, only allows access from the local region the load
126+
balancer is located at. Note that for INTERNAL_MANAGED forwarding rules,
127+
this field cannot be changed after the forwarding rule is created.
128+
type: boolean
120129
name:
121130
description: |-
122131
Name is the name of the Load Balancer. If not set a default name

0 commit comments

Comments
 (0)