Skip to content

Commit

Permalink
Update more gke tests to use bootstrapped network (GoogleCloudPlatfor…
Browse files Browse the repository at this point in the history
  • Loading branch information
shuyama1 authored and pengq-google committed May 21, 2024
1 parent 0c6e236 commit e6fb455
Show file tree
Hide file tree
Showing 25 changed files with 313 additions and 127 deletions.
16 changes: 16 additions & 0 deletions mmv1/products/gkebackup/BackupPlan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ examples:
name: 'basic-plan'
cluster_name: 'basic-cluster'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand All @@ -58,8 +62,12 @@ examples:
name: 'autopilot-plan'
cluster_name: 'autopilot-cluster'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
Expand All @@ -70,8 +78,12 @@ examples:
cluster_name: 'cmek-cluster'
key_name: 'backup-key'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand All @@ -83,8 +95,12 @@ examples:
name: 'full-plan'
cluster_name: 'full-cluster'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand Down
24 changes: 24 additions & 0 deletions mmv1/products/gkebackup/RestorePlan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,71 +43,95 @@ examples:
])"
vars:
name: 'restore-all-ns'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkebackup_restoreplan_rollback_namespace'
primary_resource_id: 'rollback_ns'
vars:
name: 'rollback-ns'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkebackup_restoreplan_protected_application'
primary_resource_id: 'rollback_app'
vars:
name: 'rollback-app'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkebackup_restoreplan_all_cluster_resources'
primary_resource_id: 'all_cluster_resources'
vars:
name: 'all-groupkinds'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkebackup_restoreplan_rename_namespace'
primary_resource_id: 'rename_ns'
vars:
name: 'rename-ns'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkebackup_restoreplan_second_transformation'
primary_resource_id: 'transform_rule'
vars:
name: 'transform-rule'
network_name: 'default'
subnetwork_name: 'default'
test_env_vars:
project: :PROJECT_NAME
deletion_protection: 'true'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
skip_sweeper: true
Expand Down
19 changes: 16 additions & 3 deletions mmv1/products/gkehub/Membership.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ examples:
primary_resource_id: 'membership'
vars:
name: 'basic'
cluster_name: 'basiccluster'
cluster_name: 'basic-cluster'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
test_env_vars:
project: :PROJECT_NAME
location: :REGION
Expand All @@ -71,21 +76,29 @@ examples:
primary_resource_id: 'membership'
vars:
name: 'basic'
cluster_name: 'basiccluster'
cluster_name: 'basic-cluster'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
- !ruby/object:Provider::Terraform::Examples
name: 'gkehub_membership_issuer'
primary_resource_id: 'membership'
vars:
name: 'basic'
cluster_name: 'basiccluster'
cluster_name: 'basic-cluster'
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand Down
6 changes: 5 additions & 1 deletion mmv1/products/gkehub2/MembershipBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ examples:
primary_resource_name: "fmt.Sprintf(\"tf-test-membership%s\", context[\"random_suffix\"]), fmt.Sprintf(\"tf-test-membership-binding%s\", context[\"random_suffix\"])"
primary_resource_id: "membership_binding"
vars:
cluster_name: "basiccluster"
cluster_name: "basic-cluster"
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand Down
6 changes: 5 additions & 1 deletion mmv1/products/gkehub2/MembershipRBACRoleBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ examples:
primary_resource_id: 'membership_rbac_role_binding'
min_version: beta
vars:
cluster_name: "basiccluster"
cluster_name: "basic-cluster"
deletion_protection: 'true'
network_name: 'default'
subnetwork_name: 'default'
test_vars_overrides:
deletion_protection: 'false'
network_name: 'acctest.BootstrapSharedTestNetwork(t, "gke-cluster")'
subnetwork_name: 'acctest.BootstrapSubnet(t, "gke-cluster", acctest.BootstrapSharedTestNetwork(t, "gke-cluster"))'
oics_vars_overrides:
deletion_protection: 'false'
test_env_vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "autopilot" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "cmek" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "full" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "google_container_cluster" "primary" {
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_backup_backup_plan" "basic" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resource "google_container_cluster" "primary" {
location = "us-central1-a"
initial_node_count = 1
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_hub_membership" "membership" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resource "google_container_cluster" "primary" {
location = "us-central1-a"
initial_node_count = 1
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_hub_membership" "membership" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ resource "google_container_cluster" "primary" {
workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog"
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_hub_membership" "membership" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ resource "google_container_cluster" "primary" {
location = "us-central1-a"
initial_node_count = 1
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_hub_membership" "membership" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resource "google_container_cluster" "primary" {
location = "us-central1-a"
initial_node_count = 1
deletion_protection = false
network = "<%= ctx[:vars]['network_name'] %>"
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>"
}

resource "google_gke_hub_membership" "membership" {
Expand Down
Loading

0 comments on commit e6fb455

Please sign in to comment.