1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 02:18:15 +00:00

chore: move cert.kyverno.io/managed-by label in constants (#7942)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-07-31 15:17:51 +02:00 committed by GitHub
parent b6251c9894
commit ee897b3ebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -2,7 +2,8 @@ package kyverno
const (
// Well known labels
LabelAppManagedBy = "app.kubernetes.io/managed-by"
LabelAppManagedBy = "app.kubernetes.io/managed-by"
LabelCertManagedBy = "cert.kyverno.io/managed-by"
// Well known annotations
AnnotationAutogenControllers = "pod-policies.kyverno.io/autogen-controllers"
AnnotationPolicyCategory = "policies.kyverno.io/category"

View file

@ -22,9 +22,7 @@ const (
CAValidityDuration = 365 * 24 * time.Hour
// TLSValidityDuration is the valid duration for TLS certificates
TLSValidityDuration = 150 * 24 * time.Hour
// managedByLabel is added to Kyverno managed secrets
managedByLabel = "cert.kyverno.io/managed-by"
rootCAKey = "rootCA.crt"
rootCAKey = "rootCA.crt"
)
type CertValidator interface {
@ -228,7 +226,7 @@ func (c *certRenewer) writeSecret(ctx context.Context, name string, key *rsa.Pri
Name: name,
Namespace: config.KyvernoNamespace(),
Labels: map[string]string{
managedByLabel: kyverno.ValueKyvernoApp,
kyverno.LabelCertManagedBy: kyverno.ValueKyvernoApp,
},
},
Type: corev1.SecretTypeTLS,

View file

@ -89,7 +89,7 @@ func isSecretManagedByKyverno(secret *corev1.Secret) bool {
if labels == nil {
return false
}
if labels[managedByLabel] != kyverno.ValueKyvernoApp {
if labels[kyverno.LabelCertManagedBy] != kyverno.ValueKyvernoApp {
return false
}
}