Skip to content

Commit 473be78

Browse files
UseIpAliases should be true when not set and the ip_allocation_policy block is set (#3732) (#2260)
Signed-off-by: Modular Magician <[email protected]>
1 parent 4a38e72 commit 473be78

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.changelog/3732.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
container: fixes a bug where useIpAlias was not defaulting to true inside the `ip_allocation_policy` block
3+
```

google-beta/resource_container_cluster.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,10 +2516,10 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf
25162516
return ac
25172517
}
25182518

2519-
func expandIPAllocationPolicy(configured interface{}, networking_mode string) (*containerBeta.IPAllocationPolicy, error) {
2519+
func expandIPAllocationPolicy(configured interface{}, networkingMode string) (*containerBeta.IPAllocationPolicy, error) {
25202520
l := configured.([]interface{})
25212521
if len(l) == 0 || l[0] == nil {
2522-
if networking_mode == "VPC_NATIVE" {
2522+
if networkingMode == "VPC_NATIVE" {
25232523
return nil, fmt.Errorf("`ip_allocation_policy` block is required for VPC_NATIVE clusters.")
25242524
}
25252525
return &containerBeta.IPAllocationPolicy{
@@ -2530,14 +2530,14 @@ func expandIPAllocationPolicy(configured interface{}, networking_mode string) (*
25302530

25312531
config := l[0].(map[string]interface{})
25322532
return &containerBeta.IPAllocationPolicy{
2533-
UseIpAliases: networking_mode == "VPC_NATIVE",
2533+
UseIpAliases: networkingMode == "VPC_NATIVE" || networkingMode == "",
25342534
ClusterIpv4CidrBlock: config["cluster_ipv4_cidr_block"].(string),
25352535
ServicesIpv4CidrBlock: config["services_ipv4_cidr_block"].(string),
25362536

25372537
ClusterSecondaryRangeName: config["cluster_secondary_range_name"].(string),
25382538
ServicesSecondaryRangeName: config["services_secondary_range_name"].(string),
25392539
ForceSendFields: []string{"UseIpAliases"},
2540-
UseRoutes: networking_mode == "ROUTES",
2540+
UseRoutes: networkingMode == "ROUTES",
25412541
}, nil
25422542
}
25432543

0 commit comments

Comments
 (0)