8000 feat: Removing old schema by kushal9897 · Pull Request #12840 · kyverno/kyverno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Removing old schema #12840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion cmd/cli/kubectl-kyverno/commands/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ func runTest(out io.Writer, testCase test.TestCase, registryAccess bool) (*TestR
if err != nil {
return nil, fmt.Errorf("error: failed to load request info (%s)", err)
}
deprecations.CheckUserInfo(out, testCase.Test.UserInfo, info)
if deprecations.CheckUserInfo(out, testCase.Test.UserInfo, info) {
return nil, fmt.Errorf("userInfo file %s uses a deprecated schema — please migrate to the latest format", testCase.Test.UserInfo)
}
userInfo = &info.RequestInfo
}
// policies
Expand Down
10 changes: 10 additions & 0 deletions cmd/cli/kubectl-kyverno/test/load.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test

import (
"fmt"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -73,6 +74,15 @@ func LoadTest(fs billy.Filesystem, path string) TestCase {
Err: err,
}
}

if test.APIVersion != "cli.kyverno.io/v1alpha1" || test.Kind != "Test" {
return TestCase{
Path: path,
Fs: fs,
Err: fmt.Errorf("invalid or missing schema: test must include apiVersion: cli.kyverno.io/v1alpha1 and kind: Test"),
}
}

cleanTest(&test)
return TestCase{
Path: path,
Expand Down
10 changes: 0 additions & 10 deletions cmd/cli/kubectl-kyverno/test/load_test.go
< 8000 td id="diff-fd15ffb9e60a477ca39ec9f6ce720d9456ac61cc6fe5abb2ac2ed8a36b599141L37" data-line-number="37" class="blob-num blob-num-deletion js-linkable-line-number">
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package test

import (
"fmt"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -33,15 +32,6 @@ func TestLoadTests(t *testing.T) {
fileName: "kyverno-test.yaml",
want: nil,
wantErr: true,
}, {
name: "invalid dir",
dirPath: "../_testdata/tests",
fileName: "kyverno-test-invalid.yaml",
want: []TestCase{{
Path: "../_testdata/tests/test-invalid/kyverno-test-invalid.yaml",
Err: fmt.Errorf("error unmarshaling JSON: while decoding JSON: json: unknown field \"foo\""),
}},
wantErr: false,
}, {
name: "ok",
dirPath: "../_testdata/tests/test-1",
Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/kubectl-kyverno/variables/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ func New(out io.Writer, fs billy.Filesystem, resourcePath string, path string, v
if err != nil {
return nil, fmt.Errorf("unable to load variable file: %s (%w)", path, err)
}
deprecations.CheckValues(out, path, v)
if deprecations.CheckValues(out, path, v) {
return nil, fmt.Errorf("values file %s uses a deprecated schema — please migrate to the latest format", path)
}
vals = &v.ValuesSpec
}
variables := Variables{
Expand Down
Loading
0