Skip to content

Commit

Permalink
Add new fields in VMware and BareMetal cluster resources (GoogleCloud…
Browse files Browse the repository at this point in the history
…Platform#8681)

* add upgrade_policy in vmware_cluster

* add disable_bundled_ingress in vmware_cluster

* add upgrade_policy field in bare_metal_cluster

* add binary_authorization field for bare_metal_cluster

* remove disable_bundled_ingress field as the API change it not yet released

* fix resource name conflicts in tests

* remove unspecified enum item

* Add new fields in update test

* fix yaml format

* Test the new fields changes in update test
  • Loading branch information
naitianliu-google authored Sep 7, 2023
1 parent b60a9cd commit 93aa981
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 9 deletions.
22 changes: 22 additions & 0 deletions mmv1/products/gkeonprem/BareMetalCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,28 @@ properties:
required: true
description: |
The name of the user, e.g. `[email protected]`.
- !ruby/object:Api::Type::NestedObject
name: 'binaryAuthorization'
description: Binary Authorization related configurations.
properties:
- !ruby/object:Api::Type::Enum
name: 'evaluationMode'
description: |
Mode of operation for binauthz policy evaluation. If unspecified,
defaults to DISABLED.
values:
- DISABLED
- PROJECT_SINGLETON_POLICY_ENFORCE
- !ruby/object:Api::Type::NestedObject
name: 'upgradePolicy'
description: The cluster upgrade policy.
properties:
- !ruby/object:Api::Type::Enum
name: 'policy'
description: Specifies which upgrade policy to use.
values:
- SERIAL
- CONCURRENT
- !ruby/object:Api::Type::String
name: "uid"
description: |
Expand Down
8 changes: 8 additions & 0 deletions mmv1/products/gkeonprem/VmwareCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ properties:
- !ruby/object:Api::Type::Boolean
name: 'enableControlPlaneV2'
description: Enable control plane V2. Default to false.
- !ruby/object:Api::Type::NestedObject
name: 'upgradePolicy'
description: Specifies upgrade policy for the cluster.
properties:
- !ruby/object:Api::Type::Boolean
name: 'controlPlaneOnly'
description: |
Controls whether the upgrade applies to the control plane only.
- !ruby/object:Api::Type::String
name: 'uid'
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ resource "google_gkeonprem_bare_metal_cluster" "<%= ctx[:primary_resource_id] %>
}
}
}
binary_authorization {
evaluation_mode = "DISABLED"
}
upgrade_policy {
policy = "SERIAL"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" {
}
vm_tracking_enabled = true
enable_control_plane_v2 = true
upgrade_policy {
control_plane_only = true
}
authorization {
admin_users {
username = "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBasic(t *testing.T) {
t.Parallel()

context := map[string]interface{}{}
context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
Expand Down Expand Up @@ -41,7 +43,9 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBasic(t *testing.T)
func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(t *testing.T) {
t.Parallel()

context := map[string]interface{}{}
context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
Expand Down Expand Up @@ -71,7 +75,9 @@ func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(t *testing.
func TestAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLb(t *testing.T) {
t.Parallel()

context := map[string]interface{}{}
context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
Expand Down Expand Up @@ -103,7 +109,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLbStart(context

resource "google_gkeonprem_bare_metal_cluster" "cluster-metallb" {
provider = google-beta
name = "cluster-metallb"
name = "cluster-metallb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down Expand Up @@ -179,7 +185,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateMetalLb(context map[

resource "google_gkeonprem_bare_metal_cluster" "cluster-metallb" {
provider = google-beta
name = "cluster-metallb"
name = "cluster-metallb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down Expand Up @@ -253,7 +259,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLbStart(contex

resource "google_gkeonprem_bare_metal_cluster" "cluster-manuallb" {
provider = google-beta
name = "cluster-manuallb"
name = "cluster-manuallb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down Expand Up @@ -318,6 +324,12 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLbStart(contex
}
}
}
binary_authorization {
evaluation_mode = "DISABLED"
}
upgrade_policy {
policy = "SERIAL"
}
}
`, context)
}
Expand All @@ -327,7 +339,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(context map

resource "google_gkeonprem_bare_metal_cluster" "cluster-manuallb" {
provider = google-beta
name = "cluster-manuallb"
name = "cluster-manuallb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down Expand Up @@ -381,6 +393,12 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateManualLb(context map
}
}
}
binary_authorization {
evaluation_mode = "PROJECT_SINGLETON_POLICY_ENFORCE"
}
upgrade_policy {
policy = "CONCURRENT"
}
}
`, context)
}
Expand All @@ -390,7 +408,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLbStart(context m

resource "google_gkeonprem_bare_metal_cluster" "cluster-bgplb" {
provider = google-beta
name = "cluster-bgplb"
name = "cluster-bgplb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down Expand Up @@ -475,7 +493,7 @@ func testAccGkeonpremBareMetalCluster_bareMetalClusterUpdateBgpLb(context map[st

resource "google_gkeonprem_bare_metal_cluster" "cluster-bgplb" {
provider = google-beta
name = "cluster-bgplb"
name = "cluster-bgplb%{random_suffix}"
location = "us-west1"
admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
bare_metal_version = "1.12.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLbStart(context map[
}
vm_tracking_enabled = true
enable_control_plane_v2 = true
upgrade_policy {
control_plane_only = true
}
authorization {
admin_users {
username = "[email protected]"
Expand Down Expand Up @@ -449,6 +452,9 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLb(context map[strin
}
vm_tracking_enabled = false
enable_control_plane_v2 = false
upgrade_policy {
control_plane_only = true
}
authorization {
admin_users {
username = "[email protected]"
Expand Down

0 comments on commit 93aa981

Please sign in to comment.