From 831a9826d17ed067d8bfd095b0ebea40e3aec109 Mon Sep 17 00:00:00 2001 From: Jose Armesto Date: Fri, 29 Oct 2021 18:13:20 +0200 Subject: [PATCH] Restructure project to follow standards (#2632) Signed-off-by: Jose Armesto --- .github/workflows/e2e.yaml | 8 +- Makefile | 18 ++-- {pkg/api => api}/kyverno/register.go | 0 .../kyverno/v1/clusterpolicy_types.go | 0 {pkg/api => api}/kyverno/v1/doc.go | 0 .../kyverno/v1/generaterequest_types.go | 0 {pkg/api => api}/kyverno/v1/policy_types.go | 0 {pkg/api => api}/kyverno/v1/register.go | 2 +- {pkg/api => api}/kyverno/v1/utils.go | 0 .../kyverno/v1/zz_generated.deepcopy.go | 0 .../clusterreportchangerequest_types.go | 2 +- {pkg/api => api}/kyverno/v1alpha1/doc.go | 0 .../kyverno/v1alpha1/groupversion_info.go | 0 .../v1alpha1/reportchangerequest_types.go | 2 +- .../kyverno/v1alpha1/zz_generated.deepcopy.go | 2 +- .../clusterreportchangerequest_types.go | 2 +- {pkg/api => api}/kyverno/v1alpha2/doc.go | 0 .../kyverno/v1alpha2/groupversion_info.go | 0 .../v1alpha2/reportchangerequest_types.go | 2 +- .../kyverno/v1alpha2/zz_generated.deepcopy.go | 2 +- .../v1alpha1/clusterpolicyreport_types.go | 0 {pkg/api => api}/policyreport/v1alpha1/doc.go | 0 .../v1alpha1/groupversion_info.go | 0 .../v1alpha1/policyreport_types.go | 0 .../v1alpha1/zz_generated.deepcopy.go | 0 .../v1alpha2/clusterpolicyreport_types.go | 0 {pkg/api => api}/policyreport/v1alpha2/doc.go | 0 .../v1alpha2/groupversion_info.go | 0 .../v1alpha2/policyreport_types.go | 0 .../v1alpha2/zz_generated.deepcopy.go | 0 .../bundle/kustomization.yaml | 0 {definitions => config}/bundle/labels.yaml | 0 {definitions => config}/bundle/namespace.yaml | 0 .../crds/kustomization.yaml | 0 .../crds/kyverno.io_clusterpolicies.yaml | 0 ...yverno.io_clusterreportchangerequests.yaml | 0 .../crds/kyverno.io_generaterequests.yaml | 0 .../crds/kyverno.io_policies.yaml | 0 .../crds/kyverno.io_reportchangerequests.yaml | 0 .../wgpolicyk8s.io_clusterpolicyreports.yaml | 0 .../crds/wgpolicyk8s.io_policyreports.yaml | 0 .../debug/kustomization.yaml | 0 {definitions => config}/debug/namespace.yaml | 0 {definitions => config}/github/rbac.yaml | 0 {definitions => config}/install.yaml | 0 {definitions => config}/install_debug.yaml | 0 .../k8s-resource/clusterrolebindings.yaml | 0 .../k8s-resource/clusterroles.yaml | 0 .../k8s-resource/configmap.yaml | 0 .../k8s-resource/kustomization.yaml | 0 .../k8s-resource/metricsconfigmap.yaml | 0 .../k8s-resource/poddisruptionbudget.yaml | 0 .../k8s-resource/service.yaml | 0 .../k8s-resource/serviceaccount.yaml | 0 {definitions => config}/kustomization.yaml | 0 .../manifest/deployment.yaml | 0 .../manifest/kustomization.yaml | 0 {definitions => config}/release/install.yaml | 0 .../release/kustomization.yaml | 0 {definitions => config}/release/labels.yaml | 0 {api => data}/apiResources.go | 0 {api => data}/preferredResources.go | 0 {api => data}/swaggerDoc.go | 0 go.mod | 1 + go.sum | 6 +- .../clientset/versioned/fake/register.go | 6 +- .../clientset/versioned/scheme/register.go | 6 +- .../typed/kyverno/v1/clusterpolicy.go | 2 +- .../kyverno/v1/fake/fake_clusterpolicy.go | 2 +- .../kyverno/v1/fake/fake_generaterequest.go | 2 +- .../typed/kyverno/v1/fake/fake_policy.go | 2 +- .../typed/kyverno/v1/generaterequest.go | 2 +- .../typed/kyverno/v1/kyverno_client.go | 2 +- .../versioned/typed/kyverno/v1/policy.go | 2 +- .../v1alpha2/clusterreportchangerequest.go | 2 +- .../fake/fake_clusterreportchangerequest.go | 2 +- .../v1alpha2/fake/fake_reportchangerequest.go | 2 +- .../typed/kyverno/v1alpha2/kyverno_client.go | 2 +- .../kyverno/v1alpha2/reportchangerequest.go | 2 +- .../v1alpha2/clusterpolicyreport.go | 2 +- .../v1alpha2/fake/fake_clusterpolicyreport.go | 2 +- .../v1alpha2/fake/fake_policyreport.go | 2 +- .../policyreport/v1alpha2/policyreport.go | 2 +- .../v1alpha2/policyreport_client.go | 2 +- .../informers/externalversions/generic.go | 6 +- .../kyverno/v1/clusterpolicy.go | 2 +- .../kyverno/v1/generaterequest.go | 2 +- .../externalversions/kyverno/v1/policy.go | 2 +- .../v1alpha2/clusterreportchangerequest.go | 2 +- .../kyverno/v1alpha2/reportchangerequest.go | 2 +- .../v1alpha2/clusterpolicyreport.go | 2 +- .../policyreport/v1alpha2/policyreport.go | 2 +- .../listers/kyverno/v1/clusterpolicy.go | 16 ++-- .../kyverno/v1/custom_expansion_generated.go | 14 +-- .../listers/kyverno/v1/expansion_custom.go | 4 +- .../listers/kyverno/v1/generaterequest.go | 22 ++--- pkg/client/listers/kyverno/v1/policy.go | 22 ++--- .../v1alpha2/clusterreportchangerequest.go | 16 ++-- .../kyverno/v1alpha2/reportchangerequest.go | 22 ++--- .../v1alpha2/clusterpolicyreport.go | 16 ++-- .../policyreport/v1alpha2/policyreport.go | 22 ++--- pkg/common/common.go | 2 +- pkg/engine/context/context.go | 2 +- pkg/engine/context/context_test.go | 2 +- pkg/engine/forceMutate.go | 2 +- pkg/engine/forceMutate_test.go | 2 +- pkg/engine/generation.go | 2 +- pkg/engine/imageVerify.go | 2 +- pkg/engine/imageVerify_test.go | 2 +- pkg/engine/jsonContext.go | 3 +- pkg/engine/mutate/mutation.go | 2 +- pkg/engine/mutate/patches.go | 2 +- pkg/engine/mutate/patches_test.go | 2 +- pkg/engine/mutate/strategicMergePatch_test.go | 2 +- pkg/engine/mutation.go | 2 +- pkg/engine/mutation_test.go | 2 +- pkg/engine/policyContext.go | 2 +- pkg/engine/utils.go | 2 +- pkg/engine/utils_test.go | 86 +++++++++---------- pkg/engine/validation.go | 2 +- pkg/engine/validation_test.go | 2 +- pkg/engine/variables/evaluate.go | 2 +- pkg/engine/variables/evaluate_test.go | 2 +- pkg/engine/variables/operator/duration.go | 2 +- pkg/engine/variables/operator/numeric.go | 2 +- pkg/engine/variables/operator/operator.go | 2 +- pkg/engine/variables/variables_test.go | 2 +- pkg/engine/variables/vars.go | 2 +- pkg/engine/variables/vars_test.go | 2 +- pkg/generate/cleanup/cleanup.go | 2 +- pkg/generate/cleanup/controller.go | 2 +- pkg/generate/generate.go | 2 +- pkg/generate/generate_controller.go | 2 +- pkg/generate/report.go | 2 +- pkg/generate/resource.go | 2 +- pkg/generate/status.go | 2 +- pkg/kyverno/apply/apply_command_test.go | 2 +- pkg/kyverno/apply/generate.go | 2 +- pkg/kyverno/apply/generate_test.go | 2 +- pkg/kyverno/apply/report.go | 2 +- pkg/kyverno/apply/report_test.go | 23 +++-- pkg/kyverno/common/common.go | 8 +- pkg/kyverno/common/fetch.go | 4 +- pkg/kyverno/test/test_command.go | 2 +- pkg/kyverno/validate/command.go | 2 +- pkg/kyverno/validate/commmand_test.go | 2 +- pkg/metrics/parsers.go | 2 +- pkg/metrics/policychanges/policyChanges.go | 2 +- .../policyExecutionDuration.go | 2 +- pkg/metrics/policyresults/policyResults.go | 2 +- pkg/metrics/policyruleinfo/policyRuleInfo.go | 2 +- pkg/openapi/validation.go | 6 +- pkg/openapi/validation_test.go | 2 +- pkg/policy/actions.go | 2 +- pkg/policy/apply.go | 2 +- pkg/policy/background.go | 2 +- pkg/policy/background_test.go | 2 +- pkg/policy/common.go | 2 +- pkg/policy/existing.go | 2 +- pkg/policy/generate/fake.go | 2 +- pkg/policy/generate/validate.go | 2 +- pkg/policy/generate/validate_test.go | 2 +- pkg/policy/metrics.go | 2 +- pkg/policy/mutate/validate.go | 2 +- pkg/policy/mutate/validate_test.go | 2 +- pkg/policy/policy_controller.go | 4 +- pkg/policy/report.go | 2 +- pkg/policy/validate.go | 6 +- pkg/policy/validate/validate.go | 2 +- pkg/policy/validate/validate_test.go | 2 +- pkg/policy/validate_test.go | 2 +- pkg/policycache/cache.go | 2 +- pkg/policycache/cache_test.go | 3 +- pkg/policycache/informer.go | 2 +- pkg/policymutation/cronjob.go | 2 +- pkg/policymutation/policymutation.go | 2 +- pkg/policymutation/policymutation_test.go | 2 +- pkg/policyreport/builder.go | 6 +- pkg/policyreport/changerequestcreator.go | 2 +- pkg/policyreport/policyreport.go | 4 +- pkg/policyreport/reportcontroller.go | 10 +-- pkg/policyreport/reportrequest.go | 2 +- pkg/testrunner/scenario.go | 7 +- pkg/utils/json.go | 2 +- pkg/utils/loadpolicy.go | 2 +- pkg/utils/util.go | 2 +- pkg/webhookconfig/configmanager.go | 2 +- pkg/webhooks/common.go | 2 +- pkg/webhooks/generate/generate.go | 2 +- pkg/webhooks/generation.go | 15 ++-- pkg/webhooks/mutation.go | 9 +- pkg/webhooks/policymutation.go | 2 +- pkg/webhooks/policymutation_test.go | 2 +- pkg/webhooks/policyvalidation.go | 2 +- pkg/webhooks/report.go | 2 +- pkg/webhooks/server.go | 6 +- pkg/webhooks/validate_audit.go | 2 +- pkg/webhooks/validation.go | 2 +- pkg/webhooks/verify_images.go | 2 +- scripts/create-e2e-infrastruture.sh | 4 +- scripts/deploy-controller.sh | 4 +- ...te-self-signed-cert-and-k8secrets-debug.sh | 4 +- 202 files changed, 322 insertions(+), 321 deletions(-) rename {pkg/api => api}/kyverno/register.go (100%) rename {pkg/api => api}/kyverno/v1/clusterpolicy_types.go (100%) rename {pkg/api => api}/kyverno/v1/doc.go (100%) rename {pkg/api => api}/kyverno/v1/generaterequest_types.go (100%) rename {pkg/api => api}/kyverno/v1/policy_types.go (100%) rename {pkg/api => api}/kyverno/v1/register.go (96%) rename {pkg/api => api}/kyverno/v1/utils.go (100%) rename {pkg/api => api}/kyverno/v1/zz_generated.deepcopy.go (100%) rename {pkg/api => api}/kyverno/v1alpha1/clusterreportchangerequest_types.go (97%) rename {pkg/api => api}/kyverno/v1alpha1/doc.go (100%) rename {pkg/api => api}/kyverno/v1alpha1/groupversion_info.go (100%) rename {pkg/api => api}/kyverno/v1alpha1/reportchangerequest_types.go (97%) rename {pkg/api => api}/kyverno/v1alpha1/zz_generated.deepcopy.go (98%) rename {pkg/api => api}/kyverno/v1alpha2/clusterreportchangerequest_types.go (97%) rename {pkg/api => api}/kyverno/v1alpha2/doc.go (100%) rename {pkg/api => api}/kyverno/v1alpha2/groupversion_info.go (100%) rename {pkg/api => api}/kyverno/v1alpha2/reportchangerequest_types.go (97%) rename {pkg/api => api}/kyverno/v1alpha2/zz_generated.deepcopy.go (98%) rename {pkg/api => api}/policyreport/v1alpha1/clusterpolicyreport_types.go (100%) rename {pkg/api => api}/policyreport/v1alpha1/doc.go (100%) rename {pkg/api => api}/policyreport/v1alpha1/groupversion_info.go (100%) rename {pkg/api => api}/policyreport/v1alpha1/policyreport_types.go (100%) rename {pkg/api => api}/policyreport/v1alpha1/zz_generated.deepcopy.go (100%) rename {pkg/api => api}/policyreport/v1alpha2/clusterpolicyreport_types.go (100%) rename {pkg/api => api}/policyreport/v1alpha2/doc.go (100%) rename {pkg/api => api}/policyreport/v1alpha2/groupversion_info.go (100%) rename {pkg/api => api}/policyreport/v1alpha2/policyreport_types.go (100%) rename {pkg/api => api}/policyreport/v1alpha2/zz_generated.deepcopy.go (100%) rename {definitions => config}/bundle/kustomization.yaml (100%) rename {definitions => config}/bundle/labels.yaml (100%) rename {definitions => config}/bundle/namespace.yaml (100%) rename {definitions => config}/crds/kustomization.yaml (100%) rename {definitions => config}/crds/kyverno.io_clusterpolicies.yaml (100%) rename {definitions => config}/crds/kyverno.io_clusterreportchangerequests.yaml (100%) rename {definitions => config}/crds/kyverno.io_generaterequests.yaml (100%) rename {definitions => config}/crds/kyverno.io_policies.yaml (100%) rename {definitions => config}/crds/kyverno.io_reportchangerequests.yaml (100%) rename {definitions => config}/crds/wgpolicyk8s.io_clusterpolicyreports.yaml (100%) rename {definitions => config}/crds/wgpolicyk8s.io_policyreports.yaml (100%) rename {definitions => config}/debug/kustomization.yaml (100%) rename {definitions => config}/debug/namespace.yaml (100%) rename {definitions => config}/github/rbac.yaml (100%) rename {definitions => config}/install.yaml (100%) rename {definitions => config}/install_debug.yaml (100%) rename {definitions => config}/k8s-resource/clusterrolebindings.yaml (100%) rename {definitions => config}/k8s-resource/clusterroles.yaml (100%) rename {definitions => config}/k8s-resource/configmap.yaml (100%) rename {definitions => config}/k8s-resource/kustomization.yaml (100%) rename {definitions => config}/k8s-resource/metricsconfigmap.yaml (100%) rename {definitions => config}/k8s-resource/poddisruptionbudget.yaml (100%) rename {definitions => config}/k8s-resource/service.yaml (100%) rename {definitions => config}/k8s-resource/serviceaccount.yaml (100%) rename {definitions => config}/kustomization.yaml (100%) rename {definitions => config}/manifest/deployment.yaml (100%) rename {definitions => config}/manifest/kustomization.yaml (100%) rename {definitions => config}/release/install.yaml (100%) rename {definitions => config}/release/kustomization.yaml (100%) rename {definitions => config}/release/labels.yaml (100%) rename {api => data}/apiResources.go (100%) rename {api => data}/preferredResources.go (100%) rename {api => data}/swaggerDoc.go (100%) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index a085298243..ead258916e 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -74,8 +74,8 @@ jobs: - name: e2e testing run: | echo ">>> Install Kyverno" - sed 's/imagePullPolicy:.*$/imagePullPolicy: IfNotPresent/g' ${GITHUB_WORKSPACE}/definitions/install.yaml | kubectl apply -f - - kubectl apply -f ${GITHUB_WORKSPACE}/definitions/github/rbac.yaml + sed 's/imagePullPolicy:.*$/imagePullPolicy: IfNotPresent/g' ${GITHUB_WORKSPACE}/config/install.yaml | kubectl apply -f - + kubectl apply -f ${GITHUB_WORKSPACE}/config/github/rbac.yaml chmod a+x ${GITHUB_WORKSPACE}/scripts/verify-deployment.sh sleep 50 echo ">>> Check kyverno" @@ -86,7 +86,7 @@ jobs: kubectl port-forward svc/kyverno-svc-metrics -n kyverno 8000:8000 & echo ">>> Run Kyverno e2e test" make test-e2e - kubectl delete -f ${GITHUB_WORKSPACE}/definitions/install.yaml + kubectl delete -f ${GITHUB_WORKSPACE}/config/install.yaml - name: Update chart values run: | @@ -111,4 +111,4 @@ jobs: kubectl get mutatingwebhookconfigurations,validatingwebhookconfigurations kubectl -n kyverno get pod kubectl -n kyverno describe pod | grep -i events -A10 - kubectl -n kyverno logs deploy/kyverno \ No newline at end of file + kubectl -n kyverno logs deploy/kyverno diff --git a/Makefile b/Makefile index 7791d41cd5..f2ccc2351b 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ docker-push-kyverno: ################################## generate-api-docs: - go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./pkg/api -config documentation/api/config.json -template-dir documentation/api/template -out-file documentation/index.html + go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./api -config documentation/api/config.json -template-dir documentation/api/template -out-file documentation/index.html ################################## @@ -228,7 +228,7 @@ test-e2e: test-e2e-local: $(eval export E2E="ok") - kubectl apply -f https://raw.githubusercontent.com/kyverno/kyverno/main/definitions/github/rbac.yaml + kubectl apply -f https://raw.githubusercontent.com/kyverno/kyverno/main/config/github/rbac.yaml kubectl port-forward -n kyverno service/kyverno-svc-metrics 8000:8000 & go test ./test/e2e/metrics -v go test ./test/e2e/mutate -v @@ -252,26 +252,26 @@ godownloader: # kustomize-crd will create install.yaml kustomize-crd: # Create CRD for helm deployment Helm - kustomize build ./definitions/release | kustomize cfg grep kind=CustomResourceDefinition > ./charts/kyverno/templates/crds.yaml + kustomize build ./config/release | kustomize cfg grep kind=CustomResourceDefinition > ./charts/kyverno/templates/crds.yaml # Generate install.yaml that have all resources for kyverno - kustomize build ./definitions > ./definitions/install.yaml + kustomize build ./config > ./config/install.yaml # Generate install_debug.yaml that for developer testing - kustomize build ./definitions/debug > ./definitions/install_debug.yaml + kustomize build ./config/debug > ./config/install_debug.yaml # guidance https://github.com/kyverno/kyverno/wiki/Generate-a-Release release: - kustomize build ./definitions > ./definitions/install.yaml - kustomize build ./definitions/release > ./definitions/release/install.yaml + kustomize build ./config > ./config/install.yaml + kustomize build ./config/release > ./config/release/install.yaml release-notes: @bash -c 'while IFS= read -r line ; do if [[ "$$line" == "## "* && "$$line" != "## $(VERSION)" ]]; then break ; fi; echo "$$line"; done < "CHANGELOG.md"' \ true kyverno-crd: controller-gen - $(CONTROLLER_GEN) crd paths=./pkg/api/kyverno/... crd:crdVersions=v1 output:dir=./definitions/crds + $(CONTROLLER_GEN) crd paths=./api/kyverno/... crd:crdVersions=v1 output:dir=./config/crds report-crd: controller-gen - $(CONTROLLER_GEN) crd paths=./pkg/api/policyreport/... crd:crdVersions=v1 output:dir=./definitions/crds + $(CONTROLLER_GEN) crd paths=./api/policyreport/... crd:crdVersions=v1 output:dir=./config/crds # install the right version of controller-gen install-controller-gen: diff --git a/pkg/api/kyverno/register.go b/api/kyverno/register.go similarity index 100% rename from pkg/api/kyverno/register.go rename to api/kyverno/register.go diff --git a/pkg/api/kyverno/v1/clusterpolicy_types.go b/api/kyverno/v1/clusterpolicy_types.go similarity index 100% rename from pkg/api/kyverno/v1/clusterpolicy_types.go rename to api/kyverno/v1/clusterpolicy_types.go diff --git a/pkg/api/kyverno/v1/doc.go b/api/kyverno/v1/doc.go similarity index 100% rename from pkg/api/kyverno/v1/doc.go rename to api/kyverno/v1/doc.go diff --git a/pkg/api/kyverno/v1/generaterequest_types.go b/api/kyverno/v1/generaterequest_types.go similarity index 100% rename from pkg/api/kyverno/v1/generaterequest_types.go rename to api/kyverno/v1/generaterequest_types.go diff --git a/pkg/api/kyverno/v1/policy_types.go b/api/kyverno/v1/policy_types.go similarity index 100% rename from pkg/api/kyverno/v1/policy_types.go rename to api/kyverno/v1/policy_types.go diff --git a/pkg/api/kyverno/v1/register.go b/api/kyverno/v1/register.go similarity index 96% rename from pkg/api/kyverno/v1/register.go rename to api/kyverno/v1/register.go index c2f1d5e6f7..644b7b0bdb 100755 --- a/pkg/api/kyverno/v1/register.go +++ b/api/kyverno/v1/register.go @@ -1,7 +1,7 @@ package v1 import ( - "github.com/kyverno/kyverno/pkg/api/kyverno" + "github.com/kyverno/kyverno/api/kyverno" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/api/kyverno/v1/utils.go b/api/kyverno/v1/utils.go similarity index 100% rename from pkg/api/kyverno/v1/utils.go rename to api/kyverno/v1/utils.go diff --git a/pkg/api/kyverno/v1/zz_generated.deepcopy.go b/api/kyverno/v1/zz_generated.deepcopy.go similarity index 100% rename from pkg/api/kyverno/v1/zz_generated.deepcopy.go rename to api/kyverno/v1/zz_generated.deepcopy.go diff --git a/pkg/api/kyverno/v1alpha1/clusterreportchangerequest_types.go b/api/kyverno/v1alpha1/clusterreportchangerequest_types.go similarity index 97% rename from pkg/api/kyverno/v1alpha1/clusterreportchangerequest_types.go rename to api/kyverno/v1alpha1/clusterreportchangerequest_types.go index 7f9350839a..d362e693e5 100644 --- a/pkg/api/kyverno/v1alpha1/clusterreportchangerequest_types.go +++ b/api/kyverno/v1alpha1/clusterreportchangerequest_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/api/kyverno/v1alpha1/doc.go b/api/kyverno/v1alpha1/doc.go similarity index 100% rename from pkg/api/kyverno/v1alpha1/doc.go rename to api/kyverno/v1alpha1/doc.go diff --git a/pkg/api/kyverno/v1alpha1/groupversion_info.go b/api/kyverno/v1alpha1/groupversion_info.go similarity index 100% rename from pkg/api/kyverno/v1alpha1/groupversion_info.go rename to api/kyverno/v1alpha1/groupversion_info.go diff --git a/pkg/api/kyverno/v1alpha1/reportchangerequest_types.go b/api/kyverno/v1alpha1/reportchangerequest_types.go similarity index 97% rename from pkg/api/kyverno/v1alpha1/reportchangerequest_types.go rename to api/kyverno/v1alpha1/reportchangerequest_types.go index e23437c46b..6c82bee2fc 100644 --- a/pkg/api/kyverno/v1alpha1/reportchangerequest_types.go +++ b/api/kyverno/v1alpha1/reportchangerequest_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go b/api/kyverno/v1alpha1/zz_generated.deepcopy.go similarity index 98% rename from pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go rename to api/kyverno/v1alpha1/zz_generated.deepcopy.go index 9effd366a1..4282f90bbc 100644 --- a/pkg/api/kyverno/v1alpha1/zz_generated.deepcopy.go +++ b/api/kyverno/v1alpha1/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha1 import ( - policyreportv1alpha1 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1" + policyreportv1alpha1 "github.com/kyverno/kyverno/api/policyreport/v1alpha1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/api/kyverno/v1alpha2/clusterreportchangerequest_types.go b/api/kyverno/v1alpha2/clusterreportchangerequest_types.go similarity index 97% rename from pkg/api/kyverno/v1alpha2/clusterreportchangerequest_types.go rename to api/kyverno/v1alpha2/clusterreportchangerequest_types.go index d4b48292e4..f6034d7906 100644 --- a/pkg/api/kyverno/v1alpha2/clusterreportchangerequest_types.go +++ b/api/kyverno/v1alpha2/clusterreportchangerequest_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha2 import ( - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/api/kyverno/v1alpha2/doc.go b/api/kyverno/v1alpha2/doc.go similarity index 100% rename from pkg/api/kyverno/v1alpha2/doc.go rename to api/kyverno/v1alpha2/doc.go diff --git a/pkg/api/kyverno/v1alpha2/groupversion_info.go b/api/kyverno/v1alpha2/groupversion_info.go similarity index 100% rename from pkg/api/kyverno/v1alpha2/groupversion_info.go rename to api/kyverno/v1alpha2/groupversion_info.go diff --git a/pkg/api/kyverno/v1alpha2/reportchangerequest_types.go b/api/kyverno/v1alpha2/reportchangerequest_types.go similarity index 97% rename from pkg/api/kyverno/v1alpha2/reportchangerequest_types.go rename to api/kyverno/v1alpha2/reportchangerequest_types.go index 3f7fb94b7e..d6cb057bab 100644 --- a/pkg/api/kyverno/v1alpha2/reportchangerequest_types.go +++ b/api/kyverno/v1alpha2/reportchangerequest_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha2 import ( - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/api/kyverno/v1alpha2/zz_generated.deepcopy.go b/api/kyverno/v1alpha2/zz_generated.deepcopy.go similarity index 98% rename from pkg/api/kyverno/v1alpha2/zz_generated.deepcopy.go rename to api/kyverno/v1alpha2/zz_generated.deepcopy.go index 2fbd8752e7..a77d2dde54 100644 --- a/pkg/api/kyverno/v1alpha2/zz_generated.deepcopy.go +++ b/api/kyverno/v1alpha2/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ limitations under the License. package v1alpha2 import ( - policyreportv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/api/policyreport/v1alpha1/clusterpolicyreport_types.go b/api/policyreport/v1alpha1/clusterpolicyreport_types.go similarity index 100% rename from pkg/api/policyreport/v1alpha1/clusterpolicyreport_types.go rename to api/policyreport/v1alpha1/clusterpolicyreport_types.go diff --git a/pkg/api/policyreport/v1alpha1/doc.go b/api/policyreport/v1alpha1/doc.go similarity index 100% rename from pkg/api/policyreport/v1alpha1/doc.go rename to api/policyreport/v1alpha1/doc.go diff --git a/pkg/api/policyreport/v1alpha1/groupversion_info.go b/api/policyreport/v1alpha1/groupversion_info.go similarity index 100% rename from pkg/api/policyreport/v1alpha1/groupversion_info.go rename to api/policyreport/v1alpha1/groupversion_info.go diff --git a/pkg/api/policyreport/v1alpha1/policyreport_types.go b/api/policyreport/v1alpha1/policyreport_types.go similarity index 100% rename from pkg/api/policyreport/v1alpha1/policyreport_types.go rename to api/policyreport/v1alpha1/policyreport_types.go diff --git a/pkg/api/policyreport/v1alpha1/zz_generated.deepcopy.go b/api/policyreport/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from pkg/api/policyreport/v1alpha1/zz_generated.deepcopy.go rename to api/policyreport/v1alpha1/zz_generated.deepcopy.go diff --git a/pkg/api/policyreport/v1alpha2/clusterpolicyreport_types.go b/api/policyreport/v1alpha2/clusterpolicyreport_types.go similarity index 100% rename from pkg/api/policyreport/v1alpha2/clusterpolicyreport_types.go rename to api/policyreport/v1alpha2/clusterpolicyreport_types.go diff --git a/pkg/api/policyreport/v1alpha2/doc.go b/api/policyreport/v1alpha2/doc.go similarity index 100% rename from pkg/api/policyreport/v1alpha2/doc.go rename to api/policyreport/v1alpha2/doc.go diff --git a/pkg/api/policyreport/v1alpha2/groupversion_info.go b/api/policyreport/v1alpha2/groupversion_info.go similarity index 100% rename from pkg/api/policyreport/v1alpha2/groupversion_info.go rename to api/policyreport/v1alpha2/groupversion_info.go diff --git a/pkg/api/policyreport/v1alpha2/policyreport_types.go b/api/policyreport/v1alpha2/policyreport_types.go similarity index 100% rename from pkg/api/policyreport/v1alpha2/policyreport_types.go rename to api/policyreport/v1alpha2/policyreport_types.go diff --git a/pkg/api/policyreport/v1alpha2/zz_generated.deepcopy.go b/api/policyreport/v1alpha2/zz_generated.deepcopy.go similarity index 100% rename from pkg/api/policyreport/v1alpha2/zz_generated.deepcopy.go rename to api/policyreport/v1alpha2/zz_generated.deepcopy.go diff --git a/definitions/bundle/kustomization.yaml b/config/bundle/kustomization.yaml similarity index 100% rename from definitions/bundle/kustomization.yaml rename to config/bundle/kustomization.yaml diff --git a/definitions/bundle/labels.yaml b/config/bundle/labels.yaml similarity index 100% rename from definitions/bundle/labels.yaml rename to config/bundle/labels.yaml diff --git a/definitions/bundle/namespace.yaml b/config/bundle/namespace.yaml similarity index 100% rename from definitions/bundle/namespace.yaml rename to config/bundle/namespace.yaml diff --git a/definitions/crds/kustomization.yaml b/config/crds/kustomization.yaml similarity index 100% rename from definitions/crds/kustomization.yaml rename to config/crds/kustomization.yaml diff --git a/definitions/crds/kyverno.io_clusterpolicies.yaml b/config/crds/kyverno.io_clusterpolicies.yaml similarity index 100% rename from definitions/crds/kyverno.io_clusterpolicies.yaml rename to config/crds/kyverno.io_clusterpolicies.yaml diff --git a/definitions/crds/kyverno.io_clusterreportchangerequests.yaml b/config/crds/kyverno.io_clusterreportchangerequests.yaml similarity index 100% rename from definitions/crds/kyverno.io_clusterreportchangerequests.yaml rename to config/crds/kyverno.io_clusterreportchangerequests.yaml diff --git a/definitions/crds/kyverno.io_generaterequests.yaml b/config/crds/kyverno.io_generaterequests.yaml similarity index 100% rename from definitions/crds/kyverno.io_generaterequests.yaml rename to config/crds/kyverno.io_generaterequests.yaml diff --git a/definitions/crds/kyverno.io_policies.yaml b/config/crds/kyverno.io_policies.yaml similarity index 100% rename from definitions/crds/kyverno.io_policies.yaml rename to config/crds/kyverno.io_policies.yaml diff --git a/definitions/crds/kyverno.io_reportchangerequests.yaml b/config/crds/kyverno.io_reportchangerequests.yaml similarity index 100% rename from definitions/crds/kyverno.io_reportchangerequests.yaml rename to config/crds/kyverno.io_reportchangerequests.yaml diff --git a/definitions/crds/wgpolicyk8s.io_clusterpolicyreports.yaml b/config/crds/wgpolicyk8s.io_clusterpolicyreports.yaml similarity index 100% rename from definitions/crds/wgpolicyk8s.io_clusterpolicyreports.yaml rename to config/crds/wgpolicyk8s.io_clusterpolicyreports.yaml diff --git a/definitions/crds/wgpolicyk8s.io_policyreports.yaml b/config/crds/wgpolicyk8s.io_policyreports.yaml similarity index 100% rename from definitions/crds/wgpolicyk8s.io_policyreports.yaml rename to config/crds/wgpolicyk8s.io_policyreports.yaml diff --git a/definitions/debug/kustomization.yaml b/config/debug/kustomization.yaml similarity index 100% rename from definitions/debug/kustomization.yaml rename to config/debug/kustomization.yaml diff --git a/definitions/debug/namespace.yaml b/config/debug/namespace.yaml similarity index 100% rename from definitions/debug/namespace.yaml rename to config/debug/namespace.yaml diff --git a/definitions/github/rbac.yaml b/config/github/rbac.yaml similarity index 100% rename from definitions/github/rbac.yaml rename to config/github/rbac.yaml diff --git a/definitions/install.yaml b/config/install.yaml similarity index 100% rename from definitions/install.yaml rename to config/install.yaml diff --git a/definitions/install_debug.yaml b/config/install_debug.yaml similarity index 100% rename from definitions/install_debug.yaml rename to config/install_debug.yaml diff --git a/definitions/k8s-resource/clusterrolebindings.yaml b/config/k8s-resource/clusterrolebindings.yaml similarity index 100% rename from definitions/k8s-resource/clusterrolebindings.yaml rename to config/k8s-resource/clusterrolebindings.yaml diff --git a/definitions/k8s-resource/clusterroles.yaml b/config/k8s-resource/clusterroles.yaml similarity index 100% rename from definitions/k8s-resource/clusterroles.yaml rename to config/k8s-resource/clusterroles.yaml diff --git a/definitions/k8s-resource/configmap.yaml b/config/k8s-resource/configmap.yaml similarity index 100% rename from definitions/k8s-resource/configmap.yaml rename to config/k8s-resource/configmap.yaml diff --git a/definitions/k8s-resource/kustomization.yaml b/config/k8s-resource/kustomization.yaml similarity index 100% rename from definitions/k8s-resource/kustomization.yaml rename to config/k8s-resource/kustomization.yaml diff --git a/definitions/k8s-resource/metricsconfigmap.yaml b/config/k8s-resource/metricsconfigmap.yaml similarity index 100% rename from definitions/k8s-resource/metricsconfigmap.yaml rename to config/k8s-resource/metricsconfigmap.yaml diff --git a/definitions/k8s-resource/poddisruptionbudget.yaml b/config/k8s-resource/poddisruptionbudget.yaml similarity index 100% rename from definitions/k8s-resource/poddisruptionbudget.yaml rename to config/k8s-resource/poddisruptionbudget.yaml diff --git a/definitions/k8s-resource/service.yaml b/config/k8s-resource/service.yaml similarity index 100% rename from definitions/k8s-resource/service.yaml rename to config/k8s-resource/service.yaml diff --git a/definitions/k8s-resource/serviceaccount.yaml b/config/k8s-resource/serviceaccount.yaml similarity index 100% rename from definitions/k8s-resource/serviceaccount.yaml rename to config/k8s-resource/serviceaccount.yaml diff --git a/definitions/kustomization.yaml b/config/kustomization.yaml similarity index 100% rename from definitions/kustomization.yaml rename to config/kustomization.yaml diff --git a/definitions/manifest/deployment.yaml b/config/manifest/deployment.yaml similarity index 100% rename from definitions/manifest/deployment.yaml rename to config/manifest/deployment.yaml diff --git a/definitions/manifest/kustomization.yaml b/config/manifest/kustomization.yaml similarity index 100% rename from definitions/manifest/kustomization.yaml rename to config/manifest/kustomization.yaml diff --git a/definitions/release/install.yaml b/config/release/install.yaml similarity index 100% rename from definitions/release/install.yaml rename to config/release/install.yaml diff --git a/definitions/release/kustomization.yaml b/config/release/kustomization.yaml similarity index 100% rename from definitions/release/kustomization.yaml rename to config/release/kustomization.yaml diff --git a/definitions/release/labels.yaml b/config/release/labels.yaml similarity index 100% rename from definitions/release/labels.yaml rename to config/release/labels.yaml diff --git a/api/apiResources.go b/data/apiResources.go similarity index 100% rename from api/apiResources.go rename to data/apiResources.go diff --git a/api/preferredResources.go b/data/preferredResources.go similarity index 100% rename from api/preferredResources.go rename to data/preferredResources.go diff --git a/api/swaggerDoc.go b/data/swaggerDoc.go similarity index 100% rename from api/swaggerDoc.go rename to data/swaggerDoc.go diff --git a/go.mod b/go.mod index e52b2d8839..7ed90b39de 100644 --- a/go.mod +++ b/go.mod @@ -37,6 +37,7 @@ require ( github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 github.com/xanzy/ssh-agent v0.3.0 // indirect + golang.org/x/tools v0.1.7 // indirect gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b gotest.tools v2.2.0+incompatible diff --git a/go.sum b/go.sum index d82b6e102d..4b63a491c8 100644 --- a/go.sum +++ b/go.sum @@ -1721,6 +1721,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= @@ -1990,6 +1991,7 @@ golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210505214959-0714010a04ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2156,6 +2158,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b h1:3Dq0eVHn0uaQJmPO+/aYPI/fRMqdrVDbu7MQcku54gg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2276,8 +2279,9 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index b377416ad8..75eeb29362 100755 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -19,9 +19,9 @@ limitations under the License. package fake import ( - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" + kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 920d66d19a..d9bcb74bea 100755 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -19,9 +19,9 @@ limitations under the License. package scheme import ( - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" + kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + wgpolicyk8sv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/clusterpolicy.go b/pkg/client/clientset/versioned/typed/kyverno/v1/clusterpolicy.go index 8415e67722..ca3a026922 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/clusterpolicy.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/clusterpolicy.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_clusterpolicy.go b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_clusterpolicy.go index 3da3f1588d..0750a0a6e3 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_clusterpolicy.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_clusterpolicy.go @@ -21,7 +21,7 @@ package fake import ( "context" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_generaterequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_generaterequest.go index 67790c6097..7c2c185a60 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_generaterequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_generaterequest.go @@ -21,7 +21,7 @@ package fake import ( "context" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_policy.go b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_policy.go index ee544b69d0..6844d4f44b 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_policy.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/fake/fake_policy.go @@ -21,7 +21,7 @@ package fake import ( "context" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/generaterequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1/generaterequest.go index 13913e8474..3cd614500b 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/generaterequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/generaterequest.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/kyverno_client.go b/pkg/client/clientset/versioned/typed/kyverno/v1/kyverno_client.go index e58f3cdd98..3d8cecb03f 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/kyverno_client.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/kyverno_client.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1/policy.go b/pkg/client/clientset/versioned/typed/kyverno/v1/policy.go index d00e1d9b93..81f2cc5245 100755 --- a/pkg/client/clientset/versioned/typed/kyverno/v1/policy.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1/policy.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/clusterreportchangerequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/clusterreportchangerequest.go index c895165392..bb1cfdabe4 100644 --- a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/clusterreportchangerequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/clusterreportchangerequest.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_clusterreportchangerequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_clusterreportchangerequest.go index 61a45a7bf7..a78819f1da 100644 --- a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_clusterreportchangerequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_clusterreportchangerequest.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_reportchangerequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_reportchangerequest.go index bab79f04b0..4d19a312e7 100644 --- a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_reportchangerequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/fake/fake_reportchangerequest.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/kyverno_client.go b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/kyverno_client.go index 5004feb988..3b062c0ae4 100644 --- a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/kyverno_client.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/kyverno_client.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/reportchangerequest.go b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/reportchangerequest.go index 03620ab149..97e490371e 100644 --- a/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/reportchangerequest.go +++ b/pkg/client/clientset/versioned/typed/kyverno/v1alpha2/reportchangerequest.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/clusterpolicyreport.go b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/clusterpolicyreport.go index 73d4bdc854..fc155dce16 100755 --- a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/clusterpolicyreport.go +++ b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/clusterpolicyreport.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_clusterpolicyreport.go b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_clusterpolicyreport.go index 40f960d563..8a0df28277 100755 --- a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_clusterpolicyreport.go +++ b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_clusterpolicyreport.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_policyreport.go b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_policyreport.go index c572a6c89f..a330ea0064 100755 --- a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_policyreport.go +++ b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/fake/fake_policyreport.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport.go b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport.go index 3eff375e85..0fee438004 100755 --- a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport.go +++ b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" scheme "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport_client.go b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport_client.go index 58e7b9b4f4..b7cf8af1ce 100755 --- a/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport_client.go +++ b/pkg/client/clientset/versioned/typed/policyreport/v1alpha2/policyreport_client.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 4193c9c5c0..f53eda674e 100755 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -21,9 +21,9 @@ package externalversions import ( "fmt" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - policyreportv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) diff --git a/pkg/client/informers/externalversions/kyverno/v1/clusterpolicy.go b/pkg/client/informers/externalversions/kyverno/v1/clusterpolicy.go index 4dec56ff88..7d348c2317 100755 --- a/pkg/client/informers/externalversions/kyverno/v1/clusterpolicy.go +++ b/pkg/client/informers/externalversions/kyverno/v1/clusterpolicy.go @@ -22,7 +22,7 @@ import ( "context" time "time" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/client/informers/externalversions/kyverno/v1/generaterequest.go b/pkg/client/informers/externalversions/kyverno/v1/generaterequest.go index 472e926641..333346529f 100755 --- a/pkg/client/informers/externalversions/kyverno/v1/generaterequest.go +++ b/pkg/client/informers/externalversions/kyverno/v1/generaterequest.go @@ -22,7 +22,7 @@ import ( "context" time "time" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/client/informers/externalversions/kyverno/v1/policy.go b/pkg/client/informers/externalversions/kyverno/v1/policy.go index d1a12464ef..94a053ae87 100755 --- a/pkg/client/informers/externalversions/kyverno/v1/policy.go +++ b/pkg/client/informers/externalversions/kyverno/v1/policy.go @@ -22,7 +22,7 @@ import ( "context" time "time" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/client/informers/externalversions/kyverno/v1alpha2/clusterreportchangerequest.go b/pkg/client/informers/externalversions/kyverno/v1alpha2/clusterreportchangerequest.go index ae3a15b516..68e527c8e7 100644 --- a/pkg/client/informers/externalversions/kyverno/v1alpha2/clusterreportchangerequest.go +++ b/pkg/client/informers/externalversions/kyverno/v1alpha2/clusterreportchangerequest.go @@ -22,7 +22,7 @@ import ( "context" time "time" - kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1alpha2 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha2" diff --git a/pkg/client/informers/externalversions/kyverno/v1alpha2/reportchangerequest.go b/pkg/client/informers/externalversions/kyverno/v1alpha2/reportchangerequest.go index fcc5475a7a..a6a7fe49e1 100644 --- a/pkg/client/informers/externalversions/kyverno/v1alpha2/reportchangerequest.go +++ b/pkg/client/informers/externalversions/kyverno/v1alpha2/reportchangerequest.go @@ -22,7 +22,7 @@ import ( "context" time "time" - kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1alpha2 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha2" diff --git a/pkg/client/informers/externalversions/policyreport/v1alpha2/clusterpolicyreport.go b/pkg/client/informers/externalversions/policyreport/v1alpha2/clusterpolicyreport.go index 2ade14a772..f4de6f3fc1 100755 --- a/pkg/client/informers/externalversions/policyreport/v1alpha2/clusterpolicyreport.go +++ b/pkg/client/informers/externalversions/policyreport/v1alpha2/clusterpolicyreport.go @@ -22,7 +22,7 @@ import ( "context" time "time" - policyreportv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1alpha2 "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha2" diff --git a/pkg/client/informers/externalversions/policyreport/v1alpha2/policyreport.go b/pkg/client/informers/externalversions/policyreport/v1alpha2/policyreport.go index 10d0075b29..49980ba283 100755 --- a/pkg/client/informers/externalversions/policyreport/v1alpha2/policyreport.go +++ b/pkg/client/informers/externalversions/policyreport/v1alpha2/policyreport.go @@ -22,7 +22,7 @@ import ( "context" time "time" - policyreportv1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" versioned "github.com/kyverno/kyverno/pkg/client/clientset/versioned" internalinterfaces "github.com/kyverno/kyverno/pkg/client/informers/externalversions/internalinterfaces" v1alpha2 "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha2" diff --git a/pkg/client/listers/kyverno/v1/clusterpolicy.go b/pkg/client/listers/kyverno/v1/clusterpolicy.go index 8ca4a20fb7..cfac5c1821 100755 --- a/pkg/client/listers/kyverno/v1/clusterpolicy.go +++ b/pkg/client/listers/kyverno/v1/clusterpolicy.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v12 "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,10 +30,10 @@ import ( type ClusterPolicyLister interface { // List lists all ClusterPolicies in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) + List(selector labels.Selector) (ret []*v12.ClusterPolicy, err error) // Get retrieves the ClusterPolicy from the index for a given name. // Objects returned here must be treated as read-only. - Get(name string) (*v1.ClusterPolicy, error) + Get(name string) (*v12.ClusterPolicy, error) ClusterPolicyListerExpansion } @@ -48,21 +48,21 @@ func NewClusterPolicyLister(indexer cache.Indexer) ClusterPolicyLister { } // List lists all ClusterPolicies in the indexer. -func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) { +func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*v12.ClusterPolicy, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ClusterPolicy)) + ret = append(ret, m.(*v12.ClusterPolicy)) }) return ret, err } // Get retrieves the ClusterPolicy from the index for a given name. -func (s *clusterPolicyLister) Get(name string) (*v1.ClusterPolicy, error) { +func (s *clusterPolicyLister) Get(name string) (*v12.ClusterPolicy, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1.Resource("clusterpolicy"), name) + return nil, errors.NewNotFound(v12.Resource("clusterpolicy"), name) } - return obj.(*v1.ClusterPolicy), nil + return obj.(*v12.ClusterPolicy), nil } diff --git a/pkg/client/listers/kyverno/v1/custom_expansion_generated.go b/pkg/client/listers/kyverno/v1/custom_expansion_generated.go index ff52b65f61..018b6cac13 100644 --- a/pkg/client/listers/kyverno/v1/custom_expansion_generated.go +++ b/pkg/client/listers/kyverno/v1/custom_expansion_generated.go @@ -19,22 +19,22 @@ limitations under the License. package v1 import ( - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/apimachinery/pkg/labels" ) //ListResources is a wrapper to List and adds the resource kind information // as the lister is specific to a gvk we can harcode the values here -func (pl *clusterPolicyLister) ListResources(selector labels.Selector) (ret []*kyvernov1.ClusterPolicy, err error) { +func (pl *clusterPolicyLister) ListResources(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) { policies, err := pl.List(selector) for index := range policies { - policies[index].SetGroupVersionKind(kyvernov1.SchemeGroupVersion.WithKind("ClusterPolicy")) + policies[index].SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("ClusterPolicy")) } return policies, err } -func (s generateRequestNamespaceLister) GetGenerateRequestsForResource(kind, namespace, name string) ([]*kyvernov1.GenerateRequest, error) { - var list []*kyvernov1.GenerateRequest +func (s generateRequestNamespaceLister) GetGenerateRequestsForResource(kind, namespace, name string) ([]*v1.GenerateRequest, error) { + var list []*v1.GenerateRequest grs, err := s.List(labels.NewSelector()) if err != nil { return nil, err @@ -50,8 +50,8 @@ func (s generateRequestNamespaceLister) GetGenerateRequestsForResource(kind, nam return list, err } -func (s generateRequestNamespaceLister) GetGenerateRequestsForClusterPolicy(policy string) ([]*kyvernov1.GenerateRequest, error) { - var list []*kyvernov1.GenerateRequest +func (s generateRequestNamespaceLister) GetGenerateRequestsForClusterPolicy(policy string) ([]*v1.GenerateRequest, error) { + var list []*v1.GenerateRequest grs, err := s.List(labels.NewSelector()) if err != nil { return nil, err diff --git a/pkg/client/listers/kyverno/v1/expansion_custom.go b/pkg/client/listers/kyverno/v1/expansion_custom.go index f70b521f27..98a2214d1d 100644 --- a/pkg/client/listers/kyverno/v1/expansion_custom.go +++ b/pkg/client/listers/kyverno/v1/expansion_custom.go @@ -1,6 +1,8 @@ package v1 -import kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" +import ( + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" +) type GenerateRequestNamespaceListerExpansion interface { GetGenerateRequestsForClusterPolicy(policy string) ([]*kyvernov1.GenerateRequest, error) diff --git a/pkg/client/listers/kyverno/v1/generaterequest.go b/pkg/client/listers/kyverno/v1/generaterequest.go index b45dc88dfc..6dce52928f 100755 --- a/pkg/client/listers/kyverno/v1/generaterequest.go +++ b/pkg/client/listers/kyverno/v1/generaterequest.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v12 "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type GenerateRequestLister interface { // List lists all GenerateRequests in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.GenerateRequest, err error) + List(selector labels.Selector) (ret []*v12.GenerateRequest, err error) // GenerateRequests returns an object that can list and get GenerateRequests. GenerateRequests(namespace string) GenerateRequestNamespaceLister GenerateRequestListerExpansion @@ -47,9 +47,9 @@ func NewGenerateRequestLister(indexer cache.Indexer) GenerateRequestLister { } // List lists all GenerateRequests in the indexer. -func (s *generateRequestLister) List(selector labels.Selector) (ret []*v1.GenerateRequest, err error) { +func (s *generateRequestLister) List(selector labels.Selector) (ret []*v12.GenerateRequest, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.GenerateRequest)) + ret = append(ret, m.(*v12.GenerateRequest)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *generateRequestLister) GenerateRequests(namespace string) GenerateReque type GenerateRequestNamespaceLister interface { // List lists all GenerateRequests in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.GenerateRequest, err error) + List(selector labels.Selector) (ret []*v12.GenerateRequest, err error) // Get retrieves the GenerateRequest from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1.GenerateRequest, error) + Get(name string) (*v12.GenerateRequest, error) GenerateRequestNamespaceListerExpansion } @@ -79,21 +79,21 @@ type generateRequestNamespaceLister struct { } // List lists all GenerateRequests in the indexer for a given namespace. -func (s generateRequestNamespaceLister) List(selector labels.Selector) (ret []*v1.GenerateRequest, err error) { +func (s generateRequestNamespaceLister) List(selector labels.Selector) (ret []*v12.GenerateRequest, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.GenerateRequest)) + ret = append(ret, m.(*v12.GenerateRequest)) }) return ret, err } // Get retrieves the GenerateRequest from the indexer for a given namespace and name. -func (s generateRequestNamespaceLister) Get(name string) (*v1.GenerateRequest, error) { +func (s generateRequestNamespaceLister) Get(name string) (*v12.GenerateRequest, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1.Resource("generaterequest"), name) + return nil, errors.NewNotFound(v12.Resource("generaterequest"), name) } - return obj.(*v1.GenerateRequest), nil + return obj.(*v12.GenerateRequest), nil } diff --git a/pkg/client/listers/kyverno/v1/policy.go b/pkg/client/listers/kyverno/v1/policy.go index 141a23650b..ceff9e4c40 100755 --- a/pkg/client/listers/kyverno/v1/policy.go +++ b/pkg/client/listers/kyverno/v1/policy.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v12 "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type PolicyLister interface { // List lists all Policies in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Policy, err error) + List(selector labels.Selector) (ret []*v12.Policy, err error) // Policies returns an object that can list and get Policies. Policies(namespace string) PolicyNamespaceLister PolicyListerExpansion @@ -47,9 +47,9 @@ func NewPolicyLister(indexer cache.Indexer) PolicyLister { } // List lists all Policies in the indexer. -func (s *policyLister) List(selector labels.Selector) (ret []*v1.Policy, err error) { +func (s *policyLister) List(selector labels.Selector) (ret []*v12.Policy, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Policy)) + ret = append(ret, m.(*v12.Policy)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *policyLister) Policies(namespace string) PolicyNamespaceLister { type PolicyNamespaceLister interface { // List lists all Policies in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.Policy, err error) + List(selector labels.Selector) (ret []*v12.Policy, err error) // Get retrieves the Policy from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1.Policy, error) + Get(name string) (*v12.Policy, error) PolicyNamespaceListerExpansion } @@ -79,21 +79,21 @@ type policyNamespaceLister struct { } // List lists all Policies in the indexer for a given namespace. -func (s policyNamespaceLister) List(selector labels.Selector) (ret []*v1.Policy, err error) { +func (s policyNamespaceLister) List(selector labels.Selector) (ret []*v12.Policy, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Policy)) + ret = append(ret, m.(*v12.Policy)) }) return ret, err } // Get retrieves the Policy from the indexer for a given namespace and name. -func (s policyNamespaceLister) Get(name string) (*v1.Policy, error) { +func (s policyNamespaceLister) Get(name string) (*v12.Policy, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1.Resource("policy"), name) + return nil, errors.NewNotFound(v12.Resource("policy"), name) } - return obj.(*v1.Policy), nil + return obj.(*v12.Policy), nil } diff --git a/pkg/client/listers/kyverno/v1alpha2/clusterreportchangerequest.go b/pkg/client/listers/kyverno/v1alpha2/clusterreportchangerequest.go index 44a7ae469c..3e9821b6a6 100644 --- a/pkg/client/listers/kyverno/v1alpha2/clusterreportchangerequest.go +++ b/pkg/client/listers/kyverno/v1alpha2/clusterreportchangerequest.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + v1alpha22 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,10 +30,10 @@ import ( type ClusterReportChangeRequestLister interface { // List lists all ClusterReportChangeRequests in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ClusterReportChangeRequest, err error) + List(selector labels.Selector) (ret []*v1alpha22.ClusterReportChangeRequest, err error) // Get retrieves the ClusterReportChangeRequest from the index for a given name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.ClusterReportChangeRequest, error) + Get(name string) (*v1alpha22.ClusterReportChangeRequest, error) ClusterReportChangeRequestListerExpansion } @@ -48,21 +48,21 @@ func NewClusterReportChangeRequestLister(indexer cache.Indexer) ClusterReportCha } // List lists all ClusterReportChangeRequests in the indexer. -func (s *clusterReportChangeRequestLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterReportChangeRequest, err error) { +func (s *clusterReportChangeRequestLister) List(selector labels.Selector) (ret []*v1alpha22.ClusterReportChangeRequest, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterReportChangeRequest)) + ret = append(ret, m.(*v1alpha22.ClusterReportChangeRequest)) }) return ret, err } // Get retrieves the ClusterReportChangeRequest from the index for a given name. -func (s *clusterReportChangeRequestLister) Get(name string) (*v1alpha2.ClusterReportChangeRequest, error) { +func (s *clusterReportChangeRequestLister) Get(name string) (*v1alpha22.ClusterReportChangeRequest, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clusterreportchangerequest"), name) + return nil, errors.NewNotFound(v1alpha22.Resource("clusterreportchangerequest"), name) } - return obj.(*v1alpha2.ClusterReportChangeRequest), nil + return obj.(*v1alpha22.ClusterReportChangeRequest), nil } diff --git a/pkg/client/listers/kyverno/v1alpha2/reportchangerequest.go b/pkg/client/listers/kyverno/v1alpha2/reportchangerequest.go index d43189694d..6c45fabed0 100644 --- a/pkg/client/listers/kyverno/v1alpha2/reportchangerequest.go +++ b/pkg/client/listers/kyverno/v1alpha2/reportchangerequest.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + v1alpha22 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type ReportChangeRequestLister interface { // List lists all ReportChangeRequests in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ReportChangeRequest, err error) + List(selector labels.Selector) (ret []*v1alpha22.ReportChangeRequest, err error) // ReportChangeRequests returns an object that can list and get ReportChangeRequests. ReportChangeRequests(namespace string) ReportChangeRequestNamespaceLister ReportChangeRequestListerExpansion @@ -47,9 +47,9 @@ func NewReportChangeRequestLister(indexer cache.Indexer) ReportChangeRequestList } // List lists all ReportChangeRequests in the indexer. -func (s *reportChangeRequestLister) List(selector labels.Selector) (ret []*v1alpha2.ReportChangeRequest, err error) { +func (s *reportChangeRequestLister) List(selector labels.Selector) (ret []*v1alpha22.ReportChangeRequest, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReportChangeRequest)) + ret = append(ret, m.(*v1alpha22.ReportChangeRequest)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *reportChangeRequestLister) ReportChangeRequests(namespace string) Repor type ReportChangeRequestNamespaceLister interface { // List lists all ReportChangeRequests in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ReportChangeRequest, err error) + List(selector labels.Selector) (ret []*v1alpha22.ReportChangeRequest, err error) // Get retrieves the ReportChangeRequest from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.ReportChangeRequest, error) + Get(name string) (*v1alpha22.ReportChangeRequest, error) ReportChangeRequestNamespaceListerExpansion } @@ -79,21 +79,21 @@ type reportChangeRequestNamespaceLister struct { } // List lists all ReportChangeRequests in the indexer for a given namespace. -func (s reportChangeRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ReportChangeRequest, err error) { +func (s reportChangeRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha22.ReportChangeRequest, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReportChangeRequest)) + ret = append(ret, m.(*v1alpha22.ReportChangeRequest)) }) return ret, err } // Get retrieves the ReportChangeRequest from the indexer for a given namespace and name. -func (s reportChangeRequestNamespaceLister) Get(name string) (*v1alpha2.ReportChangeRequest, error) { +func (s reportChangeRequestNamespaceLister) Get(name string) (*v1alpha22.ReportChangeRequest, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("reportchangerequest"), name) + return nil, errors.NewNotFound(v1alpha22.Resource("reportchangerequest"), name) } - return obj.(*v1alpha2.ReportChangeRequest), nil + return obj.(*v1alpha22.ReportChangeRequest), nil } diff --git a/pkg/client/listers/policyreport/v1alpha2/clusterpolicyreport.go b/pkg/client/listers/policyreport/v1alpha2/clusterpolicyreport.go index 6e97f7db72..10cbfea7e8 100755 --- a/pkg/client/listers/policyreport/v1alpha2/clusterpolicyreport.go +++ b/pkg/client/listers/policyreport/v1alpha2/clusterpolicyreport.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + v1alpha22 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,10 +30,10 @@ import ( type ClusterPolicyReportLister interface { // List lists all ClusterPolicyReports in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ClusterPolicyReport, err error) + List(selector labels.Selector) (ret []*v1alpha22.ClusterPolicyReport, err error) // Get retrieves the ClusterPolicyReport from the index for a given name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.ClusterPolicyReport, error) + Get(name string) (*v1alpha22.ClusterPolicyReport, error) ClusterPolicyReportListerExpansion } @@ -48,21 +48,21 @@ func NewClusterPolicyReportLister(indexer cache.Indexer) ClusterPolicyReportList } // List lists all ClusterPolicyReports in the indexer. -func (s *clusterPolicyReportLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterPolicyReport, err error) { +func (s *clusterPolicyReportLister) List(selector labels.Selector) (ret []*v1alpha22.ClusterPolicyReport, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterPolicyReport)) + ret = append(ret, m.(*v1alpha22.ClusterPolicyReport)) }) return ret, err } // Get retrieves the ClusterPolicyReport from the index for a given name. -func (s *clusterPolicyReportLister) Get(name string) (*v1alpha2.ClusterPolicyReport, error) { +func (s *clusterPolicyReportLister) Get(name string) (*v1alpha22.ClusterPolicyReport, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clusterpolicyreport"), name) + return nil, errors.NewNotFound(v1alpha22.Resource("clusterpolicyreport"), name) } - return obj.(*v1alpha2.ClusterPolicyReport), nil + return obj.(*v1alpha22.ClusterPolicyReport), nil } diff --git a/pkg/client/listers/policyreport/v1alpha2/policyreport.go b/pkg/client/listers/policyreport/v1alpha2/policyreport.go index 9f6a386e73..d80b020878 100755 --- a/pkg/client/listers/policyreport/v1alpha2/policyreport.go +++ b/pkg/client/listers/policyreport/v1alpha2/policyreport.go @@ -19,7 +19,7 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + v1alpha22 "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type PolicyReportLister interface { // List lists all PolicyReports in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.PolicyReport, err error) + List(selector labels.Selector) (ret []*v1alpha22.PolicyReport, err error) // PolicyReports returns an object that can list and get PolicyReports. PolicyReports(namespace string) PolicyReportNamespaceLister PolicyReportListerExpansion @@ -47,9 +47,9 @@ func NewPolicyReportLister(indexer cache.Indexer) PolicyReportLister { } // List lists all PolicyReports in the indexer. -func (s *policyReportLister) List(selector labels.Selector) (ret []*v1alpha2.PolicyReport, err error) { +func (s *policyReportLister) List(selector labels.Selector) (ret []*v1alpha22.PolicyReport, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PolicyReport)) + ret = append(ret, m.(*v1alpha22.PolicyReport)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *policyReportLister) PolicyReports(namespace string) PolicyReportNamespa type PolicyReportNamespaceLister interface { // List lists all PolicyReports in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.PolicyReport, err error) + List(selector labels.Selector) (ret []*v1alpha22.PolicyReport, err error) // Get retrieves the PolicyReport from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.PolicyReport, error) + Get(name string) (*v1alpha22.PolicyReport, error) PolicyReportNamespaceListerExpansion } @@ -79,21 +79,21 @@ type policyReportNamespaceLister struct { } // List lists all PolicyReports in the indexer for a given namespace. -func (s policyReportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.PolicyReport, err error) { +func (s policyReportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha22.PolicyReport, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PolicyReport)) + ret = append(ret, m.(*v1alpha22.PolicyReport)) }) return ret, err } // Get retrieves the PolicyReport from the indexer for a given namespace and name. -func (s policyReportNamespaceLister) Get(name string) (*v1alpha2.PolicyReport, error) { +func (s policyReportNamespaceLister) Get(name string) (*v1alpha22.PolicyReport, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("policyreport"), name) + return nil, errors.NewNotFound(v1alpha22.Resource("policyreport"), name) } - return obj.(*v1alpha2.PolicyReport), nil + return obj.(*v1alpha22.PolicyReport), nil } diff --git a/pkg/common/common.go b/pkg/common/common.go index f7356bdec8..18c0802954 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -6,10 +6,10 @@ import ( "strings" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" dclient "github.com/kyverno/kyverno/pkg/dclient" enginutils "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/pkg/errors" diff --git a/pkg/engine/context/context.go b/pkg/engine/context/context.go index bf046199da..eac250cb46 100644 --- a/pkg/engine/context/context.go +++ b/pkg/engine/context/context.go @@ -8,7 +8,7 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/engine/context/context_test.go b/pkg/engine/context/context_test.go index 10ffb8a13c..10f172824f 100644 --- a/pkg/engine/context/context_test.go +++ b/pkg/engine/context/context_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" authenticationv1 "k8s.io/api/authentication/v1" ) diff --git a/pkg/engine/forceMutate.go b/pkg/engine/forceMutate.go index 8a212bead4..9464e06123 100644 --- a/pkg/engine/forceMutate.go +++ b/pkg/engine/forceMutate.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/ghodss/yaml" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/mutate" "github.com/kyverno/kyverno/pkg/engine/response" diff --git a/pkg/engine/forceMutate_test.go b/pkg/engine/forceMutate_test.go index d19c1f30ef..6dbb505205 100644 --- a/pkg/engine/forceMutate_test.go +++ b/pkg/engine/forceMutate_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/utils" "gotest.tools/assert" diff --git a/pkg/engine/generation.go b/pkg/engine/generation.go index 6d4f6cc61d..0eae0db6c2 100644 --- a/pkg/engine/generation.go +++ b/pkg/engine/generation.go @@ -3,7 +3,7 @@ package engine import ( "time" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/variables" "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/engine/imageVerify.go b/pkg/engine/imageVerify.go index fa563777b9..05dad92f91 100644 --- a/pkg/engine/imageVerify.go +++ b/pkg/engine/imageVerify.go @@ -5,11 +5,11 @@ import ( "fmt" "time" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/variables" "github.com/pkg/errors" "github.com/go-logr/logr" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/cosign" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" diff --git a/pkg/engine/imageVerify_test.go b/pkg/engine/imageVerify_test.go index 6d1988724a..5506fc3726 100644 --- a/pkg/engine/imageVerify_test.go +++ b/pkg/engine/imageVerify_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/cosign" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" diff --git a/pkg/engine/jsonContext.go b/pkg/engine/jsonContext.go index d45b89cf75..dc2b4818bb 100644 --- a/pkg/engine/jsonContext.go +++ b/pkg/engine/jsonContext.go @@ -4,11 +4,10 @@ import ( "encoding/json" "errors" "fmt" - "strings" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" pkgcommon "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/engine/context" jmespath "github.com/kyverno/kyverno/pkg/engine/jmespath" diff --git a/pkg/engine/mutate/mutation.go b/pkg/engine/mutate/mutation.go index 2dd321f728..ce3ba81518 100644 --- a/pkg/engine/mutate/mutation.go +++ b/pkg/engine/mutate/mutation.go @@ -2,7 +2,7 @@ package mutate import ( "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/pkg/engine/mutate/patches.go b/pkg/engine/mutate/patches.go index f6c362e441..ec8ad3229f 100644 --- a/pkg/engine/mutate/patches.go +++ b/pkg/engine/mutate/patches.go @@ -7,7 +7,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/utils" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/engine/mutate/patches_test.go b/pkg/engine/mutate/patches_test.go index 0ccd584900..e22c9177c9 100644 --- a/pkg/engine/mutate/patches_test.go +++ b/pkg/engine/mutate/patches_test.go @@ -3,13 +3,13 @@ package mutate import ( "testing" + types "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "gotest.tools/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/controller-runtime/pkg/log" - types "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/utils" ) diff --git a/pkg/engine/mutate/strategicMergePatch_test.go b/pkg/engine/mutate/strategicMergePatch_test.go index a473ffb1a0..a6a802388e 100644 --- a/pkg/engine/mutate/strategicMergePatch_test.go +++ b/pkg/engine/mutate/strategicMergePatch_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyvernov1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1" assertnew "github.com/stretchr/testify/assert" "gotest.tools/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/engine/mutation.go b/pkg/engine/mutation.go index 5351b0dcf6..de094ee5ac 100644 --- a/pkg/engine/mutation.go +++ b/pkg/engine/mutation.go @@ -4,12 +4,12 @@ import ( "fmt" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/pkg/errors" "github.com/go-logr/logr" gojmespath "github.com/jmespath/go-jmespath" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/mutate" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/pkg/engine/mutation_test.go b/pkg/engine/mutation_test.go index 2faa6c1e4d..f01dc67487 100644 --- a/pkg/engine/mutation_test.go +++ b/pkg/engine/mutation_test.go @@ -5,9 +5,9 @@ import ( "reflect" "testing" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/kyverno/store" diff --git a/pkg/engine/policyContext.go b/pkg/engine/policyContext.go index 1d1c97f4b2..e980f6451e 100644 --- a/pkg/engine/policyContext.go +++ b/pkg/engine/policyContext.go @@ -1,7 +1,7 @@ package engine import ( - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/resourcecache" diff --git a/pkg/engine/utils.go b/pkg/engine/utils.go index b4517f16f7..ff743b75a4 100644 --- a/pkg/engine/utils.go +++ b/pkg/engine/utils.go @@ -7,13 +7,13 @@ import ( "time" "github.com/go-logr/logr" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" engineUtils "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/engine/variables" "github.com/pkg/errors" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/wildcards" "github.com/kyverno/kyverno/pkg/utils" "github.com/minio/pkg/wildcard" diff --git a/pkg/engine/utils_test.go b/pkg/engine/utils_test.go index 8de2ef5662..ba888668f9 100644 --- a/pkg/engine/utils_test.go +++ b/pkg/engine/utils_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/utils" "gotest.tools/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -13,14 +13,14 @@ import ( func TestMatchesResourceDescription(t *testing.T) { tcs := []struct { Description string - AdmissionInfo kyverno.RequestInfo + AdmissionInfo v1.RequestInfo Resource []byte Policy []byte areErrorsExpected bool }{ { Description: "Match Any matches the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -105,7 +105,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Match Any does not match the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -190,7 +190,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Match All matches the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -275,7 +275,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Match All does not match the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -360,7 +360,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Exclude Any excludes the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -460,7 +460,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Exclude Any does not exclude the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -560,7 +560,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Exclude All excludes the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -660,7 +660,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Exclude All does not exclude the Pod", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ @@ -760,7 +760,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should match pod and not exclude it", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"hello-world","labels":{"name":"hello-world"}},"spec":{"containers":[{"name":"hello-world","image":"hello-world","ports":[{"containerPort":81}],"resources":{"limits":{"memory":"30Mi","cpu":"0.2"},"requests":{"memory":"20Mi","cpu":"0.1"}}}]}}`), @@ -769,7 +769,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should exclude resource since it matches the exclude block", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"system:node"}, }, Resource: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"hello-world","labels":{"name":"hello-world"}},"spec":{"containers":[{"name":"hello-world","image":"hello-world","ports":[{"containerPort":81}],"resources":{"limits":{"memory":"30Mi","cpu":"0.2"},"requests":{"memory":"20Mi","cpu":"0.1"}}}]}}`), @@ -808,7 +808,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should fail since resource does not match policy", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{"apiVersion":"v1","kind":"Service","metadata":{"name":"hello-world","labels":{"name":"hello-world"}},"spec":{"containers":[{"name":"hello-world","image":"hello-world","ports":[{"containerPort":81}],"resources":{"limits":{"memory":"30Mi","cpu":"0.2"},"requests":{"memory":"20Mi","cpu":"0.1"}}}]}}`), @@ -817,7 +817,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should not fail since resource does not match exclude block", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"system:node"}, }, Resource: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"hello-world2","labels":{"name":"hello-world"}},"spec":{"containers":[{"name":"hello-world","image":"hello-world","ports":[{"containerPort":81}],"resources":{"limits":{"memory":"30Mi","cpu":"0.2"},"requests":{"memory":"20Mi","cpu":"0.1"}}}]}}`), @@ -826,7 +826,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should pass since group, version, kind match", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "name": "qos-demo", "labels": { "test": "qos" } }, "spec": { "replicas": 1, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "labels": { "app": "nginx" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx:latest", "resources": { "limits": { "cpu": "50m" } } } ]}}}}`), @@ -835,7 +835,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should pass since version and kind match", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "apiVersion": "v1", "kind": "Pod", "metadata": { "name": "myapp-pod2", "labels": { "app": "myapp2" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx" } ] } }`), @@ -844,7 +844,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should fail since resource does not match ", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{"apiVersion":"v1","kind":"Service","metadata":{"name":"hello-world","labels":{"name":"hello-world"}},"spec":{"containers":[{"name":"hello-world","image":"hello-world","ports":[{"containerPort":81}],"resources":{"limits":{"memory":"30Mi","cpu":"0.2"},"requests":{"memory":"20Mi","cpu":"0.1"}}}]}}`), @@ -853,7 +853,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should fail since version not match", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "apiVersion": "apps/v1beta1", "kind": "Deployment", "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "name": "qos-demo", "labels": { "test": "qos" } }, "spec": { "replicas": 1, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "labels": { "app": "nginx" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx:latest", "resources": { "limits": { "cpu": "50m" } } } ]}}}}`), @@ -862,7 +862,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Should fail since cluster role version not match", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "kind": "ClusterRole", "apiVersion": "rbac.authorization.k8s.io/v1", "metadata": { "name": "secret-reader-demo", "namespace": "default" }, "rules": [ { "apiGroups": [ "" ], "resources": [ "secrets" ], "verbs": [ "get", "watch", "list" ] } ] }`), @@ -871,7 +871,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Test for GVK case sensitive", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "apiVersion": "v1", "kind": "Pod", "metadata": { "name": "myapp-pod2", "labels": { "app": "myapp2" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx" } ] } }`), @@ -880,7 +880,7 @@ func TestMatchesResourceDescription(t *testing.T) { }, { Description: "Test should pass for GVK case sensitive", - AdmissionInfo: kyverno.RequestInfo{ + AdmissionInfo: v1.RequestInfo{ ClusterRoles: []string{"admin"}, }, Resource: []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "name": "qos-demo", "labels": { "test": "qos" } }, "spec": { "replicas": 1, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "creationTimestamp": "2020-09-21T12:56:35Z", "labels": { "app": "nginx" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx:latest", "resources": { "limits": { "cpu": "50m" } } } ]}}}}`), @@ -890,7 +890,7 @@ func TestMatchesResourceDescription(t *testing.T) { } for i, tc := range tcs { - var policy kyverno.Policy + var policy v1.Policy err := json.Unmarshal(tc.Policy, &policy) if err != nil { t.Errorf("Testcase %d invalid policy raw", i+1) @@ -957,16 +957,16 @@ func TestResourceDescriptionMatch_MultipleKind(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment", "Pods"}, Selector: &metav1.LabelSelector{ MatchLabels: nil, MatchExpressions: nil, }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err != nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err != nil { t.Errorf("Testcase has failed due to the following:%v", err) } @@ -1017,7 +1017,7 @@ func TestResourceDescriptionMatch_Name(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment"}, Name: "nginx-deployment", Selector: &metav1.LabelSelector{ @@ -1025,9 +1025,9 @@ func TestResourceDescriptionMatch_Name(t *testing.T) { MatchExpressions: nil, }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err != nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err != nil { t.Errorf("Testcase has failed due to the following:%v", err) } } @@ -1077,7 +1077,7 @@ func TestResourceDescriptionMatch_Name_Regex(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment"}, Name: "nginx-*", Selector: &metav1.LabelSelector{ @@ -1085,9 +1085,9 @@ func TestResourceDescriptionMatch_Name_Regex(t *testing.T) { MatchExpressions: nil, }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err != nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err != nil { t.Errorf("Testcase has failed due to the following:%v", err) } } @@ -1137,7 +1137,7 @@ func TestResourceDescriptionMatch_Label_Expression_NotMatch(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment"}, Name: "nginx-*", Selector: &metav1.LabelSelector{ @@ -1153,9 +1153,9 @@ func TestResourceDescriptionMatch_Label_Expression_NotMatch(t *testing.T) { }, }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err != nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err != nil { t.Errorf("Testcase has failed due to the following:%v", err) } } @@ -1205,7 +1205,7 @@ func TestResourceDescriptionMatch_Label_Expression_Match(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment"}, Name: "nginx-*", Selector: &metav1.LabelSelector{ @@ -1222,9 +1222,9 @@ func TestResourceDescriptionMatch_Label_Expression_Match(t *testing.T) { }, }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err != nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err != nil { t.Errorf("Testcase has failed due to the following:%v", err) } } @@ -1275,7 +1275,7 @@ func TestResourceDescriptionExclude_Label_Expression_Match(t *testing.T) { t.Errorf("unable to convert raw resource to unstructured: %v", err) } - resourceDescription := kyverno.ResourceDescription{ + resourceDescription := v1.ResourceDescription{ Kinds: []string{"Deployment"}, Name: "nginx-*", Selector: &metav1.LabelSelector{ @@ -1293,7 +1293,7 @@ func TestResourceDescriptionExclude_Label_Expression_Match(t *testing.T) { }, } - resourceDescriptionExclude := kyverno.ResourceDescription{ + resourceDescriptionExclude := v1.ResourceDescription{ Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "block": "true", @@ -1301,10 +1301,10 @@ func TestResourceDescriptionExclude_Label_Expression_Match(t *testing.T) { }, } - rule := kyverno.Rule{MatchResources: kyverno.MatchResources{ResourceDescription: resourceDescription}, - ExcludeResources: kyverno.ExcludeResources{ResourceDescription: resourceDescriptionExclude}} + rule := v1.Rule{MatchResources: v1.MatchResources{ResourceDescription: resourceDescription}, + ExcludeResources: v1.ExcludeResources{ResourceDescription: resourceDescriptionExclude}} - if err := MatchesResourceDescription(*resource, rule, kyverno.RequestInfo{}, []string{}, nil, ""); err == nil { + if err := MatchesResourceDescription(*resource, rule, v1.RequestInfo{}, []string{}, nil, ""); err == nil { t.Errorf("Testcase has failed due to the following:\n Function has returned no error, even though it was supposed to fail") } } @@ -1439,7 +1439,7 @@ func TestManagedPodResource(t *testing.T) { } for i, tc := range testCases { - var policy kyverno.ClusterPolicy + var policy v1.ClusterPolicy err := json.Unmarshal(tc.policy, &policy) assert.Assert(t, err == nil, "Test %d/%s invalid policy raw: %v", i+1, tc.name, err) diff --git a/pkg/engine/validation.go b/pkg/engine/validation.go index c6d927b002..10c49fdcea 100644 --- a/pkg/engine/validation.go +++ b/pkg/engine/validation.go @@ -7,13 +7,13 @@ import ( "strings" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/common" "github.com/pkg/errors" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "github.com/go-logr/logr" gojmespath "github.com/jmespath/go-jmespath" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/engine/validate" diff --git a/pkg/engine/validation_test.go b/pkg/engine/validation_test.go index c260a55133..44b7d3baf0 100644 --- a/pkg/engine/validation_test.go +++ b/pkg/engine/validation_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/kyverno/store" diff --git a/pkg/engine/variables/evaluate.go b/pkg/engine/variables/evaluate.go index ec41499690..2dd143c6ea 100644 --- a/pkg/engine/variables/evaluate.go +++ b/pkg/engine/variables/evaluate.go @@ -2,7 +2,7 @@ package variables import ( "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/variables/operator" ) diff --git a/pkg/engine/variables/evaluate_test.go b/pkg/engine/variables/evaluate_test.go index 074b977989..dc24414397 100644 --- a/pkg/engine/variables/evaluate_test.go +++ b/pkg/engine/variables/evaluate_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/stretchr/testify/assert" "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/engine/variables/operator/duration.go b/pkg/engine/variables/operator/duration.go index c788b2ba06..bec587e36d 100644 --- a/pkg/engine/variables/operator/duration.go +++ b/pkg/engine/variables/operator/duration.go @@ -5,7 +5,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" ) diff --git a/pkg/engine/variables/operator/numeric.go b/pkg/engine/variables/operator/numeric.go index 3e98c8eb23..36e16fc996 100644 --- a/pkg/engine/variables/operator/numeric.go +++ b/pkg/engine/variables/operator/numeric.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "k8s.io/apimachinery/pkg/api/resource" ) diff --git a/pkg/engine/variables/operator/operator.go b/pkg/engine/variables/operator/operator.go index 8145778984..4ab9d5cc88 100644 --- a/pkg/engine/variables/operator/operator.go +++ b/pkg/engine/variables/operator/operator.go @@ -6,7 +6,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" ) diff --git a/pkg/engine/variables/variables_test.go b/pkg/engine/variables/variables_test.go index 73771bd653..a9e55b667d 100644 --- a/pkg/engine/variables/variables_test.go +++ b/pkg/engine/variables/variables_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" authenticationv1 "k8s.io/api/authentication/v1" "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/engine/variables/vars.go b/pkg/engine/variables/vars.go index 6f7361fc1d..e87dcadbc0 100644 --- a/pkg/engine/variables/vars.go +++ b/pkg/engine/variables/vars.go @@ -10,7 +10,7 @@ import ( "github.com/go-logr/logr" gojmespath "github.com/jmespath/go-jmespath" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/anchor/common" "github.com/kyverno/kyverno/pkg/engine/context" jsonUtils "github.com/kyverno/kyverno/pkg/engine/jsonutils" diff --git a/pkg/engine/variables/vars_test.go b/pkg/engine/variables/vars_test.go index da0e5433a4..ed79c6cceb 100644 --- a/pkg/engine/variables/vars_test.go +++ b/pkg/engine/variables/vars_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" ju "github.com/kyverno/kyverno/pkg/engine/jsonutils" "gotest.tools/assert" diff --git a/pkg/generate/cleanup/cleanup.go b/pkg/generate/cleanup/cleanup.go index f655aa57da..e1f910b092 100644 --- a/pkg/generate/cleanup/cleanup.go +++ b/pkg/generate/cleanup/cleanup.go @@ -4,7 +4,7 @@ import ( "strconv" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" dclient "github.com/kyverno/kyverno/pkg/dclient" apierrors "k8s.io/apimachinery/pkg/api/errors" ) diff --git a/pkg/generate/cleanup/controller.go b/pkg/generate/cleanup/controller.go index 673712a9ed..742ca36bbc 100644 --- a/pkg/generate/cleanup/controller.go +++ b/pkg/generate/cleanup/controller.go @@ -3,10 +3,10 @@ package cleanup import ( "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/client-go/kubernetes" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/generate/generate.go b/pkg/generate/generate.go index 011dfa1490..0d293f1db9 100644 --- a/pkg/generate/generate.go +++ b/pkg/generate/generate.go @@ -10,10 +10,10 @@ import ( "strings" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" pkgcommon "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/config" dclient "github.com/kyverno/kyverno/pkg/dclient" diff --git a/pkg/generate/generate_controller.go b/pkg/generate/generate_controller.go index 0a6f30de62..f3c4809fec 100644 --- a/pkg/generate/generate_controller.go +++ b/pkg/generate/generate_controller.go @@ -4,11 +4,11 @@ import ( "reflect" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/api/admission/v1beta1" "k8s.io/client-go/kubernetes" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/generate/report.go b/pkg/generate/report.go index a536f4e503..d4ba801531 100644 --- a/pkg/generate/report.go +++ b/pkg/generate/report.go @@ -3,7 +3,7 @@ package generate import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/event" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) diff --git a/pkg/generate/resource.go b/pkg/generate/resource.go index 748370d40e..c33db182ff 100644 --- a/pkg/generate/resource.go +++ b/pkg/generate/resource.go @@ -4,7 +4,7 @@ import ( "time" logr "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" dclient "github.com/kyverno/kyverno/pkg/dclient" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/generate/status.go b/pkg/generate/status.go index cdc5bdad1d..36c7bd5fd0 100644 --- a/pkg/generate/status.go +++ b/pkg/generate/status.go @@ -3,7 +3,7 @@ package generate import ( "context" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" "github.com/kyverno/kyverno/pkg/config" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/kyverno/apply/apply_command_test.go b/pkg/kyverno/apply/apply_command_test.go index 19b1676c56..a2bcf4c0c0 100644 --- a/pkg/kyverno/apply/apply_command_test.go +++ b/pkg/kyverno/apply/apply_command_test.go @@ -3,7 +3,7 @@ package apply import ( "testing" - preport "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + preport "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "gotest.tools/assert" ) diff --git a/pkg/kyverno/apply/generate.go b/pkg/kyverno/apply/generate.go index 3769f9bd8b..fa365612a7 100644 --- a/pkg/kyverno/apply/generate.go +++ b/pkg/kyverno/apply/generate.go @@ -3,7 +3,7 @@ package apply import ( "reflect" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" client "github.com/kyverno/kyverno/pkg/dclient" sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/kyverno/apply/generate_test.go b/pkg/kyverno/apply/generate_test.go index 56c2b9ad7a..64188f19b5 100644 --- a/pkg/kyverno/apply/generate_test.go +++ b/pkg/kyverno/apply/generate_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "gotest.tools/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) diff --git a/pkg/kyverno/apply/report.go b/pkg/kyverno/apply/report.go index 1dd976f9f3..1b0320ad69 100644 --- a/pkg/kyverno/apply/report.go +++ b/pkg/kyverno/apply/report.go @@ -6,7 +6,7 @@ import ( "strings" "time" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "github.com/kyverno/kyverno/pkg/engine/utils" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/policyreport" diff --git a/pkg/kyverno/apply/report_test.go b/pkg/kyverno/apply/report_test.go index ee02d75f8e..eea778c518 100644 --- a/pkg/kyverno/apply/report_test.go +++ b/pkg/kyverno/apply/report_test.go @@ -4,9 +4,8 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - preport "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" + preport "github.com/kyverno/kyverno/api/policyreport/v1alpha2" "github.com/kyverno/kyverno/pkg/engine/response" kyvCommon "github.com/kyverno/kyverno/pkg/kyverno/common" "github.com/kyverno/kyverno/pkg/policyreport" @@ -143,29 +142,29 @@ func Test_buildPolicyResults(t *testing.T) { for _, r := range result { switch r.Rule { case "pods-require-limits": - assert.Assert(t, r.Result == report.PolicyResult(preport.StatusPass)) + assert.Assert(t, r.Result == preport.StatusPass) case "pods-require-account": - assert.Assert(t, r.Result == report.PolicyResult(preport.StatusFail)) + assert.Assert(t, r.Result == preport.StatusFail) } } } } func Test_calculateSummary(t *testing.T) { - results := []*report.PolicyReportResult{ + results := []*preport.PolicyReportResult{ { Resources: make([]*v1.ObjectReference, 5), - Result: report.PolicyResult(preport.StatusPass), + Result: preport.PolicyResult(preport.StatusPass), }, - {Result: report.PolicyResult(preport.StatusFail)}, - {Result: report.PolicyResult(preport.StatusFail)}, - {Result: report.PolicyResult(preport.StatusFail)}, + {Result: preport.PolicyResult(preport.StatusFail)}, + {Result: preport.PolicyResult(preport.StatusFail)}, + {Result: preport.PolicyResult(preport.StatusFail)}, { Resources: make([]*v1.ObjectReference, 1), - Result: report.PolicyResult(preport.StatusPass)}, + Result: preport.PolicyResult(preport.StatusPass)}, { Resources: make([]*v1.ObjectReference, 4), - Result: report.PolicyResult(preport.StatusPass), + Result: preport.PolicyResult(preport.StatusPass), }, } diff --git a/pkg/kyverno/common/common.go b/pkg/kyverno/common/common.go index 6bed706ebd..fdd975d2e8 100644 --- a/pkg/kyverno/common/common.go +++ b/pkg/kyverno/common/common.go @@ -16,8 +16,8 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/go-git/go-billy/v5" "github.com/go-logr/logr" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" pkgcommon "github.com/kyverno/kyverno/pkg/common" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" @@ -34,7 +34,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/yaml" "sigs.k8s.io/controller-runtime/pkg/log" - yaml_v2 "sigs.k8s.io/yaml" + k8syaml "sigs.k8s.io/yaml" ) type ResultCounts struct { @@ -371,7 +371,7 @@ func GetCRD(path string) (unstructuredCrds []*unstructured.Unstructured, err err os.Exit(2) } var u unstructured.Unstructured - err = yaml_v2.Unmarshal(b, &u) + err = k8syaml.Unmarshal(b, &u) if err != nil { return nil, err } diff --git a/pkg/kyverno/common/fetch.go b/pkg/kyverno/common/fetch.go index 327eff22c8..bf12325f02 100644 --- a/pkg/kyverno/common/fetch.go +++ b/pkg/kyverno/common/fetch.go @@ -9,14 +9,14 @@ import ( "strings" "github.com/go-git/go-billy/v5" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" client "github.com/kyverno/kyverno/pkg/dclient" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/utils" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes/scheme" - log "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/yaml" ) diff --git a/pkg/kyverno/test/test_command.go b/pkg/kyverno/test/test_command.go index b72d8ad5db..12e93c90c5 100644 --- a/pkg/kyverno/test/test_command.go +++ b/pkg/kyverno/test/test_command.go @@ -17,7 +17,7 @@ import ( "github.com/go-git/go-billy/v5/memfs" "github.com/go-logr/logr" "github.com/kataras/tablewriter" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/pkg/kyverno/validate/command.go b/pkg/kyverno/validate/command.go index 2736e8e4e2..9c07bd62f8 100644 --- a/pkg/kyverno/validate/command.go +++ b/pkg/kyverno/validate/command.go @@ -7,7 +7,7 @@ import ( "fmt" "os" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/kyverno/common" "github.com/kyverno/kyverno/pkg/kyverno/crds" sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" diff --git a/pkg/kyverno/validate/commmand_test.go b/pkg/kyverno/validate/commmand_test.go index c7bdf12472..5510de3393 100644 --- a/pkg/kyverno/validate/commmand_test.go +++ b/pkg/kyverno/validate/commmand_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/metrics/parsers.go b/pkg/metrics/parsers.go index bfcc36eadc..ed4dc904b5 100644 --- a/pkg/metrics/parsers.go +++ b/pkg/metrics/parsers.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" ) func ParsePolicyValidationMode(validationFailureAction string) (PolicyValidationMode, error) { diff --git a/pkg/metrics/policychanges/policyChanges.go b/pkg/metrics/policychanges/policyChanges.go index 11ff978dee..1a7a13ca6d 100644 --- a/pkg/metrics/policychanges/policyChanges.go +++ b/pkg/metrics/policychanges/policyChanges.go @@ -3,7 +3,7 @@ package policychanges import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/metrics" prom "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/metrics/policyexecutionduration/policyExecutionDuration.go b/pkg/metrics/policyexecutionduration/policyExecutionDuration.go index fed8507617..0bc6aa1d6f 100644 --- a/pkg/metrics/policyexecutionduration/policyExecutionDuration.go +++ b/pkg/metrics/policyexecutionduration/policyExecutionDuration.go @@ -3,7 +3,7 @@ package policyexecutionduration import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/metrics" prom "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/metrics/policyresults/policyResults.go b/pkg/metrics/policyresults/policyResults.go index d8dab4bc69..63bd9a4177 100644 --- a/pkg/metrics/policyresults/policyResults.go +++ b/pkg/metrics/policyresults/policyResults.go @@ -3,7 +3,7 @@ package policyresults import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/metrics" prom "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/metrics/policyruleinfo/policyRuleInfo.go b/pkg/metrics/policyruleinfo/policyRuleInfo.go index a72346d5b5..8716eb51cd 100644 --- a/pkg/metrics/policyruleinfo/policyRuleInfo.go +++ b/pkg/metrics/policyruleinfo/policyRuleInfo.go @@ -3,7 +3,7 @@ package policyruleinfo import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/metrics" prom "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/openapi/validation.go b/pkg/openapi/validation.go index 837cb4739c..dfc5221bc8 100644 --- a/pkg/openapi/validation.go +++ b/pkg/openapi/validation.go @@ -10,8 +10,8 @@ import ( "github.com/googleapis/gnostic/compiler" openapiv2 "github.com/googleapis/gnostic/openapiv2" - data "github.com/kyverno/kyverno/api" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/data" "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/utils" @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/kube-openapi/pkg/util/proto" "k8s.io/kube-openapi/pkg/util/proto/validation" - log "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log" ) type concurrentMap struct{ cmap.ConcurrentMap } diff --git a/pkg/openapi/validation_test.go b/pkg/openapi/validation_test.go index 9fcba26d8a..a1ce079344 100644 --- a/pkg/openapi/validation_test.go +++ b/pkg/openapi/validation_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policy/actions.go b/pkg/policy/actions.go index fa674817a3..5d3082ca28 100644 --- a/pkg/policy/actions.go +++ b/pkg/policy/actions.go @@ -3,7 +3,7 @@ package policy import ( "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" dclient "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/policy/generate" "github.com/kyverno/kyverno/pkg/policy/mutate" diff --git a/pkg/policy/apply.go b/pkg/policy/apply.go index 21583be815..c02b36b247 100644 --- a/pkg/policy/apply.go +++ b/pkg/policy/apply.go @@ -9,7 +9,7 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/context" diff --git a/pkg/policy/background.go b/pkg/policy/background.go index 989ed5d237..86d299b04f 100644 --- a/pkg/policy/background.go +++ b/pkg/policy/background.go @@ -5,7 +5,7 @@ import ( "fmt" gojmespath "github.com/jmespath/go-jmespath" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/variables" "github.com/kyverno/kyverno/pkg/utils" diff --git a/pkg/policy/background_test.go b/pkg/policy/background_test.go index b35fb0d31a..c4654b5200 100644 --- a/pkg/policy/background_test.go +++ b/pkg/policy/background_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policy/common.go b/pkg/policy/common.go index c25e68dc00..bf67966c7d 100644 --- a/pkg/policy/common.go +++ b/pkg/policy/common.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/config" "github.com/kyverno/kyverno/pkg/utils" "github.com/minio/pkg/wildcard" diff --git a/pkg/policy/existing.go b/pkg/policy/existing.go index 8365e0079e..6bdd1f148d 100644 --- a/pkg/policy/existing.go +++ b/pkg/policy/existing.go @@ -7,7 +7,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/response" diff --git a/pkg/policy/generate/fake.go b/pkg/policy/generate/fake.go index 13ca84457f..c767af671a 100644 --- a/pkg/policy/generate/fake.go +++ b/pkg/policy/generate/fake.go @@ -1,7 +1,7 @@ package generate import ( - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/policy/generate/fake" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/pkg/policy/generate/validate.go b/pkg/policy/generate/validate.go index 9ea4e2fa34..09e63f5617 100644 --- a/pkg/policy/generate/validate.go +++ b/pkg/policy/generate/validate.go @@ -5,7 +5,7 @@ import ( "reflect" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" dclient "github.com/kyverno/kyverno/pkg/dclient" commonAnchors "github.com/kyverno/kyverno/pkg/engine/anchor/common" "github.com/kyverno/kyverno/pkg/engine/variables" diff --git a/pkg/policy/generate/validate_test.go b/pkg/policy/generate/validate_test.go index 8a35ddca34..f43d35e7af 100644 --- a/pkg/policy/generate/validate_test.go +++ b/pkg/policy/generate/validate_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policy/metrics.go b/pkg/policy/metrics.go index 4b75afefd6..652cedf29a 100644 --- a/pkg/policy/metrics.go +++ b/pkg/policy/metrics.go @@ -4,7 +4,7 @@ import ( "reflect" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" policyChangesMetric "github.com/kyverno/kyverno/pkg/metrics/policychanges" policyRuleInfoMetric "github.com/kyverno/kyverno/pkg/metrics/policyruleinfo" ) diff --git a/pkg/policy/mutate/validate.go b/pkg/policy/mutate/validate.go index d73930a227..1e22864f80 100644 --- a/pkg/policy/mutate/validate.go +++ b/pkg/policy/mutate/validate.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" commonAnchors "github.com/kyverno/kyverno/pkg/engine/anchor/common" "github.com/kyverno/kyverno/pkg/policy/common" ) diff --git a/pkg/policy/mutate/validate_test.go b/pkg/policy/mutate/validate_test.go index b0948eb34a..11dd30b811 100644 --- a/pkg/policy/mutate/validate_test.go +++ b/pkg/policy/mutate/validate_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policy/policy_controller.go b/pkg/policy/policy_controller.go index c9f43d6bfb..3333d4a38f 100644 --- a/pkg/policy/policy_controller.go +++ b/pkg/policy/policy_controller.go @@ -10,7 +10,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" @@ -24,7 +24,7 @@ import ( pm "github.com/kyverno/kyverno/pkg/policymutation" "github.com/kyverno/kyverno/pkg/policyreport" "github.com/kyverno/kyverno/pkg/resourcecache" - utils "github.com/kyverno/kyverno/pkg/utils" + "github.com/kyverno/kyverno/pkg/utils" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/policy/report.go b/pkg/policy/report.go index 6dd9600de5..d76a6e4045 100644 --- a/pkg/policy/report.go +++ b/pkg/policy/report.go @@ -7,7 +7,7 @@ import ( "time" "github.com/go-logr/logr" - v1alpha2 "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/api/policyreport/v1alpha2" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" changerequestlister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha2" policyreportlister "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha2" diff --git a/pkg/policy/validate.go b/pkg/policy/validate.go index cdee06b9fe..56d4f074ae 100644 --- a/pkg/policy/validate.go +++ b/pkg/policy/validate.go @@ -9,7 +9,7 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/jmespath/go-jmespath" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" comn "github.com/kyverno/kyverno/pkg/common" dclient "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" @@ -18,12 +18,12 @@ import ( "github.com/kyverno/kyverno/pkg/openapi" "github.com/kyverno/kyverno/pkg/utils" "github.com/minio/pkg/wildcard" - errors "github.com/pkg/errors" + "github.com/pkg/errors" rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/yaml" - log "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log" ) // validateJSONPatchPathForForwardSlash checks for forward slash diff --git a/pkg/policy/validate/validate.go b/pkg/policy/validate/validate.go index 6f1cffb823..422660283c 100644 --- a/pkg/policy/validate/validate.go +++ b/pkg/policy/validate/validate.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" commonAnchors "github.com/kyverno/kyverno/pkg/engine/anchor/common" "github.com/kyverno/kyverno/pkg/policy/common" ) diff --git a/pkg/policy/validate/validate_test.go b/pkg/policy/validate/validate_test.go index 99b7b3349b..d45bc1d0f2 100644 --- a/pkg/policy/validate/validate_test.go +++ b/pkg/policy/validate/validate_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policy/validate_test.go b/pkg/policy/validate_test.go index ebc46d6af3..40efa42bdb 100644 --- a/pkg/policy/validate_test.go +++ b/pkg/policy/validate_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/openapi" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "sigs.k8s.io/controller-runtime/pkg/log" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "gotest.tools/assert" ) diff --git a/pkg/policycache/cache.go b/pkg/policycache/cache.go index dbdb571ca1..7da7e0faa0 100644 --- a/pkg/policycache/cache.go +++ b/pkg/policycache/cache.go @@ -5,7 +5,7 @@ import ( "sync" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" policy2 "github.com/kyverno/kyverno/pkg/policy" diff --git a/pkg/policycache/cache_test.go b/pkg/policycache/cache_test.go index a4440976df..d8d1514bf3 100644 --- a/pkg/policycache/cache_test.go +++ b/pkg/policycache/cache_test.go @@ -5,8 +5,7 @@ import ( "fmt" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" lv1 "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" "gotest.tools/assert" "k8s.io/apimachinery/pkg/labels" diff --git a/pkg/policycache/informer.go b/pkg/policycache/informer.go index 4c89f8fb0d..0dcd2452e8 100644 --- a/pkg/policycache/informer.go +++ b/pkg/policycache/informer.go @@ -4,7 +4,7 @@ import ( "reflect" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" "k8s.io/client-go/tools/cache" ) diff --git a/pkg/policymutation/cronjob.go b/pkg/policymutation/cronjob.go index d9773645d0..07adf21048 100644 --- a/pkg/policymutation/cronjob.go +++ b/pkg/policymutation/cronjob.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/variables" "github.com/kyverno/kyverno/pkg/utils" diff --git a/pkg/policymutation/policymutation.go b/pkg/policymutation/policymutation.go index fb7a25f91e..e0663e4fea 100644 --- a/pkg/policymutation/policymutation.go +++ b/pkg/policymutation/policymutation.go @@ -10,7 +10,7 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/variables" diff --git a/pkg/policymutation/policymutation_test.go b/pkg/policymutation/policymutation_test.go index e209d8b7df..4d809df4e6 100644 --- a/pkg/policymutation/policymutation_test.go +++ b/pkg/policymutation/policymutation_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/utils" "gotest.tools/assert" diff --git a/pkg/policyreport/builder.go b/pkg/policyreport/builder.go index 5ca961d37d..f8bf7fc17a 100755 --- a/pkg/policyreport/builder.go +++ b/pkg/policyreport/builder.go @@ -6,9 +6,9 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - request "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" + request "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" "github.com/kyverno/kyverno/pkg/config" "github.com/kyverno/kyverno/pkg/engine/response" diff --git a/pkg/policyreport/changerequestcreator.go b/pkg/policyreport/changerequestcreator.go index 3e1053f9b2..0e76f4f629 100644 --- a/pkg/policyreport/changerequestcreator.go +++ b/pkg/policyreport/changerequestcreator.go @@ -10,7 +10,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/config" dclient "github.com/kyverno/kyverno/pkg/dclient" - cache "github.com/patrickmn/go-cache" + "github.com/patrickmn/go-cache" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) diff --git a/pkg/policyreport/policyreport.go b/pkg/policyreport/policyreport.go index dddb6ed5fb..50621dd3cd 100644 --- a/pkg/policyreport/policyreport.go +++ b/pkg/policyreport/policyreport.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/cornelk/hashmap" - changerequest "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" + changerequest "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" changerequestlister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1alpha2" policyreportlister "github.com/kyverno/kyverno/pkg/client/listers/policyreport/v1alpha2" diff --git a/pkg/policyreport/reportcontroller.go b/pkg/policyreport/reportcontroller.go index 538bd19a72..aae1905857 100644 --- a/pkg/policyreport/reportcontroller.go +++ b/pkg/policyreport/reportcontroller.go @@ -7,11 +7,13 @@ import ( "time" "github.com/go-logr/logr" + changerequest "github.com/kyverno/kyverno/api/kyverno/v1alpha2" + report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - labels "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -22,8 +24,6 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" - changerequest "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" - report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha2" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" requestinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha2" policyreportinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/policyreport/v1alpha2" @@ -372,7 +372,7 @@ func (g *ReportGenerator) createReportIfNotPresent(namespace string, new *unstru return nil, nil } - report, err = g.reportLister.PolicyReports(namespace).Get(generatePolicyReportName((namespace))) + report, err = g.reportLister.PolicyReports(namespace).Get(generatePolicyReportName(namespace)) if err != nil { if apierrors.IsNotFound(err) && new != nil { if _, err := g.dclient.CreateResource(new.GetAPIVersion(), new.GetKind(), new.GetNamespace(), new, false); err != nil { @@ -387,7 +387,7 @@ func (g *ReportGenerator) createReportIfNotPresent(namespace string, new *unstru return nil, fmt.Errorf("unable to get policyReport: %v", err) } } else { - report, err = g.clusterReportLister.Get(generatePolicyReportName((namespace))) + report, err = g.clusterReportLister.Get(generatePolicyReportName(namespace)) if err != nil { if apierrors.IsNotFound(err) { if new != nil { diff --git a/pkg/policyreport/reportrequest.go b/pkg/policyreport/reportrequest.go index 46fe72ffbf..009fb1a672 100755 --- a/pkg/policyreport/reportrequest.go +++ b/pkg/policyreport/reportrequest.go @@ -9,7 +9,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" policyreportclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" requestinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1alpha2" diff --git a/pkg/testrunner/scenario.go b/pkg/testrunner/scenario.go index 8974264eae..b6c932ab3a 100644 --- a/pkg/testrunner/scenario.go +++ b/pkg/testrunner/scenario.go @@ -5,17 +5,16 @@ import ( "encoding/json" "io/ioutil" "os" + "path" ospath "path" "path/filepath" "reflect" + "runtime" "testing" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/stretchr/testify/assert" - "path" - "runtime" - - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/context" diff --git a/pkg/utils/json.go b/pkg/utils/json.go index b4675b5a79..ae6fa5bffb 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/json.go @@ -4,7 +4,7 @@ import ( "encoding/json" "reflect" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" ) // JoinPatches joins array of serialized JSON patches to the single JSONPatch array diff --git a/pkg/utils/loadpolicy.go b/pkg/utils/loadpolicy.go index b5b10fc50b..0ad58d78fc 100644 --- a/pkg/utils/loadpolicy.go +++ b/pkg/utils/loadpolicy.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "k8s.io/apimachinery/pkg/util/yaml" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/pkg/utils/util.go b/pkg/utils/util.go index feebe4bf80..e8ad65dd20 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -6,10 +6,10 @@ import ( "regexp" "strconv" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "sigs.k8s.io/controller-runtime/pkg/log" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" common "github.com/kyverno/kyverno/pkg/common" client "github.com/kyverno/kyverno/pkg/dclient" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/pkg/webhookconfig/configmanager.go b/pkg/webhookconfig/configmanager.go index 5347c933da..28bea8fd1e 100644 --- a/pkg/webhookconfig/configmanager.go +++ b/pkg/webhookconfig/configmanager.go @@ -9,7 +9,7 @@ import ( "time" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/webhooks/common.go b/pkg/webhooks/common.go index d2420ce343..eb6258a166 100644 --- a/pkg/webhooks/common.go +++ b/pkg/webhooks/common.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/engine/response" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/pkg/webhooks/generate/generate.go b/pkg/webhooks/generate/generate.go index 6e8d28ba4f..fe5a72089c 100644 --- a/pkg/webhooks/generate/generate.go +++ b/pkg/webhooks/generate/generate.go @@ -7,7 +7,7 @@ import ( backoff "github.com/cenkalti/backoff" "github.com/gardener/controller-manager-library/pkg/logger" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" diff --git a/pkg/webhooks/generation.go b/pkg/webhooks/generation.go index 271fc6ed8d..06fa382243 100644 --- a/pkg/webhooks/generation.go +++ b/pkg/webhooks/generation.go @@ -9,9 +9,8 @@ import ( "github.com/gardener/controller-manager-library/pkg/logger" "github.com/go-logr/logr" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" "github.com/kyverno/kyverno/pkg/config" client "github.com/kyverno/kyverno/pkg/dclient" @@ -28,13 +27,13 @@ import ( policyResults "github.com/kyverno/kyverno/pkg/metrics/policyresults" kyvernoutils "github.com/kyverno/kyverno/pkg/utils" "github.com/kyverno/kyverno/pkg/webhooks/generate" - v1beta1 "k8s.io/api/admission/v1beta1" + "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/labels" ) -func (ws *WebhookServer) applyGeneratePolicies(request *v1beta1.AdmissionRequest, policyContext *engine.PolicyContext, policies []*v1.ClusterPolicy, ts int64, logger logr.Logger) { +func (ws *WebhookServer) applyGeneratePolicies(request *v1beta1.AdmissionRequest, policyContext *engine.PolicyContext, policies []*kyverno.ClusterPolicy, ts int64, logger logr.Logger) { admissionReviewCompletionLatencyChannel := make(chan int64, 1) generateEngineResponsesSenderForAdmissionReviewDurationMetric := make(chan []*response.EngineResponse, 1) generateEngineResponsesSenderForAdmissionRequestsCountMetric := make(chan []*response.EngineResponse, 1) @@ -204,7 +203,7 @@ func (ws *WebhookServer) handleUpdateGenerateSourceResource(resLabels map[string // updateAnnotationInGR - function used to update GR annotation // updating GR will trigger reprocessing of GR and recreation/updation of generated resource -func (ws *WebhookServer) updateAnnotationInGR(gr *v1.GenerateRequest, logger logr.Logger) { +func (ws *WebhookServer) updateAnnotationInGR(gr *kyverno.GenerateRequest, logger logr.Logger) { grAnnotations := gr.Annotations if len(grAnnotations) == 0 { grAnnotations = make(map[string]string) @@ -219,7 +218,7 @@ func (ws *WebhookServer) updateAnnotationInGR(gr *v1.GenerateRequest, logger log } //handleUpdateGenerateTargetResource - handles update of target resource for generate policy -func (ws *WebhookServer) handleUpdateGenerateTargetResource(request *v1beta1.AdmissionRequest, policies []*v1.ClusterPolicy, resLabels map[string]string, logger logr.Logger) { +func (ws *WebhookServer) handleUpdateGenerateTargetResource(request *v1beta1.AdmissionRequest, policies []*kyverno.ClusterPolicy, resLabels map[string]string, logger logr.Logger) { enqueueBool := false newRes, err := enginutils.ConvertToUnstructured(request.Object.Raw) if err != nil { @@ -280,7 +279,7 @@ func (ws *WebhookServer) handleUpdateGenerateTargetResource(request *v1beta1.Adm } } -func getGeneratedByResource(newRes *unstructured.Unstructured, resLabels map[string]string, client *client.Client, rule v1.Rule, logger logr.Logger) (v1.Rule, error) { +func getGeneratedByResource(newRes *unstructured.Unstructured, resLabels map[string]string, client *client.Client, rule kyverno.Rule, logger logr.Logger) (kyverno.Rule, error) { var apiVersion, kind, name, namespace string sourceRequest := &v1beta1.AdmissionRequest{} kind = resLabels["kyverno.io/generated-by-kind"] @@ -460,7 +459,7 @@ func transform(admissionRequestInfo kyverno.AdmissionRequestInfoObject, userRequ } type generateRequestResponse struct { - gr v1.GenerateRequestSpec + gr kyverno.GenerateRequestSpec err error } diff --git a/pkg/webhooks/mutation.go b/pkg/webhooks/mutation.go index 3c1c726205..8f370f4ad6 100644 --- a/pkg/webhooks/mutation.go +++ b/pkg/webhooks/mutation.go @@ -5,11 +5,10 @@ import ( "reflect" "time" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/common" "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/response" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" @@ -18,12 +17,12 @@ import ( policyResults "github.com/kyverno/kyverno/pkg/metrics/policyresults" "github.com/kyverno/kyverno/pkg/utils" "github.com/pkg/errors" - v1beta1 "k8s.io/api/admission/v1beta1" + "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) -func (ws *WebhookServer) applyMutatePolicies(request *v1beta1.AdmissionRequest, policyContext *engine.PolicyContext, policies []*v1.ClusterPolicy, ts int64, logger logr.Logger) []byte { +func (ws *WebhookServer) applyMutatePolicies(request *v1beta1.AdmissionRequest, policyContext *engine.PolicyContext, policies []*kyverno.ClusterPolicy, ts int64, logger logr.Logger) []byte { var mutateEngineResponses []*response.EngineResponse mutatePatches, mutateEngineResponses := ws.handleMutation(request, policyContext, policies) @@ -117,7 +116,7 @@ func (ws *WebhookServer) handleMutation( // all policies were applied successfully. // create an event on the resource // ADD EVENTS - events := generateEvents(engineResponses, false, (request.Operation == v1beta1.Update), logger) + events := generateEvents(engineResponses, false, request.Operation == v1beta1.Update, logger) ws.eventGen.Add(events...) // debug info diff --git a/pkg/webhooks/policymutation.go b/pkg/webhooks/policymutation.go index d950068843..98c657dd4f 100644 --- a/pkg/webhooks/policymutation.go +++ b/pkg/webhooks/policymutation.go @@ -8,7 +8,7 @@ import ( "time" logr "github.com/go-logr/logr" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/policymutation" v1beta1 "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/webhooks/policymutation_test.go b/pkg/webhooks/policymutation_test.go index b8dd09992d..96ec186238 100644 --- a/pkg/webhooks/policymutation_test.go +++ b/pkg/webhooks/policymutation_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/utils" "github.com/kyverno/kyverno/pkg/policymutation" diff --git a/pkg/webhooks/policyvalidation.go b/pkg/webhooks/policyvalidation.go index 36e1050974..f63028cc43 100644 --- a/pkg/webhooks/policyvalidation.go +++ b/pkg/webhooks/policyvalidation.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + kyverno "github.com/kyverno/kyverno/api/kyverno/v1" policyvalidate "github.com/kyverno/kyverno/pkg/policy" v1beta1 "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/webhooks/report.go b/pkg/webhooks/report.go index 1ec7d21672..4f247029a3 100644 --- a/pkg/webhooks/report.go +++ b/pkg/webhooks/report.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/go-logr/logr" - kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/api/kyverno/v1alpha2" + kyvernov1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/event" diff --git a/pkg/webhooks/server.go b/pkg/webhooks/server.go index 6082a8adbb..48f729e905 100644 --- a/pkg/webhooks/server.go +++ b/pkg/webhooks/server.go @@ -11,7 +11,7 @@ import ( "github.com/go-logr/logr" "github.com/julienschmidt/httprouter" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1" kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1" @@ -31,12 +31,12 @@ import ( "github.com/kyverno/kyverno/pkg/policyreport" "github.com/kyverno/kyverno/pkg/resourcecache" tlsutils "github.com/kyverno/kyverno/pkg/tls" - userinfo "github.com/kyverno/kyverno/pkg/userinfo" + "github.com/kyverno/kyverno/pkg/userinfo" "github.com/kyverno/kyverno/pkg/utils" "github.com/kyverno/kyverno/pkg/webhookconfig" webhookgenerate "github.com/kyverno/kyverno/pkg/webhooks/generate" "github.com/pkg/errors" - v1beta1 "k8s.io/api/admission/v1beta1" + "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" informers "k8s.io/client-go/informers/core/v1" rbacinformer "k8s.io/client-go/informers/rbac/v1" diff --git a/pkg/webhooks/validate_audit.go b/pkg/webhooks/validate_audit.go index 5c2ee4790f..e9ad6365d9 100644 --- a/pkg/webhooks/validate_audit.go +++ b/pkg/webhooks/validate_audit.go @@ -4,6 +4,7 @@ import ( "strings" "time" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/utils" @@ -13,7 +14,6 @@ import ( client "github.com/kyverno/kyverno/pkg/dclient" "github.com/go-logr/logr" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/config" "github.com/kyverno/kyverno/pkg/event" "github.com/kyverno/kyverno/pkg/metrics" diff --git a/pkg/webhooks/validation.go b/pkg/webhooks/validation.go index a16cf323c9..7218b5aa1f 100644 --- a/pkg/webhooks/validation.go +++ b/pkg/webhooks/validation.go @@ -4,10 +4,10 @@ import ( "reflect" "time" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/event" "github.com/go-logr/logr" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/metrics" diff --git a/pkg/webhooks/verify_images.go b/pkg/webhooks/verify_images.go index b3e0282602..22f9b4da15 100644 --- a/pkg/webhooks/verify_images.go +++ b/pkg/webhooks/verify_images.go @@ -4,7 +4,7 @@ import ( "errors" "github.com/go-logr/logr" - v1 "github.com/kyverno/kyverno/pkg/api/kyverno/v1" + v1 "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/response" engineutils "github.com/kyverno/kyverno/pkg/engine/utils" diff --git a/scripts/create-e2e-infrastruture.sh b/scripts/create-e2e-infrastruture.sh index 3af22ad56f..2d156e091d 100755 --- a/scripts/create-e2e-infrastruture.sh +++ b/scripts/create-e2e-infrastruture.sh @@ -14,9 +14,9 @@ $pwd/kind load docker-image ghcr.io/kyverno/kyverno:$hash $pwd/kind load docker-image ghcr.io/kyverno/kyvernopre:$hash pwd=$(pwd) -cd $pwd/definitions +cd $pwd/config echo "Installing kustomize" curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash kustomize edit set image ghcr.io/kyverno/kyverno:$hash kustomize edit set image ghcr.io/kyverno/kyvernopre:$hash -kustomize build $pwd/definitions/ -o $pwd/definitions/install.yaml +kustomize build $pwd/config/ -o $pwd/config/install.yaml diff --git a/scripts/deploy-controller.sh b/scripts/deploy-controller.sh index 89a3822d00..4ac7ebd2a2 100755 --- a/scripts/deploy-controller.sh +++ b/scripts/deploy-controller.sh @@ -33,8 +33,8 @@ if [ -z "${namespace}" ]; then # controller should be launched locally ${certsGenerator} "--service=${service_name}" "--serverIp=${serverIp}" || exit 2 - kubectl delete -f definitions/install.yaml - kubectl create -f definitions/install.yaml || exit 3 + kubectl delete -f config/install.yaml + kubectl create -f config/install.yaml || exit 3 echo -e "\n### You can build and run kyverno project locally.\n### To check its work, run it with parameters -cert, -key and -kubeconfig parameters (see paths of -cert and -key in the log above)." diff --git a/scripts/generate-self-signed-cert-and-k8secrets-debug.sh b/scripts/generate-self-signed-cert-and-k8secrets-debug.sh index 9713d539e8..43f8cba6ca 100755 --- a/scripts/generate-self-signed-cert-and-k8secrets-debug.sh +++ b/scripts/generate-self-signed-cert-and-k8secrets-debug.sh @@ -58,7 +58,7 @@ openssl req -new -key ${destdir}/webhook.key -out ${destdir}/webhook.csr -subj " openssl x509 -req -in ${destdir}/webhook.csr -CA ${destdir}/rootCA.crt -CAkey ${destdir}/rootCA.key -CAcreateserial -out ${destdir}/webhook.crt -days 1024 -sha256 -extensions v3_req -extfile ${tmpdir}/csr.conf -kubectl delete -f definitions/install_debug.yaml 2>/dev/null +kubectl delete -f config/install_debug.yaml 2>/dev/null kubectl delete namespace kyverno 2>/dev/null echo "Generating corresponding kubernetes secrets for TLS pair and root CA" @@ -72,4 +72,4 @@ kubectl annotate secret ${service}.kyverno.svc.kyverno-tls-pair -n kyverno self- kubectl -n kyverno create secret generic ${service}.kyverno.svc.kyverno-tls-ca --from-file=${destdir}/rootCA.crt echo "Creating CRD" -kubectl apply -f definitions/install_debug.yaml +kubectl apply -f config/install_debug.yaml