Skip to content

Commit b23c73a

Browse files
committed
allow specific GCE IGs to have public IP addresses
1 parent d39a900 commit b23c73a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/model/gcemodel/autoscalinggroup.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB
8484
if err != nil {
8585
return nil, err
8686
}
87+
88+
HasExternalIP := fi.PtrTo(false)
89+
if subnet.Type == kops.SubnetTypePublic || subnet.Type == kops.SubnetTypeUtility || ig.IsBastion() {
90+
HasExternalIP = fi.PtrTo(true)
91+
}
92+
if ig.Spec.AssociatePublicIP != nil {
93+
HasExternalIP = ig.Spec.AssociatePublicIP
94+
}
95+
8796
t := &gcetasks.InstanceTemplate{
8897
Name: s(name),
8998
NamePrefix: s(namePrefix),
@@ -97,7 +106,7 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB
97106
Preemptible: fi.PtrTo(fi.ValueOf(ig.Spec.GCPProvisioningModel) == "SPOT"),
98107
GCPProvisioningModel: ig.Spec.GCPProvisioningModel,
99108

100-
HasExternalIP: fi.PtrTo(subnet.Type == kops.SubnetTypePublic || subnet.Type == kops.SubnetTypeUtility || ig.IsBastion()),
109+
HasExternalIP: HasExternalIP,
101110

102111
Scopes: []string{
103112
"compute-rw",

0 commit comments

Comments
 (0)