1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fix: load policies (#8403)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: kyverno-bot <104836976+kyverno-bot@users.noreply.github.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-09-14 18:54:54 +02:00 committed by GitHub
parent d5c23f0f45
commit 5181deaf2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,8 +70,10 @@ func addPolicy(policies []kyvernov1.PolicyInterface, validatingAdmissionPolicies
var policy kyvernov1.PolicyInterface
if us.GetKind() == "ClusterPolicy" {
policy = &kyvernov1.ClusterPolicy{}
} else {
} else if us.GetKind() == "Policy" {
policy = &kyvernov1.Policy{}
} else {
return policies, validatingAdmissionPolicies, nil
}
if err := runtime.DefaultUnstructuredConverter.FromUnstructuredWithValidation(us.Object, policy, true); err != nil {