Skip to content

Commit

Permalink
UseIpAliases should be true when not set and the ip_allocation_policy…
Browse files Browse the repository at this point in the history
… block is set (#3732)
  • Loading branch information
megan07 authored Jul 8, 2020
1 parent 03871ca commit d432562
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2582,14 +2582,14 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf
}

<% unless version == 'ga' -%>
func expandIPAllocationPolicy(configured interface{}, networking_mode string) (*containerBeta.IPAllocationPolicy, error) {
func expandIPAllocationPolicy(configured interface{}, networkingMode string) (*containerBeta.IPAllocationPolicy, error) {
<% else -%>
func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocationPolicy, error) {
<% end -%>
l := configured.([]interface{})
if len(l) == 0 || l[0] == nil {
<% unless version == 'ga' -%>
if networking_mode == "VPC_NATIVE" {
if networkingMode == "VPC_NATIVE" {
return nil, fmt.Errorf("`ip_allocation_policy` block is required for VPC_NATIVE clusters.")
}
<% end -%>
Expand All @@ -2602,7 +2602,7 @@ func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocati
config := l[0].(map[string]interface{})
return &containerBeta.IPAllocationPolicy{
<% unless version == 'ga' -%>
UseIpAliases: networking_mode == "VPC_NATIVE",
UseIpAliases: networkingMode == "VPC_NATIVE" || networkingMode == "",
<% else -%>
UseIpAliases: true,
<% end -%>
Expand All @@ -2613,7 +2613,7 @@ func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocati
ServicesSecondaryRangeName: config["services_secondary_range_name"].(string),
ForceSendFields: []string{"UseIpAliases"},
<% unless version == 'ga' -%>
UseRoutes: networking_mode == "ROUTES",
UseRoutes: networkingMode == "ROUTES",
<% end -%>
}, nil
}
Expand Down

0 comments on commit d432562

Please sign in to comment.