fix gke tests (#977)

This commit is contained in:
Dana Hoffman 2018-01-18 09:51:55 -08:00 committed by GitHub
parent 91cf319f0e
commit 92b9984dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 106 deletions

View File

@ -1057,7 +1057,7 @@ resource "google_container_cluster" "with_master_auth" {
master_auth { master_auth {
username = "mr.yoda" username = "mr.yoda"
password = "adoy.rm" password = "adoy.rm.123456789"
} }
}`, acctest.RandString(10)) }`, acctest.RandString(10))
} }
@ -1122,11 +1122,6 @@ resource "google_container_cluster" "with_additional_zones" {
"us-central1-b", "us-central1-b",
"us-central1-c" "us-central1-c"
] ]
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}`, clusterName) }`, clusterName)
} }
@ -1142,11 +1137,6 @@ resource "google_container_cluster" "with_additional_zones" {
"us-central1-b", "us-central1-b",
"us-central1-c", "us-central1-c",
] ]
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}`, clusterName) }`, clusterName)
} }
@ -1194,11 +1184,6 @@ resource "google_container_cluster" "with_version" {
zone = "us-central1-a" zone = "us-central1-a"
min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}`, clusterName) }`, clusterName)
} }
@ -1213,11 +1198,6 @@ resource "google_container_cluster" "with_version" {
zone = "us-central1-a" zone = "us-central1-a"
min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.2}" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.2}"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}`, clusterName) }`, clusterName)
} }
@ -1233,11 +1213,6 @@ resource "google_container_cluster" "with_version" {
min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.1}" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.1}"
node_version = "${data.google_container_engine_versions.central1a.valid_node_versions.1}" node_version = "${data.google_container_engine_versions.central1a.valid_node_versions.1}"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}`, clusterName) }`, clusterName)
} }
@ -1248,11 +1223,6 @@ resource "google_container_cluster" "with_node_config" {
zone = "us-central1-f" zone = "us-central1-f"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_config { node_config {
machine_type = "n1-standard-1" machine_type = "n1-standard-1"
disk_size_gb = 15 disk_size_gb = 15
@ -1285,11 +1255,6 @@ resource "google_container_cluster" "with_node_config_scope_alias" {
zone = "us-central1-f" zone = "us-central1-f"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_config { node_config {
machine_type = "g1-small" machine_type = "g1-small"
disk_size_gb = 15 disk_size_gb = 15
@ -1310,11 +1275,6 @@ resource "google_container_cluster" "with_net_ref_by_url" {
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
network = "${google_compute_network.container_network.self_link}" network = "${google_compute_network.container_network.self_link}"
} }
@ -1363,11 +1323,6 @@ resource "google_container_cluster" "primary" {
"us-central1-c", "us-central1-c",
] ]
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_config { node_config {
oauth_scopes = [ oauth_scopes = [
"https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute",
@ -1430,11 +1385,6 @@ resource "google_container_cluster" "with_node_pool" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
name = "%s" name = "%s"
initial_node_count = 2 initial_node_count = 2
@ -1484,11 +1434,6 @@ resource "google_container_cluster" "with_node_pool" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
name = "%s" name = "%s"
initial_node_count = 2 initial_node_count = 2
@ -1506,11 +1451,6 @@ resource "google_container_cluster" "with_node_pool" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
name = "%s" name = "%s"
initial_node_count = 2 initial_node_count = 2
@ -1528,11 +1468,6 @@ resource "google_container_cluster" "with_node_pool_name_prefix" {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
name_prefix = "tf-np-test" name_prefix = "tf-np-test"
node_count = 2 node_count = 2
@ -1546,11 +1481,6 @@ resource "google_container_cluster" "with_node_pool_multiple" {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
node_count = 2 node_count = 2
@ -1569,11 +1499,6 @@ resource "google_container_cluster" "with_node_pool_multiple" {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
zone = "us-central1-a" zone = "us-central1-a"
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
node_pool { node_pool {
# ERROR: name and name_prefix cannot be both specified # ERROR: name and name_prefix cannot be both specified
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"

View File

@ -410,7 +410,7 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, clusterName, prefi
if err != nil { if err != nil {
return err return err
} }
cluster := d.Get("cluster").(string)
npName := d.Get(prefix + "name").(string) npName := d.Get(prefix + "name").(string)
if d.HasChange(prefix + "autoscaling") { if d.HasChange(prefix + "autoscaling") {
@ -434,8 +434,8 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, clusterName, prefi
req := &container.UpdateClusterRequest{ req := &container.UpdateClusterRequest{
Update: update, Update: update,
} }
mutexKV.Lock(containerClusterMutexKey(project, zone, cluster)) mutexKV.Lock(containerClusterMutexKey(project, zone, clusterName))
defer mutexKV.Unlock(containerClusterMutexKey(project, zone, cluster)) defer mutexKV.Unlock(containerClusterMutexKey(project, zone, clusterName))
op, err := config.clientContainer.Projects.Zones.Clusters.Update( op, err := config.clientContainer.Projects.Zones.Clusters.Update(
project, zone, clusterName, req).Do() project, zone, clusterName, req).Do()
if err != nil { if err != nil {
@ -460,8 +460,8 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, clusterName, prefi
req := &container.SetNodePoolSizeRequest{ req := &container.SetNodePoolSizeRequest{
NodeCount: newSize, NodeCount: newSize,
} }
mutexKV.Lock(containerClusterMutexKey(project, zone, cluster)) mutexKV.Lock(containerClusterMutexKey(project, zone, clusterName))
defer mutexKV.Unlock(containerClusterMutexKey(project, zone, cluster)) defer mutexKV.Unlock(containerClusterMutexKey(project, zone, clusterName))
op, err := config.clientContainer.Projects.Zones.Clusters.NodePools.SetSize(project, zone, clusterName, npName, req).Do() op, err := config.clientContainer.Projects.Zones.Clusters.NodePools.SetSize(project, zone, clusterName, npName, req).Do()
if err != nil { if err != nil {
return err return err
@ -491,8 +491,8 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, clusterName, prefi
req := &container.SetNodePoolManagementRequest{ req := &container.SetNodePoolManagementRequest{
Management: management, Management: management,
} }
mutexKV.Lock(containerClusterMutexKey(project, zone, cluster)) mutexKV.Lock(containerClusterMutexKey(project, zone, clusterName))
defer mutexKV.Unlock(containerClusterMutexKey(project, zone, cluster)) defer mutexKV.Unlock(containerClusterMutexKey(project, zone, clusterName))
op, err := config.clientContainer.Projects.Zones.Clusters.NodePools.SetManagement( op, err := config.clientContainer.Projects.Zones.Clusters.NodePools.SetManagement(
project, zone, clusterName, npName, req).Do() project, zone, clusterName, npName, req).Do()

View File

@ -325,11 +325,6 @@ resource "google_container_cluster" "cluster" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 3 initial_node_count = 3
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
} }
resource "google_container_node_pool" "np" { resource "google_container_node_pool" "np" {
@ -377,11 +372,6 @@ resource "google_container_cluster" "cluster" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 3 initial_node_count = 3
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
} }
resource "google_container_node_pool" "np" { resource "google_container_node_pool" "np" {
@ -402,11 +392,6 @@ resource "google_container_cluster" "cluster" {
name = "%s" name = "%s"
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 3 initial_node_count = 3
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
} }
resource "google_container_node_pool" "np" { resource "google_container_node_pool" "np" {
@ -577,10 +562,6 @@ resource "google_container_cluster" "cluster" {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
} }
resource "google_container_node_pool" "np_with_node_config" { resource "google_container_node_pool" "np_with_node_config" {
name = "tf-nodepool-test-%s" name = "tf-nodepool-test-%s"
@ -608,10 +589,6 @@ resource "google_container_cluster" "cluster" {
name = "tf-cluster-nodepool-test-%s" name = "tf-cluster-nodepool-test-%s"
zone = "us-central1-a" zone = "us-central1-a"
initial_node_count = 1 initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
} }
resource "google_container_node_pool" "np_with_node_config_scope_alias" { resource "google_container_node_pool" "np_with_node_config_scope_alias" {
name = "tf-nodepool-test-%s" name = "tf-nodepool-test-%s"