Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster authenticator groups ga #2739

Merged
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
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
14 changes: 4 additions & 10 deletions third_party/terraform/resources/resource_container_cluster.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func resourceContainerCluster() *schema.Resource {
Optional: true,
Default: false,
},
<% end -%>

"authenticator_groups_config": {
Type: schema.TypeList,
Expand All @@ -396,7 +397,6 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
<% end -%>

"initial_node_count": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -1091,11 +1091,9 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
cluster.NodeConfig = expandNodeConfig(v)
}

<% unless version == 'ga' -%>
if v, ok := d.GetOk("authenticator_groups_config"); ok {
cluster.AuthenticatorGroupsConfig = expandAuthenticatorGroupsConfig(v)
}
<% end -%>

if v, ok := d.GetOk("private_cluster_config"); ok {
cluster.PrivateClusterConfig = expandPrivateClusterConfig(v)
Expand Down Expand Up @@ -1252,9 +1250,6 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
if err := d.Set("cluster_autoscaling", flattenClusterAutoscaling(cluster.Autoscaling)); err != nil {
return err
}
if err := d.Set("authenticator_groups_config", flattenAuthenticatorGroupsConfig(cluster.AuthenticatorGroupsConfig)); err != nil {
return err
}
if err := d.Set("release_channel", flattenReleaseChannel(cluster.ReleaseChannel)); err != nil {
return err
}
Expand All @@ -1264,6 +1259,9 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
return err
}
<% end -%>
if err := d.Set("authenticator_groups_config", flattenAuthenticatorGroupsConfig(cluster.AuthenticatorGroupsConfig)); err != nil {
return err
}
if cluster.DefaultMaxPodsConstraint != nil {
d.Set("default_max_pods_per_node", cluster.DefaultMaxPodsConstraint.MaxPodsPerNode)
}
Expand Down Expand Up @@ -2281,7 +2279,6 @@ func expandClusterAutoscaling(configured interface{}, d *schema.ResourceData) *c
}
<% end -%>

<% unless version == 'ga' -%>
func expandAuthenticatorGroupsConfig(configured interface{}) *containerBeta.AuthenticatorGroupsConfig {
l := configured.([]interface{})
if len(l) == 0 {
Expand All @@ -2295,7 +2292,6 @@ func expandAuthenticatorGroupsConfig(configured interface{}) *containerBeta.Auth
}
return result
}
<% end -%>

func expandMasterAuth(configured interface{}) *containerBeta.MasterAuth {
l := configured.([]interface{})
Expand Down Expand Up @@ -2560,7 +2556,6 @@ func flattenClusterNodePools(d *schema.ResourceData, config *Config, c []*contai
return nodePools, nil
}

<% unless version == 'ga' -%>
func flattenAuthenticatorGroupsConfig(c *containerBeta.AuthenticatorGroupsConfig) []map[string]interface{} {
if c == nil {
return nil
Expand All @@ -2571,7 +2566,6 @@ func flattenAuthenticatorGroupsConfig(c *containerBeta.AuthenticatorGroupsConfig
},
}
}
<% end -%>

func flattenPrivateClusterConfig(c *containerBeta.PrivateClusterConfig) []map[string]interface{} {
if c == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func TestAccContainerCluster_withMasterAuthConfig_NoCert(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
t.Parallel()
clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
Expand All @@ -216,7 +215,6 @@ func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
},
})
}
<% end -%>

func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -1961,7 +1959,6 @@ resource "google_container_cluster" "with_network_policy_enabled" {
`, clusterName)
}

<% unless version == 'ga' -%>
func testAccContainerCluster_withAuthenticatorGroupsConfig(clusterName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "container_network" {
Expand Down Expand Up @@ -2005,7 +2002,6 @@ resource "google_container_cluster" "with_authenticator_groups" {
}
`, clusterName, clusterName)
}
<% end -%>

func testAccContainerCluster_withMasterAuthorizedNetworksConfig(clusterName string, cidrs []string, emptyValue string) string {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ region are guaranteed to support the same version.
[PodSecurityPolicy](https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies) feature.
Structure is documented below.

* `authenticator_groups_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Configuration for the
* `authenticator_groups_config` - (Optional) Configuration for the
[Google Groups for GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control#groups-setup-gsuite) feature.
Structure is documented below.

Expand Down