diff --git a/cmd/cli/kubectl-kyverno/exception/load.go b/cmd/cli/kubectl-kyverno/exception/load.go index ddc5c126ca82..9449cb926198 100644 --- a/cmd/cli/kubectl-kyverno/exception/load.go +++ b/cmd/cli/kubectl-kyverno/exception/load.go @@ -6,6 +6,7 @@ import ( "path/filepath" kyvernov2 "github.com/kyverno/kyverno/api/kyverno/v2" + kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1" kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1" "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/data" "github.com/kyverno/kyverno/ext/resource/convert" @@ -16,9 +17,10 @@ import ( ) var ( - factory, _ = resourceloader.New(openapiclient.NewComposite(openapiclient.NewLocalCRDFiles(data.Crds(), data.CrdsFolder))) - exceptionV2beta1 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("PolicyException") - exceptionV2 = schema.GroupVersion(kyvernov2.GroupVersion).WithKind("PolicyException") + factory, _ = resourceloader.New(openapiclient.NewComposite(openapiclient.NewLocalCRDFiles(data.Crds(), data.CrdsFolder))) + exceptionV2alpha1 = schema.GroupVersion(kyvernov2alpha1.GroupVersion).WithKind("PolicyException") + exceptionV2beta1 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("PolicyException") + exceptionV2 = schema.GroupVersion(kyvernov2.GroupVersion).WithKind("PolicyException") ) func Load(paths ...string) ([]*kyvernov2beta1.PolicyException, error) { @@ -49,7 +51,7 @@ func load(content []byte) ([]*kyvernov2beta1.PolicyException, error) { return nil, err } switch gvk { - case exceptionV2beta1, exceptionV2: + case exceptionV2alpha1, exceptionV2beta1, exceptionV2: exception, err := convert.To[kyvernov2beta1.PolicyException](untyped) if err != nil { return nil, err