add netpol for kubeapi access for check-legacy-policies job
General MR
Summary
This job can't succeed without access to kubeapi.
Relevant logs/screenshots
Linked Issue
Closes #216 (closed)
Upgrade Notices
Kyverno 1.20 no longer enforces legacy kyverno.io policy resources (ClusterPolicy, Policy, CleanupPolicy, ClusterCleanupPolicy, and PolicyException). Their APIs remain available for read, list, export, and delete, but Kyverno never executes them.
To keep these policies from silently going unenforced, the upstream chart now refuses to install or upgrade while any of them exist on the cluster. Both a render-time check and a new pre-install,pre-upgrade hook Job (kyverno-check-legacy-policies) fail the Kyverno HelmRelease and list the offending resources.
Big Bangs kyverno-policies has shipped only policies.kyverno.io/v1 resources since Big Bang 4.0, so clusters running defaults are not affected. Before upgrading, check for legacy resources, such as policies or exceptions you added yourself or ClusterPolicy resources left over from a pre-4.0 kyverno-policies release:
kubectl get clusterpolicies.kyverno.io,policies.kyverno.io,cleanuppolicies.kyverno.io,clustercleanuppolicies.kyverno.io,policyexceptions.kyverno.io -AIf any are listed, either:
- migrate them to the
policies.kyverno.iotypes and delete the legacy resources. See Migrating Kyverno Policies to CEL-Based Policies for Big Bang 4.0 and the upstream migration guide; or - acknowledge that they will not be enforced and proceed anyway. This disables both checks. It does not restore enforcement.
packages:
kyverno:
values:
upstream:
upgrade:
acknowledgeLegacyPoliciesNotEnforced: true