DopplerHQ / kubernetes-operator

Apache License 2.0
43 stars 16 forks source link

Support custom labels on created Secret #64

Open aarguello opened 3 weeks ago

aarguello commented 3 weeks ago

Problem

The DopplerSecret CRD does not have a field to set labels on the Secret it manages. This prevents me to manage ArgoCD cluster and repository credentials using Doppler because ArgoCD determines a secret's purpose based on its label, particularly argocd.argoproj.io/secret-type: cluster | repository | repo-creds.

Proposal

Add a labels field under managedSecret, so that I could declare something like the following:

apiVersion: secrets.doppler.com/v1alpha1
kind: DopplerSecret
metadata:
  namespace: doppler-operator-system
  name: argocd-cluster-credentials
spec:
  tokenSecret:
    name: doppler-token-secret-argocd
  managedSecret:
    name: argocd-cluster-credentials
    namespace: argocd
    labels:
      argocd.argoproj.io/secret-type: cluster

Another alternative would be to replicate the labels of the DopplerSecret to the Secret.

Please let me know if you think this feature makes sense and, if it does, whether you'd like me to send a PR for it or prefer that the project maintainers handle it.

References

nmanoogian commented 3 weeks ago

Thanks for the recommendation, @aarguello! I like your initial proposal for defining labels on the managedSecret object. If you're up for it, a PR for this feature would be much appreciated!

Lp-Francois commented 5 days ago

I was running into the exact same issue!

It would be nice to support annotations as well.

aarguello commented 5 days ago

I'll set aside some time next week to submit a PR!