What would you like to be added (User Story)?
As a user I would like to be able to set custom annotations and labels on the secrets that are created that hold the KubeConfig data. I could then use these custom annotations to allow Cluster API to integrate better with tools like reflector (https://github.com/emberstack/kubernetes-reflector) which require you to annotate source secrets.
Detailed Description
CAPI creates a kubeconfig Secret for each managed cluster but provides no way to set
custom annotations or labels on that secret. Tools that gate on annotations (e.g.
Reflector, which requires reflector.v1.k8s.emberstack.com/reflection-allowed: "true")
cannot be used without some kind of workaround, like a CronJob that continuously re-patches the annotation
after CAPI reconciliation removes it.
This issue proposes adding spec.kubeconfig.metadata.{annotations,labels} to ClusterSpec
so that CAPI sets and maintains these values on the generated kubeconfig secret.
Use case
Reflector (https://github.com/emberstack/kubernetes-reflector) mirrors Kubernetes secrets
across namespaces. It requires the source secret to carry
reflector.v1.k8s.emberstack.com/reflection-allowed: "true". Any tool with similar
annotation-based admission gating has the same problem.
Prior art
This was previously proposed in #9651 and closed for lack of a concrete use case.
Proposed API
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
spec:
kubeconfig:
metadata:
annotations:
reflector.v1.k8s.emberstack.com/reflection-allowed: "true"
Anything else you would like to add?
Already have a PR in mind and will submit that shortly!
Label(s) to be applied
/kind feature
/area cluster
What would you like to be added (User Story)?
As a user I would like to be able to set custom annotations and labels on the secrets that are created that hold the KubeConfig data. I could then use these custom annotations to allow Cluster API to integrate better with tools like reflector (https://github.com/emberstack/kubernetes-reflector) which require you to annotate source secrets.
Detailed Description
CAPI creates a kubeconfig Secret for each managed cluster but provides no way to set
custom annotations or labels on that secret. Tools that gate on annotations (e.g.
Reflector, which requires
reflector.v1.k8s.emberstack.com/reflection-allowed: "true")cannot be used without some kind of workaround, like a CronJob that continuously re-patches the annotation
after CAPI reconciliation removes it.
This issue proposes adding
spec.kubeconfig.metadata.{annotations,labels}toClusterSpecso that CAPI sets and maintains these values on the generated kubeconfig secret.
Use case
Reflector (https://github.com/emberstack/kubernetes-reflector) mirrors Kubernetes secrets
across namespaces. It requires the source secret to carry
reflector.v1.k8s.emberstack.com/reflection-allowed: "true". Any tool with similarannotation-based admission gating has the same problem.
Prior art
This was previously proposed in #9651 and closed for lack of a concrete use case.
Proposed API
Anything else you would like to add?
Already have a PR in mind and will submit that shortly!
Label(s) to be applied
/kind feature
/area cluster