From b815caef5d1c23d4fefa5af1134a6961795356bc Mon Sep 17 00:00:00 2001 From: Mritunjay Kumar Sharma Date: Thu, 14 Apr 2022 17:50:18 +0530 Subject: [PATCH] refactor cli code from pkg to cmd (#3591) * refactor cli code from pkg to cmd Signed-off-by: Mritunjay Sharma * fixes in imports Signed-off-by: Mritunjay Sharma * fixes tests Signed-off-by: Mritunjay Sharma * fixed conflicts Signed-off-by: Mritunjay Sharma * moved non-commands to utils Signed-off-by: Mritunjay Sharma Co-authored-by: Vyankatesh Kudtarkar --- .gitignore | 1 - .../kubectl-kyverno}/apply/apply_command.go | 6 +-- .../apply/apply_command_test.go | 12 ++--- .../cli/kubectl-kyverno}/apply/generate.go | 2 +- .../kubectl-kyverno}/apply/generate_test.go | 0 .../cli/kubectl-kyverno}/apply/report.go | 0 .../cli/kubectl-kyverno}/apply/report_test.go | 2 +- .../cli/kubectl-kyverno}/jp/jp_command.go | 0 cmd/cli/kubectl-kyverno/main.go | 50 ++++++++++++++++- .../cli/kubectl-kyverno}/test/git.go | 0 .../cli/kubectl-kyverno}/test/test_command.go | 6 +-- .../kubectl-kyverno/utils}/common/common.go | 4 +- .../utils}/common/common_test.go | 0 .../kubectl-kyverno/utils}/common/fetch.go | 0 .../kubectl-kyverno/utils}/common/regex.go | 0 .../kubectl-kyverno/utils}/crds/policy_crd.go | 0 .../utils}/sanitizedError/error.go | 0 .../cli/kubectl-kyverno/utils}/store/store.go | 0 .../cli/kubectl-kyverno}/validate/command.go | 6 +-- .../validate/commmand_test.go | 0 .../cli/kubectl-kyverno}/version/command.go | 0 pkg/engine/jsonContext.go | 2 +- pkg/engine/mutation_test.go | 2 +- pkg/engine/validation_test.go | 2 +- pkg/kyverno/main.go | 53 ------------------- pkg/policy/policy_controller.go | 2 +- pkg/policy/validate.go | 2 +- 27 files changed, 72 insertions(+), 80 deletions(-) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/apply_command.go (98%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/apply_command_test.go (78%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/generate.go (98%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/generate_test.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/report.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/apply/report_test.go (98%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/jp/jp_command.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/test/git.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/test/test_command.go (99%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/common/common.go (99%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/common/common_test.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/common/fetch.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/common/regex.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/crds/policy_crd.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/sanitizedError/error.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno/utils}/store/store.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/validate/command.go (96%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/validate/commmand_test.go (100%) rename {pkg/kyverno => cmd/cli/kubectl-kyverno}/version/command.go (100%) delete mode 100644 pkg/kyverno/main.go diff --git a/.gitignore b/.gitignore index 0734e3c142..4d7f87b3eb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ coverage.txt .idea cmd/initContainer/kyvernopre cmd/kyverno/kyverno -cmd/cli/kubectl-kyverno/kyverno kubectl-kyverno /release .DS_Store diff --git a/pkg/kyverno/apply/apply_command.go b/cmd/cli/kubectl-kyverno/apply/apply_command.go similarity index 98% rename from pkg/kyverno/apply/apply_command.go rename to cmd/cli/kubectl-kyverno/apply/apply_command.go index 9002a97ddc..e6898f1b86 100644 --- a/pkg/kyverno/apply/apply_command.go +++ b/cmd/cli/kubectl-kyverno/apply/apply_command.go @@ -9,10 +9,10 @@ import ( "github.com/go-git/go-billy/v5/memfs" v1 "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" + sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" client "github.com/kyverno/kyverno/pkg/dclient" - "github.com/kyverno/kyverno/pkg/kyverno/common" - sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" - "github.com/kyverno/kyverno/pkg/kyverno/store" "github.com/kyverno/kyverno/pkg/openapi" policy2 "github.com/kyverno/kyverno/pkg/policy" "github.com/kyverno/kyverno/pkg/policyreport" diff --git a/pkg/kyverno/apply/apply_command_test.go b/cmd/cli/kubectl-kyverno/apply/apply_command_test.go similarity index 78% rename from pkg/kyverno/apply/apply_command_test.go rename to cmd/cli/kubectl-kyverno/apply/apply_command_test.go index 4ef9aa139e..bf57d40eb3 100644 --- a/pkg/kyverno/apply/apply_command_test.go +++ b/cmd/cli/kubectl-kyverno/apply/apply_command_test.go @@ -16,8 +16,8 @@ func Test_Apply(t *testing.T) { testcases := []TestCase{ { - PolicyPaths: []string{"../../../test/best_practices/disallow_latest_tag.yaml"}, - ResourcePaths: []string{"../../../test/resources/pod_with_version_tag.yaml"}, + PolicyPaths: []string{"../../../../test/best_practices/disallow_latest_tag.yaml"}, + ResourcePaths: []string{"../../../../test/resources/pod_with_version_tag.yaml"}, expectedPolicyReports: []preport.PolicyReport{ { Summary: preport.PolicyReportSummary{ @@ -31,8 +31,8 @@ func Test_Apply(t *testing.T) { }, }, { - PolicyPaths: []string{"../../../test/best_practices/disallow_latest_tag.yaml"}, - ResourcePaths: []string{"../../../test/resources/pod_with_latest_tag.yaml"}, + PolicyPaths: []string{"../../../../test/best_practices/disallow_latest_tag.yaml"}, + ResourcePaths: []string{"../../../../test/resources/pod_with_latest_tag.yaml"}, expectedPolicyReports: []preport.PolicyReport{ { Summary: preport.PolicyReportSummary{ @@ -46,8 +46,8 @@ func Test_Apply(t *testing.T) { }, }, { - PolicyPaths: []string{"../../../test/cli/apply/policies"}, - ResourcePaths: []string{"../../../test/cli/apply/resource"}, + PolicyPaths: []string{"../../../../test/cli/apply/policies"}, + ResourcePaths: []string{"../../../../test/cli/apply/resource"}, expectedPolicyReports: []preport.PolicyReport{ { Summary: preport.PolicyReportSummary{ diff --git a/pkg/kyverno/apply/generate.go b/cmd/cli/kubectl-kyverno/apply/generate.go similarity index 98% rename from pkg/kyverno/apply/generate.go rename to cmd/cli/kubectl-kyverno/apply/generate.go index fa365612a7..c9e3cff953 100644 --- a/pkg/kyverno/apply/generate.go +++ b/cmd/cli/kubectl-kyverno/apply/generate.go @@ -4,8 +4,8 @@ import ( "reflect" report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" + sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError" client "github.com/kyverno/kyverno/pkg/dclient" - sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/kyverno/apply/generate_test.go b/cmd/cli/kubectl-kyverno/apply/generate_test.go similarity index 100% rename from pkg/kyverno/apply/generate_test.go rename to cmd/cli/kubectl-kyverno/apply/generate_test.go diff --git a/pkg/kyverno/apply/report.go b/cmd/cli/kubectl-kyverno/apply/report.go similarity index 100% rename from pkg/kyverno/apply/report.go rename to cmd/cli/kubectl-kyverno/apply/report.go diff --git a/pkg/kyverno/apply/report_test.go b/cmd/cli/kubectl-kyverno/apply/report_test.go similarity index 98% rename from pkg/kyverno/apply/report_test.go rename to cmd/cli/kubectl-kyverno/apply/report_test.go index eea778c518..e29725d8f6 100644 --- a/pkg/kyverno/apply/report_test.go +++ b/cmd/cli/kubectl-kyverno/apply/report_test.go @@ -6,8 +6,8 @@ import ( kyverno "github.com/kyverno/kyverno/api/kyverno/v1" preport "github.com/kyverno/kyverno/api/policyreport/v1alpha2" + kyvCommon "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" "github.com/kyverno/kyverno/pkg/engine/response" - kyvCommon "github.com/kyverno/kyverno/pkg/kyverno/common" "github.com/kyverno/kyverno/pkg/policyreport" "gotest.tools/assert" v1 "k8s.io/api/core/v1" diff --git a/pkg/kyverno/jp/jp_command.go b/cmd/cli/kubectl-kyverno/jp/jp_command.go similarity index 100% rename from pkg/kyverno/jp/jp_command.go rename to cmd/cli/kubectl-kyverno/jp/jp_command.go diff --git a/cmd/cli/kubectl-kyverno/main.go b/cmd/cli/kubectl-kyverno/main.go index 3a5bf46832..e9de6d70e0 100644 --- a/cmd/cli/kubectl-kyverno/main.go +++ b/cmd/cli/kubectl-kyverno/main.go @@ -1,7 +1,53 @@ package main -import "github.com/kyverno/kyverno/pkg/kyverno" +import ( + "flag" + "os" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/apply" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/jp" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/validate" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/version" + "github.com/spf13/cobra" + "k8s.io/klog/v2" + "k8s.io/klog/v2/klogr" + log "sigs.k8s.io/controller-runtime/pkg/log" +) + +// CLI ... func main() { - kyverno.CLI() + cli := &cobra.Command{ + Use: "kyverno", + Short: "Kubernetes Native Policy Management", + } + + configurelog(cli) + + commands := []*cobra.Command{ + version.Command(), + apply.Command(), + validate.Command(), + test.Command(), + jp.Command(), + } + + cli.AddCommand(commands...) + + if err := cli.Execute(); err != nil { + os.Exit(1) + } +} + +func configurelog(cli *cobra.Command) { + klog.InitFlags(nil) + log.SetLogger(klogr.New()) + + cli.PersistentFlags().AddGoFlagSet(flag.CommandLine) + _ = cli.PersistentFlags().MarkHidden("alsologtostderr") + _ = cli.PersistentFlags().MarkHidden("logtostderr") + _ = cli.PersistentFlags().MarkHidden("log_dir") + _ = cli.PersistentFlags().MarkHidden("log_backtrace_at") + _ = cli.PersistentFlags().MarkHidden("stderrthreshold") + _ = cli.PersistentFlags().MarkHidden("vmodule") } diff --git a/pkg/kyverno/test/git.go b/cmd/cli/kubectl-kyverno/test/git.go similarity index 100% rename from pkg/kyverno/test/git.go rename to cmd/cli/kubectl-kyverno/test/git.go diff --git a/pkg/kyverno/test/test_command.go b/cmd/cli/kubectl-kyverno/test/test_command.go similarity index 99% rename from pkg/kyverno/test/test_command.go rename to cmd/cli/kubectl-kyverno/test/test_command.go index f5a45e3874..f3200fb57e 100644 --- a/pkg/kyverno/test/test_command.go +++ b/cmd/cli/kubectl-kyverno/test/test_command.go @@ -18,13 +18,13 @@ import ( "github.com/kataras/tablewriter" v1 "github.com/kyverno/kyverno/api/kyverno/v1" report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" + sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" "github.com/kyverno/kyverno/pkg/autogen" "github.com/kyverno/kyverno/pkg/background/generate" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine/response" - "github.com/kyverno/kyverno/pkg/kyverno/common" - sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" - "github.com/kyverno/kyverno/pkg/kyverno/store" "github.com/kyverno/kyverno/pkg/openapi" policy2 "github.com/kyverno/kyverno/pkg/policy" "github.com/kyverno/kyverno/pkg/policyreport" diff --git a/pkg/kyverno/common/common.go b/cmd/cli/kubectl-kyverno/utils/common/common.go similarity index 99% rename from pkg/kyverno/common/common.go rename to cmd/cli/kubectl-kyverno/utils/common/common.go index e318c6bf7b..8e00c0d811 100644 --- a/pkg/kyverno/common/common.go +++ b/cmd/cli/kubectl-kyverno/utils/common/common.go @@ -21,13 +21,13 @@ import ( "github.com/go-logr/logr" v1 "github.com/kyverno/kyverno/api/kyverno/v1" report "github.com/kyverno/kyverno/api/policyreport/v1alpha2" + sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" ut "github.com/kyverno/kyverno/pkg/engine/utils" - sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" - "github.com/kyverno/kyverno/pkg/kyverno/store" "github.com/kyverno/kyverno/pkg/policymutation" "github.com/kyverno/kyverno/pkg/policyreport" "github.com/kyverno/kyverno/pkg/utils" diff --git a/pkg/kyverno/common/common_test.go b/cmd/cli/kubectl-kyverno/utils/common/common_test.go similarity index 100% rename from pkg/kyverno/common/common_test.go rename to cmd/cli/kubectl-kyverno/utils/common/common_test.go diff --git a/pkg/kyverno/common/fetch.go b/cmd/cli/kubectl-kyverno/utils/common/fetch.go similarity index 100% rename from pkg/kyverno/common/fetch.go rename to cmd/cli/kubectl-kyverno/utils/common/fetch.go diff --git a/pkg/kyverno/common/regex.go b/cmd/cli/kubectl-kyverno/utils/common/regex.go similarity index 100% rename from pkg/kyverno/common/regex.go rename to cmd/cli/kubectl-kyverno/utils/common/regex.go diff --git a/pkg/kyverno/crds/policy_crd.go b/cmd/cli/kubectl-kyverno/utils/crds/policy_crd.go similarity index 100% rename from pkg/kyverno/crds/policy_crd.go rename to cmd/cli/kubectl-kyverno/utils/crds/policy_crd.go diff --git a/pkg/kyverno/sanitizedError/error.go b/cmd/cli/kubectl-kyverno/utils/sanitizedError/error.go similarity index 100% rename from pkg/kyverno/sanitizedError/error.go rename to cmd/cli/kubectl-kyverno/utils/sanitizedError/error.go diff --git a/pkg/kyverno/store/store.go b/cmd/cli/kubectl-kyverno/utils/store/store.go similarity index 100% rename from pkg/kyverno/store/store.go rename to cmd/cli/kubectl-kyverno/utils/store/store.go diff --git a/pkg/kyverno/validate/command.go b/cmd/cli/kubectl-kyverno/validate/command.go similarity index 96% rename from pkg/kyverno/validate/command.go rename to cmd/cli/kubectl-kyverno/validate/command.go index 31b7e08a18..fae108b8c5 100644 --- a/pkg/kyverno/validate/command.go +++ b/cmd/cli/kubectl-kyverno/validate/command.go @@ -8,9 +8,9 @@ import ( "os" 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" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/crds" + sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError" "github.com/kyverno/kyverno/pkg/openapi" policy2 "github.com/kyverno/kyverno/pkg/policy" "github.com/kyverno/kyverno/pkg/utils" diff --git a/pkg/kyverno/validate/commmand_test.go b/cmd/cli/kubectl-kyverno/validate/commmand_test.go similarity index 100% rename from pkg/kyverno/validate/commmand_test.go rename to cmd/cli/kubectl-kyverno/validate/commmand_test.go diff --git a/pkg/kyverno/version/command.go b/cmd/cli/kubectl-kyverno/version/command.go similarity index 100% rename from pkg/kyverno/version/command.go rename to cmd/cli/kubectl-kyverno/version/command.go diff --git a/pkg/engine/jsonContext.go b/pkg/engine/jsonContext.go index 97eb0a641c..51e559a0a7 100644 --- a/pkg/engine/jsonContext.go +++ b/pkg/engine/jsonContext.go @@ -9,9 +9,9 @@ import ( "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/v1/remote" kyverno "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" jmespath "github.com/kyverno/kyverno/pkg/engine/jmespath" "github.com/kyverno/kyverno/pkg/engine/variables" - "github.com/kyverno/kyverno/pkg/kyverno/store" "github.com/kyverno/kyverno/pkg/registryclient" ) diff --git a/pkg/engine/mutation_test.go b/pkg/engine/mutation_test.go index 2ce34cc946..1a4f2ff6e6 100644 --- a/pkg/engine/mutation_test.go +++ b/pkg/engine/mutation_test.go @@ -9,9 +9,9 @@ import ( kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/utils" - "github.com/kyverno/kyverno/pkg/kyverno/store" "gotest.tools/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) diff --git a/pkg/engine/validation_test.go b/pkg/engine/validation_test.go index 71349cbe37..9fd049327d 100644 --- a/pkg/engine/validation_test.go +++ b/pkg/engine/validation_test.go @@ -8,9 +8,9 @@ import ( kyverno "github.com/kyverno/kyverno/api/kyverno/v1" "github.com/kyverno/kyverno/pkg/engine/response" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/store" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/utils" - "github.com/kyverno/kyverno/pkg/kyverno/store" utils2 "github.com/kyverno/kyverno/pkg/utils" "gotest.tools/assert" admissionv1 "k8s.io/api/admission/v1" diff --git a/pkg/kyverno/main.go b/pkg/kyverno/main.go deleted file mode 100644 index f41c8a8cb4..0000000000 --- a/pkg/kyverno/main.go +++ /dev/null @@ -1,53 +0,0 @@ -package kyverno - -import ( - "flag" - "os" - - "github.com/kyverno/kyverno/pkg/kyverno/apply" - "github.com/kyverno/kyverno/pkg/kyverno/jp" - "github.com/kyverno/kyverno/pkg/kyverno/test" - "github.com/kyverno/kyverno/pkg/kyverno/validate" - "github.com/kyverno/kyverno/pkg/kyverno/version" - "github.com/spf13/cobra" - "k8s.io/klog/v2" - "k8s.io/klog/v2/klogr" - log "sigs.k8s.io/controller-runtime/pkg/log" -) - -// CLI ... -func CLI() { - cli := &cobra.Command{ - Use: "kyverno", - Short: "Kubernetes Native Policy Management", - } - - configurelog(cli) - - commands := []*cobra.Command{ - version.Command(), - apply.Command(), - validate.Command(), - test.Command(), - jp.Command(), - } - - cli.AddCommand(commands...) - - if err := cli.Execute(); err != nil { - os.Exit(1) - } -} - -func configurelog(cli *cobra.Command) { - klog.InitFlags(nil) - log.SetLogger(klogr.New()) - - cli.PersistentFlags().AddGoFlagSet(flag.CommandLine) - _ = cli.PersistentFlags().MarkHidden("alsologtostderr") - _ = cli.PersistentFlags().MarkHidden("logtostderr") - _ = cli.PersistentFlags().MarkHidden("log_dir") - _ = cli.PersistentFlags().MarkHidden("log_backtrace_at") - _ = cli.PersistentFlags().MarkHidden("stderrthreshold") - _ = cli.PersistentFlags().MarkHidden("vmodule") -} diff --git a/pkg/policy/policy_controller.go b/pkg/policy/policy_controller.go index 899978d5c8..606f5c1196 100644 --- a/pkg/policy/policy_controller.go +++ b/pkg/policy/policy_controller.go @@ -11,6 +11,7 @@ import ( "github.com/go-logr/logr" kyverno "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" "github.com/kyverno/kyverno/pkg/autogen" kyvernoclient "github.com/kyverno/kyverno/pkg/client/clientset/versioned" "github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme" @@ -20,7 +21,6 @@ import ( "github.com/kyverno/kyverno/pkg/config" client "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/event" - "github.com/kyverno/kyverno/pkg/kyverno/common" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/policyreport" "github.com/kyverno/kyverno/pkg/utils" diff --git a/pkg/policy/validate.go b/pkg/policy/validate.go index 8dce76c53c..2108d7abaf 100644 --- a/pkg/policy/validate.go +++ b/pkg/policy/validate.go @@ -12,12 +12,12 @@ import ( jsonpatch "github.com/evanphx/json-patch/v5" "github.com/jmespath/go-jmespath" kyverno "github.com/kyverno/kyverno/api/kyverno/v1" + "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common" "github.com/kyverno/kyverno/pkg/autogen" dclient "github.com/kyverno/kyverno/pkg/dclient" "github.com/kyverno/kyverno/pkg/engine" "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/variables" - "github.com/kyverno/kyverno/pkg/kyverno/common" "github.com/kyverno/kyverno/pkg/openapi" "github.com/kyverno/kyverno/pkg/utils" kubeutils "github.com/kyverno/kyverno/pkg/utils/kube"