diff --git a/cmd/cli/kubectl-kyverno/exception/load.go b/cmd/cli/kubectl-kyverno/exception/load.go index bdda414252..53feded338 100644 --- a/cmd/cli/kubectl-kyverno/exception/load.go +++ b/cmd/cli/kubectl-kyverno/exception/load.go @@ -6,8 +6,8 @@ import ( kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1" kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1" "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/data" - resourceloader "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/resource/loader" "github.com/kyverno/kyverno/ext/resource/convert" + resourceloader "github.com/kyverno/kyverno/ext/resource/loader" yamlutils "github.com/kyverno/kyverno/ext/yaml" "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/kubectl-validate/pkg/openapiclient" diff --git a/cmd/cli/kubectl-kyverno/policy/load.go b/cmd/cli/kubectl-kyverno/policy/load.go index 4bfc70bd60..3dc68b05db 100644 --- a/cmd/cli/kubectl-kyverno/policy/load.go +++ b/cmd/cli/kubectl-kyverno/policy/load.go @@ -14,9 +14,9 @@ import ( kyvernov2beta1 "github.com/kyverno/kyverno/api/kyverno/v2beta1" "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/data" "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/experimental" - resourceloader "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/resource/loader" "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/source" "github.com/kyverno/kyverno/ext/resource/convert" + resourceloader "github.com/kyverno/kyverno/ext/resource/loader" extyaml "github.com/kyverno/kyverno/ext/yaml" "github.com/kyverno/kyverno/pkg/utils/git" yamlutils "github.com/kyverno/kyverno/pkg/utils/yaml" diff --git a/cmd/cli/kubectl-kyverno/resource/load.go b/cmd/cli/kubectl-kyverno/resource/load.go index 9fbc64ba49..6069709b77 100644 --- a/cmd/cli/kubectl-kyverno/resource/load.go +++ b/cmd/cli/kubectl-kyverno/resource/load.go @@ -1,8 +1,8 @@ package resource import ( - "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/resource/loader" "github.com/kyverno/kyverno/ext/resource/convert" + "github.com/kyverno/kyverno/ext/resource/loader" ) func Load[T any](l loader.Loader, content []byte) (*T, error) { diff --git a/cmd/cli/kubectl-kyverno/resource/loader/loader.go b/ext/resource/loader/loader.go similarity index 100% rename from cmd/cli/kubectl-kyverno/resource/loader/loader.go rename to ext/resource/loader/loader.go diff --git a/cmd/cli/kubectl-kyverno/resource/loader/loader_test.go b/ext/resource/loader/loader_test.go similarity index 93% rename from cmd/cli/kubectl-kyverno/resource/loader/loader_test.go rename to ext/resource/loader/loader_test.go index 5ee78c0944..53a5fc5ab1 100644 --- a/cmd/cli/kubectl-kyverno/resource/loader/loader_test.go +++ b/ext/resource/loader/loader_test.go @@ -129,7 +129,7 @@ func Test_loader_Load(t *testing.T) { }, { name: "unknown GVK", loader: newLoader(openapiclient.NewLocalCRDFiles(data.Crds(), "crds")), - document: loadFile("../../_testdata/resources/namespace.yaml"), + document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"), wantErr: true, }, { name: "bad schema", @@ -146,8 +146,8 @@ func Test_loader_Load(t *testing.T) { }, { name: "ok", loader: newLoader(openapiclient.NewHardcodedBuiltins("1.27")), - document: loadFile("../../_testdata/resources/namespace.yaml"), - want: toUnstructured(loadFile("../../_testdata/resources/namespace.yaml")), + document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"), + want: toUnstructured(loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml")), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {