Skip to content

Commit

Permalink
Adding the namespace_labels field to the GKE Hub Scope resource (Goog…
Browse files Browse the repository at this point in the history
…leCloudPlatform#9972)

* initial commit for scope-level namespace labels

* Add validation exceptions for the  field of the GKEHub Scope and Namespace resources to be of type

* Undoing unnecessary changes

* Fixing the type of Scope namespace_labels field
  • Loading branch information
hosseingolestani authored and pengq-google committed May 21, 2024
1 parent cbf5261 commit 6d000e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmv1/products/gkehub2/Scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ properties:
- :READY
- :DELETING
- :UPDATING
- !ruby/object:Api::Type::KeyValuePairs
name: 'namespaceLabels'
description: |
Scope-level cluster namespace labels. For the member clusters bound
to the Scope, these labels are applied to each namespace under the
Scope. Scope-level labels take precedence over Namespace-level
labels (`namespace_labels` in the Fleet Namespace resource) if they
share a key. Keys and values must be Kubernetes-conformant.
- !ruby/object:Api::Type::KeyValueLabels
name: 'labels'
description: |
Expand Down
5 changes: 5 additions & 0 deletions mmv1/templates/terraform/examples/gkehub_scope_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
resource "google_gke_hub_scope" "<%= ctx[:primary_resource_id] %>" {
scope_id = "<%= ctx[:vars]['resource_name'] %>"
namespace_labels = {
keyb = "valueb"
keya = "valuea"
keyc = "valuec"
}
labels = {
keyb = "valueb"
keya = "valuea"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func testAccGKEHub2Scope_gkehubScopeBasicExample_basic(context map[string]interf
return acctest.Nprintf(`
resource "google_gke_hub_scope" "scope" {
scope_id = "tf-test-scope%{random_suffix}"
namespace_labels = {
keyb = "valueb"
keya = "valuea"
keyc = "valuec"
}
labels = {
keyb = "valueb"
keya = "valuea"
Expand All @@ -60,6 +65,11 @@ func testAccGKEHub2Scope_gkehubScopeBasicExample_update(context map[string]inter
return acctest.Nprintf(`
resource "google_gke_hub_scope" "scope" {
scope_id = "tf-test-scope%{random_suffix}"
namespace_labels = {
updated_keyb = "updated_valueb"
updated_keya = "updated_valuea"
updated_keyc = "updated_valuec"
}
labels = {
updated_keyb = "updated_valueb"
updated_keya = "updated_valuea"
Expand Down

0 comments on commit 6d000e5

Please sign in to comment.