Skip to content

Commit

Permalink
Do not force send insecure_kubelet_readonly_port_enabled during creat…
Browse files Browse the repository at this point in the history
  • Loading branch information
shuyama1 authored and niharika-98 committed Oct 7, 2024
1 parent 7df5063 commit e27b9f2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ func expandNodeConfigDefaults(configured interface{}) *container.NodeConfigDefau
if v, ok := config["insecure_kubelet_readonly_port_enabled"]; ok {
nodeConfigDefaults.NodeKubeletConfig = &container.NodeKubeletConfig{
InsecureKubeletReadonlyPortEnabled: expandInsecureKubeletReadonlyPortEnabled(v),
ForceSendFields: []string{"InsecureKubeletReadonlyPortEnabled"},
}
}
if variant, ok := config["logging_variant"]; ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3370,6 +3370,32 @@ func TestAccContainerCluster_withAutopilotKubeletConfig(t *testing.T) {
})
}

func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) {
t.Parallel()

randomSuffix := acctest.RandString(t, 10)
clusterName := fmt.Sprintf("tf-test-cluster-%s", randomSuffix)
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withAutopilot_withNodePoolDefaults(clusterName, networkName, subnetworkName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_protection"},
},
},
})
}


func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -10710,6 +10736,25 @@ func testAccContainerCluster_withAutopilotKubeletConfigUpdates(name, insecureKub
`, name, insecureKubeletReadonlyPortEnabled)
}

func testAccContainerCluster_withAutopilot_withNodePoolDefaults(name, networkName, subnetworkName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1"
enable_autopilot = true

node_pool_defaults {
node_config_defaults {
}
}

deletion_protection = false
network = "%s"
subnetwork = "%s"
}
`, name, networkName, subnetworkName)
}

func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string) string {
return fmt.Sprintf(`
data "google_project" "project" {
Expand Down

0 comments on commit e27b9f2

Please sign in to comment.