From c3ce784f11942962cd795a813d842353bead9d2b Mon Sep 17 00:00:00 2001 From: justinsb Date: Fri, 7 Jun 2024 14:16:07 -0400 Subject: [PATCH] bigtable: workaround for autoscaling --- pkg/resourceoverrides/bigtable_instance.go | 71 +++ pkg/resourceoverrides/overrides.go | 1 + ...ct_bigtableinstanceautoscaling.golden.yaml | 8 + .../bigtableinstanceautoscaling/_http.log | 548 ++++++++++++++++++ .../bigtableinstanceautoscaling/update.yaml | 12 +- .../unchanged-merge/_http02.log | 419 ------------- .../unchanged-merge/_object03.yaml | 2 - 7 files changed, 634 insertions(+), 427 deletions(-) create mode 100644 pkg/resourceoverrides/bigtable_instance.go diff --git a/pkg/resourceoverrides/bigtable_instance.go b/pkg/resourceoverrides/bigtable_instance.go new file mode 100644 index 00000000000..d14cf2ce68f --- /dev/null +++ b/pkg/resourceoverrides/bigtable_instance.go @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resourceoverrides + +import ( + "context" + "fmt" + + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/resourceoverrides/operations" +) + +func GetBigtableInstanceOverrides() ResourceOverrides { + ro := ResourceOverrides{ + Kind: "BigtableInstance", + } + ro.Overrides = append(ro.Overrides, noNodesWhereAutoscaling()) + return ro +} + +func noNodesWhereAutoscaling() ResourceOverride { + o := ResourceOverride{} + + // When we are applying a cluster which has autoscaling, we should not specify num_nodes (serve_nodes in GCP) + o.PreTerraformApply = func(ctx context.Context, op *operations.PreTerraformApply) error { + removeNumNodesIfAutoscaling := func(clusters []any) { + for i, clusterAny := range clusters { + cluster, ok := clusterAny.(map[string]any) + if !ok { + continue + } + + autoscalingConfig := cluster["autoscaling_config"] + if autoscalingConfig == nil { + continue + } + + delete(cluster, "num_nodes") + + // Delete from liveState also, otherwise it gets merged? + if op.LiveState != nil { + k := fmt.Sprintf("cluster.%d.num_nodes", i) + delete(op.LiveState.Attributes, k) + } + } + } + + if clusters, ok := op.TerraformConfig.Config["cluster"].([]any); ok { + removeNumNodesIfAutoscaling(clusters) + } + + if clusters, ok := op.TerraformConfig.Raw["cluster"].([]any); ok { + removeNumNodesIfAutoscaling(clusters) + } + + return nil + } + + return o +} diff --git a/pkg/resourceoverrides/overrides.go b/pkg/resourceoverrides/overrides.go index 5bc8bad36d6..abb94d32e0e 100644 --- a/pkg/resourceoverrides/overrides.go +++ b/pkg/resourceoverrides/overrides.go @@ -221,6 +221,7 @@ func (h *ROHandler) Register(ro ResourceOverrides) { } func init() { + Handler.Register(GetBigtableInstanceOverrides()) Handler.Register(GetStorageBucketResourceOverrides()) Handler.Register(GetSQLInstanceResourceOverrides()) Handler.Register(GetContainerClusterResourceOverrides()) diff --git a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_generated_object_bigtableinstanceautoscaling.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_generated_object_bigtableinstanceautoscaling.golden.yaml index cf9c42686b1..dd617977230 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_generated_object_bigtableinstanceautoscaling.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_generated_object_bigtableinstanceautoscaling.golden.yaml @@ -30,6 +30,14 @@ spec: maxNodes: 20 minNodes: 2 storageTarget: 2560 + clusterId: cluster-2-${uniqueId} + numNodes: 2 + storageType: SSD + zone: us-west1-b + - autoscalingConfig: + cpuTarget: 70 + maxNodes: 20 + minNodes: 2 clusterId: cluster-3-${uniqueId} numNodes: 2 storageType: SSD diff --git a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_http.log b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_http.log index 9b6fc24f329..c389f8e9960 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/_http.log @@ -383,6 +383,418 @@ OK --- +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters + +{ + "parent": "projects/${projectId}/instances/btinstance-${uniqueId}" +} + +OK + +{ + "clusters": [ + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-central1-a", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}", + "serveNodes": 2, + "state": "READY" + }, + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-east1-d", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}", + "serveNodes": 2, + "state": "READY" + } + ] +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance + +{ + "instance": { + "displayName": "BigtableSample", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}", + "type": "PRODUCTION" + }, + "updateMask": "displayName,type" +} + +OK + +{ + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.UpdateInstanceMetadata", + "originalRequest": { + "instance": { + "displayName": "BigtableSample", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}", + "type": "PRODUCTION" + }, + "updateMask": "displayName,type" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +--- + +GRPC /google.longrunning.Operations/GetOperation + +{ + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +OK + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.UpdateInstanceMetadata", + "finishTime": "2024-04-01T12:34:56.123456Z", + "originalRequest": { + "instance": { + "displayName": "BigtableSample", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}", + "type": "PRODUCTION" + }, + "updateMask": "displayName,type" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.Instance", + "createTime": "2024-04-01T12:34:56.123456Z", + "displayName": "BigtableSample", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}", + "state": "READY", + "type": "PRODUCTION" + } +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster + +{ + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" +} + +OK + +{ + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", + "originalRequest": { + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +--- + +GRPC /google.longrunning.Operations/GetOperation + +{ + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +OK + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", + "finishTime": "2024-04-01T12:34:56.123456Z", + "originalRequest": { + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}/locations/us-central1-a/operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.Cluster", + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-central1-a", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}", + "serveNodes": 2, + "state": "READY" + } +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster + +{ + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" +} + +OK + +{ + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", + "originalRequest": { + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +--- + +GRPC /google.longrunning.Operations/GetOperation + +{ + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}/locations/us-central1-a/operations/${operationID}" +} + +OK + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", + "finishTime": "2024-04-01T12:34:56.123456Z", + "originalRequest": { + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}" + }, + "updateMask": "clusterConfig.clusterAutoscalingConfig" + }, + "requestTime": "2024-04-01T12:34:56.123456Z" + }, + "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}/locations/us-central1-a/operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.Cluster", + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-east1-d", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}", + "serveNodes": 2, + "state": "READY" + } +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/CreateCluster + +{ + "cluster": { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "encryptionConfig": {}, + "location": "projects/${projectId}/locations/us-west1-b" + }, + "clusterId": "cluster-2-${uniqueId}", + "parent": "projects/${projectId}/instances/btinstance-${uniqueId}" +} + +OK + +{ + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.CreateClusterMetadata" + }, + "name": "operations/${operationID}" +} + +--- + +GRPC /google.longrunning.Operations/GetOperation + +{ + "name": "operations/${operationID}" +} + +OK + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.CreateClusterMetadata" + }, + "name": "operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.bigtable.admin.v2.Cluster", + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "encryptionConfig": {}, + "location": "projects/${projectId}/locations/us-west1-b", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-2-${uniqueId}", + "serveNodes": 2, + "state": "READY" + } +} + +--- + GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances { @@ -452,6 +864,25 @@ OK } }, "defaultStorageType": "SSD", + "encryptionConfig": {}, + "location": "projects/${projectId}/locations/us-west1-b", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-2-${uniqueId}", + "serveNodes": 2, + "state": "READY" + }, + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "defaultStorageType": "SSD", "location": "projects/${projectId}/locations/us-east1-d", "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}", "serveNodes": 2, @@ -531,6 +962,123 @@ OK } }, "defaultStorageType": "SSD", + "encryptionConfig": {}, + "location": "projects/${projectId}/locations/us-west1-b", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-2-${uniqueId}", + "serveNodes": 2, + "state": "READY" + }, + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-east1-d", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}", + "serveNodes": 2, + "state": "READY" + } + ] +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances + +{ + "parent": "projects/${projectId}" +} + +OK + +{ + "instances": [ + { + "createTime": "2024-04-01T12:34:56.123456Z", + "displayName": "BigtableSample", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectId}/instances/btinstance-${uniqueId}", + "state": "READY", + "type": "PRODUCTION" + } + ] +} + +--- + +GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters + +{ + "parent": "projects/${projectId}/instances/btinstance-${uniqueId}" +} + +OK + +{ + "clusters": [ + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "location": "projects/${projectId}/locations/us-central1-a", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-1-${uniqueId}", + "serveNodes": 2, + "state": "READY" + }, + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70, + "storageUtilizationGibPerNode": 2560 + } + } + }, + "defaultStorageType": "SSD", + "encryptionConfig": {}, + "location": "projects/${projectId}/locations/us-west1-b", + "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-2-${uniqueId}", + "serveNodes": 2, + "state": "READY" + }, + { + "clusterConfig": { + "clusterAutoscalingConfig": { + "autoscalingLimits": { + "maxServeNodes": 20, + "minServeNodes": 2 + }, + "autoscalingTargets": { + "cpuUtilizationPercent": 70 + } + } + }, + "defaultStorageType": "SSD", "location": "projects/${projectId}/locations/us-east1-d", "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-3-${uniqueId}", "serveNodes": 2, diff --git a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/update.yaml b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/update.yaml index 88a675718fb..43d2b480389 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigtable/v1beta1/bigtableinstance/bigtableinstanceautoscaling/update.yaml @@ -26,12 +26,12 @@ spec: cpuTarget: 70 maxNodes: 20 minNodes: 2 - # - clusterId: cluster-2-${uniqueId} - # zone: us-west1-b - # autoscalingConfig: - # cpuTarget: 70 - # maxNodes: 20 - # minNodes: 2 + - clusterId: cluster-2-${uniqueId} + zone: us-west1-b + autoscalingConfig: + cpuTarget: 70 + maxNodes: 20 + minNodes: 2 - clusterId: cluster-3-${uniqueId} zone: us-east1-d autoscalingConfig: diff --git a/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_http02.log b/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_http02.log index 8540414056d..1f846a1c298 100644 --- a/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_http02.log +++ b/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_http02.log @@ -31,425 +31,6 @@ GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters OK -{ - "clusters": [ - { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-a", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}", - "serveNodes": 3, - "state": "READY" - }, - { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-b", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}", - "serveNodes": 3, - "state": "READY" - } - ] -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters - -{ - "parent": "projects/${projectId}/instances/btinstance-${uniqueId}" -} - -OK - -{ - "clusters": [ - { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-a", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}", - "serveNodes": 3, - "state": "READY" - }, - { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-b", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}", - "serveNodes": 3, - "state": "READY" - } - ] -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance - -{ - "instance": { - "displayName": "BigtableSample", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}", - "type": "PRODUCTION" - }, - "updateMask": "displayName,type" -} - -OK - -{ - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.UpdateInstanceMetadata", - "originalRequest": { - "instance": { - "displayName": "BigtableSample", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}", - "type": "PRODUCTION" - }, - "updateMask": "displayName,type" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - ---- - -GRPC /google.longrunning.Operations/GetOperation - -{ - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - -OK - -{ - "done": true, - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.UpdateInstanceMetadata", - "finishTime": "2024-04-01T12:34:56.123456Z", - "originalRequest": { - "instance": { - "displayName": "BigtableSample", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}", - "type": "PRODUCTION" - }, - "updateMask": "displayName,type" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/locations/us-central1-a/operations/${operationID}", - "response": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.Instance", - "createTime": "2024-04-01T12:34:56.123456Z", - "displayName": "BigtableSample", - "labels": { - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}", - "state": "READY", - "type": "PRODUCTION" - } -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster - -{ - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" -} - -OK - -{ - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", - "originalRequest": { - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - ---- - -GRPC /google.longrunning.Operations/GetOperation - -{ - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - -OK - -{ - "done": true, - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", - "finishTime": "2024-04-01T12:34:56.123456Z", - "originalRequest": { - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}/locations/us-central1-a/operations/${operationID}", - "response": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.Cluster", - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-a", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-a-${uniqueId}", - "serveNodes": 3, - "state": "READY" - } -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster - -{ - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" -} - -OK - -{ - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", - "originalRequest": { - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - ---- - -GRPC /google.longrunning.Operations/GetOperation - -{ - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}/locations/us-central1-a/operations/${operationID}" -} - -OK - -{ - "done": true, - "metadata": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.PartialUpdateClusterMetadata", - "finishTime": "2024-04-01T12:34:56.123456Z", - "originalRequest": { - "cluster": { - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}" - }, - "updateMask": "clusterConfig.clusterAutoscalingConfig" - }, - "requestTime": "2024-04-01T12:34:56.123456Z" - }, - "name": "operations/projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}/locations/us-central1-a/operations/${operationID}", - "response": { - "@type": "type.googleapis.com/google.bigtable.admin.v2.Cluster", - "clusterConfig": { - "clusterAutoscalingConfig": { - "autoscalingLimits": { - "maxServeNodes": 20, - "minServeNodes": 2 - }, - "autoscalingTargets": { - "cpuUtilizationPercent": 70, - "storageUtilizationGibPerNode": 2560 - } - } - }, - "defaultStorageType": "SSD", - "location": "projects/${projectId}/locations/us-central1-b", - "name": "projects/${projectId}/instances/btinstance-${uniqueId}/clusters/cluster-b-${uniqueId}", - "serveNodes": 3, - "state": "READY" - } -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances - -{ - "parent": "projects/${projectId}" -} - -OK - -{ - "instances": [ - { - "createTime": "2024-04-01T12:34:56.123456Z", - "displayName": "BigtableSample", - "labels": { - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/instances/btinstance-${uniqueId}", - "state": "READY", - "type": "PRODUCTION" - } - ] -} - ---- - -GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters - -{ - "parent": "projects/${projectId}/instances/btinstance-${uniqueId}" -} - -OK - { "clusters": [ { diff --git a/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_object03.yaml b/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_object03.yaml index 878a89b8121..96c3cf8f7d9 100644 --- a/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_object03.yaml +++ b/tests/e2e/testdata/scenarios/bigtableinstance/unchanged-merge/_object03.yaml @@ -20,7 +20,6 @@ spec: minNodes: 2 storageTarget: 2560 clusterId: cluster-a-${uniqueId} - numNodes: 3 storageType: SSD zone: us-central1-a - autoscalingConfig: @@ -29,7 +28,6 @@ spec: minNodes: 2 storageTarget: 2560 clusterId: cluster-b-${uniqueId} - numNodes: 3 storageType: SSD zone: us-central1-b displayName: BigtableSample