kubernetes-sigs / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
299 stars 65 forks source link

Add a label to all namespaces created by virtualcluster controller #272

Closed m-messiah closed 2 years ago

m-messiah commented 2 years ago

User Story As an operator I would like to have more control over resources listed by controllers to reduce the overall load to the API

Detailed Description VirtualCluster controller and in particular namespace syncer garbage collector list all resources in the cluster and only then filters them by virtualcluster annotations (like tenancy.x-k8s.io/vcname) https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/1e987ad6c3c6ef0099e898b1b6589975212523b9/virtualcluster/pkg/syncer/resources/namespace/checker.go#L90

We should consider adding a label to these namespaces, like tenancy.x-k8s.io/controlled: true and use this label in the listing mentioned.

Anything else you would like to add: Consider propagating this label to all resources created by the virtual cluster controllers in the follow-ups

/kind feature

christopherhein commented 2 years ago

cc @Fei-Guo