mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
refactor: move resource loader package to ext (#8780)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
50c8d20f9c
commit
fb530626ba
5 changed files with 6 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
Loading…
Reference in a new issue