Apply cert name label to created secrets
This commit is contained in:
parent
2ef08e2b3c
commit
d60f4b447e
@ -25,6 +25,7 @@ const (
|
||||
CommonNameAnnotationKey = "certmanager.k8s.io/common-name"
|
||||
IssuerNameAnnotationKey = "certmanager.k8s.io/issuer-name"
|
||||
IssuerKindAnnotationKey = "certmanager.k8s.io/issuer-kind"
|
||||
CertificateNameKey = "certmanager.k8s.io/certificate-name"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
|
||||
@ -234,6 +234,12 @@ func (c *Controller) updateSecret(crt *v1alpha1.Certificate, namespace string, c
|
||||
secret.Annotations[v1alpha1.IssuerNameAnnotationKey] = crt.Spec.IssuerRef.Name
|
||||
secret.Annotations[v1alpha1.IssuerKindAnnotationKey] = issuerKind(crt)
|
||||
|
||||
if secret.Labels == nil {
|
||||
secret.Labels = make(map[string]string)
|
||||
}
|
||||
|
||||
secret.Labels[v1alpha1.CertificateNameKey] = crt.Name
|
||||
|
||||
// if it is a new resource
|
||||
if secret.SelfLink == "" {
|
||||
secret, err = c.client.CoreV1().Secrets(namespace).Create(secret)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user