GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
900 stars 231 forks source link

Bigtable clusters are not labelled as managed by cnrm #371

Open fsommar opened 3 years ago

fsommar commented 3 years ago

Describe the bug Bigtable clusters created via a managed Bigtable instance are not labelled as managed by cnrm.

ConfigConnector Version 1.34.0

To Reproduce Create a BigtableInstance using e.g. the YAML snippet below. Verify that the instance itself has the label managed-by-cnrm: true:

# gcloud bigtable instances describe bigtable-sample
displayName: bigtable-sample
labels:
  cnrm-lease-expiration: '111111111'
  cnrm-lease-holder-id: abcdefgh01234
  managed-by-cnrm: 'true'
name: projects/[REDACTED]/instances/bigtable-sample
state: READY
type: PRODUCTION

Observe that the clusters created by the instance KRM do not have the label managed-by-cnrm: true:

# gcloud bigtable clusters describe us-central --instance=bigtable-sample
defaultStorageType: SSD
location: projects/[REDACTED]/locations/us-central1-a
name: projects/[REDACTED]/instances/bigtable-sample/clusters/us-central
serveNodes: 1
state: READY

As far as I understand, the cluster is managed by cnrm, although it might be considered indirectly or implicitly so. Would it be possible to propagate the label to clusters from an instance? We first entertained the idea of assuming that any child resource of a managed resource is itself managed. That does not hold true for BigQuery datasets and tables, and probably doesn't generalize to more things either.

YAML snippets:

apiVersion: bigtable.cnrm.cloud.google.com/v1beta1
kind: BigtableInstance
metadata:
  name: bigtable-sample
spec:
  cluster:
  - clusterId: us-central
    zone: us-central1-a
    numNodes: 1
spew commented 3 years ago

Hi @fsommar thank you for reporting this issue. Unfortunately the Bigtable API does not allow for labels on clusters so config connector does not yet have a way to add a label:

https://cloud.google.com/bigtable/docs/reference/admin/rest/v2/projects.instances.clusters#Cluster

fsommar commented 3 years ago

Thanks @spew, I was afraid that would be the case. We can exclude Bigtable Clusters from our resource import list for now, so this is low on our priority.

kevinsi4508 commented 2 years ago

There is no plan for Cloud Bigtable to support Labels in other resources under Instance. Tags might be a good alternative in the future.