Skip to content

fix: validatingPolicy auditAnnotation has incorrect valueExpression#1954

Open
nickexported wants to merge 2 commits intokyverno:mainfrom
nickexported:main
Open

fix: validatingPolicy auditAnnotation has incorrect valueExpression#1954
nickexported wants to merge 2 commits intokyverno:mainfrom
nickexported:main

Conversation

@nickexported
Copy link
Copy Markdown

AuditAnnotation in ValidatingPolicy is k8s admissionregistration audit annotation. The value expression must evaluate to either a string or null value. https://github.com/kubernetes/kubernetes/blob/v1.35.3/pkg/apis/admissionregistration/types.go#L378
Current example is incorrect and results in error when trying to test it on playground:

ServerError: failed to compile policy check-deployment-labels ([: Internal error: validating policy compiler 2.0 error: failed to compile policy, spec.auditAnnotations[0].valueExpression: Invalid value: "platform": ERROR: 
:1:1: undeclared reference to 'platform' (in container '') | platform | ^])

This pr fixes it by wrapping platform to a valid cel expression.

…ression

AuditAnnotation is k8s admissionregistration audit annotation. The value expression must evaluate to either a string or null value. 

Signed-off-by: nickexported <83809774+nickexported@users.noreply.github.com>
@welcome
Copy link
Copy Markdown

welcome Bot commented Apr 14, 2026

Thanks for opening your first Pull Request here! Please check out our Contributing guidelines and confirm that you Signed off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant