Allow cert-manager.io/allow-direct-injection in annotations

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
This commit is contained in:
Jan-Otto Kröpke 2024-02-27 12:24:57 +01:00
parent 7155520dbc
commit 818df603f5
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View File

@ -282,7 +282,7 @@ func validateSecretTemplateAnnotations(crt *internalcmapi.CertificateSpec, fldPa
secretTemplateAnnotationsPath := fldPath.Child("secretTemplate", "annotations")
for a := range crt.SecretTemplate.Annotations {
if strings.HasPrefix(a, "cert-manager.io/") {
if strings.HasPrefix(a, "cert-manager.io/") && a != "cert-manager.io/allow-direct-injection" {
el = append(el, field.Invalid(secretTemplateAnnotationsPath, a, "cert-manager.io/* annotations are not allowed"))
}
}

View File

@ -635,9 +635,10 @@ func TestValidateCertificate(t *testing.T) {
SecretName: "abc",
SecretTemplate: &internalcmapi.CertificateSecretTemplate{
Annotations: map[string]string{
"app.com/valid": "valid",
"cert-manager.io/alt-names": "example.com",
"cert-manager.io/certificate-name": "selfsigned-cert",
"app.com/valid": "valid",
"cert-manager.io/alt-names": "example.com",
"cert-manager.io/certificate-name": "selfsigned-cert",
"cert-manager.io/allow-direct-injection": "true",
},
},
IssuerRef: cmmeta.ObjectReference{