1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

refactor: move all cli commands in a commands package (#8231)

* chore: name all cli command files the same

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: move all cli commands in a commands package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* root

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-09-04 17:15:55 +02:00 committed by GitHub
parent b5030987a6
commit cef4a9b546
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 115 additions and 101 deletions

View file

@ -12,7 +12,7 @@ import (
"github.com/go-git/go-billy/v5/memfs"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/color"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common"
reportutils "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/report"

View file

@ -20,14 +20,14 @@ func Test_Apply(t *testing.T) {
stdinFile string
}
// copy disallow_latest_tag.yaml to local path
localFileName, err := copyFileToThisDir("../../../../test/best_practices/disallow_latest_tag.yaml")
localFileName, err := copyFileToThisDir("../../../../../test/best_practices/disallow_latest_tag.yaml")
assert.NilError(t, err)
defer func() { _ = os.Remove(localFileName) }()
testcases := []*TestCase{{
config: ApplyCommandConfig{
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"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -42,7 +42,7 @@ func Test_Apply(t *testing.T) {
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{localFileName},
ResourcePaths: []string{"../../../../test/resources/pod_with_version_tag.yaml"},
ResourcePaths: []string{"../../../../../test/resources/pod_with_version_tag.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -56,8 +56,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
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"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -71,8 +71,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/apply/policies"},
ResourcePaths: []string{"../../../../test/cli/apply/resource"},
PolicyPaths: []string{"../../../../../test/cli/apply/policies"},
ResourcePaths: []string{"../../../../../test/cli/apply/resource"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -86,8 +86,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
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"},
PolicyReport: true,
AuditWarn: true,
},
@ -103,11 +103,11 @@ func Test_Apply(t *testing.T) {
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"-"},
ResourcePaths: []string{"../../../../test/resources/pod_with_latest_tag.yaml"},
ResourcePaths: []string{"../../../../../test/resources/pod_with_latest_tag.yaml"},
PolicyReport: true,
AuditWarn: true,
},
stdinFile: "../../../../test/best_practices/disallow_latest_tag.yaml",
stdinFile: "../../../../../test/best_practices/disallow_latest_tag.yaml",
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
Summary: policyreportv1alpha2.PolicyReportSummary{
Pass: 1,
@ -119,12 +119,12 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/best_practices/disallow_latest_tag.yaml"},
PolicyPaths: []string{"../../../../../test/best_practices/disallow_latest_tag.yaml"},
ResourcePaths: []string{"-"},
PolicyReport: true,
AuditWarn: true,
},
stdinFile: "../../../../test/resources/pod_with_latest_tag.yaml",
stdinFile: "../../../../../test/resources/pod_with_latest_tag.yaml",
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
Summary: policyreportv1alpha2.PolicyReportSummary{
Pass: 1,
@ -137,7 +137,7 @@ func Test_Apply(t *testing.T) {
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"https://github.com/kyverno/policies/openshift/team-validate-ns-name/"},
ResourcePaths: []string{"../../../../test/openshift/team-validate-ns-name.yaml"},
ResourcePaths: []string{"../../../../../test/openshift/team-validate-ns-name.yaml"},
GitBranch: "main",
PolicyReport: true,
},
@ -152,8 +152,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/apply/policies-set"},
ResourcePaths: []string{"../../../../test/cli/apply/resources-set"},
PolicyPaths: []string{"../../../../../test/cli/apply/policies-set"},
ResourcePaths: []string{"../../../../../test/cli/apply/resources-set"},
Variables: []string{"request.operation=UPDATE"},
PolicyReport: true,
},
@ -168,8 +168,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployments-replica/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployments-replica/deployment1.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployments-replica/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployments-replica/deployment1.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -183,8 +183,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployments-replica/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployments-replica/deployment2.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployments-replica/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployments-replica/deployment2.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -198,8 +198,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/disallow-host-path/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/disallow-host-path/pod1.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/disallow-host-path/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/disallow-host-path/pod1.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -213,8 +213,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/disallow-host-path/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/disallow-host-path/pod2.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/disallow-host-path/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/disallow-host-path/pod2.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -228,8 +228,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployment-labels/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployment-labels/deployment1.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployment-labels/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployment-labels/deployment1.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -243,8 +243,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployment-labels/policy.yaml"},
ResourcePaths: []string{"../../../../test/cli/test-validating-admission-policy/check-deployment-labels/deployment2.yaml"},
PolicyPaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployment-labels/policy.yaml"},
ResourcePaths: []string{"../../../../../test/cli/test-validating-admission-policy/check-deployment-labels/deployment2.yaml"},
PolicyReport: true,
},
expectedPolicyReports: []policyreportv1alpha2.PolicyReport{{
@ -258,8 +258,8 @@ func Test_Apply(t *testing.T) {
}},
}, {
config: ApplyCommandConfig{
PolicyPaths: []string{"https://github.com/kyverno/policies/best-practices/require-labels/", "../../../../test/best_practices/disallow_latest_tag.yaml"},
ResourcePaths: []string{"../../../../test/resources/pod_with_version_tag.yaml"},
PolicyPaths: []string{"https://github.com/kyverno/policies/best-practices/require-labels/", "../../../../../test/best_practices/disallow_latest_tag.yaml"},
ResourcePaths: []string{"../../../../../test/resources/pod_with_version_tag.yaml"},
GitBranch: "main",
PolicyReport: true,
},
@ -275,8 +275,8 @@ func Test_Apply(t *testing.T) {
}, {
// Same as the above test case but the policy paths are reordered
config: ApplyCommandConfig{
PolicyPaths: []string{"../../../../test/best_practices/disallow_latest_tag.yaml", "https://github.com/kyverno/policies/best-practices/require-labels/"},
ResourcePaths: []string{"../../../../test/resources/pod_with_version_tag.yaml"},
PolicyPaths: []string{"../../../../../test/best_practices/disallow_latest_tag.yaml", "https://github.com/kyverno/policies/best-practices/require-labels/"},
ResourcePaths: []string{"../../../../../test/resources/pod_with_version_tag.yaml"},
GitBranch: "main",
PolicyReport: true,
},

View file

@ -0,0 +1,40 @@
package commands
import (
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/apply"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/docs"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/fix"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/jp"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/version"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/experimental"
"github.com/spf13/cobra"
)
func RootCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "kyverno",
Long: "To enable experimental commands, KYVERNO_EXPERIMENTAL should be configured with true or 1.",
Short: "Kubernetes Native Policy Management",
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
}
cmd.AddCommand(
apply.Command(),
create.Command(),
docs.Command(cmd),
jp.Command(),
test.Command(),
version.Command(),
)
if experimental.IsExperimentalEnabled() {
cmd.AddCommand(
fix.Command(),
oci.Command(),
)
}
return cmd
}

View file

@ -1,10 +1,10 @@
package create
import (
metricsconfig "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/metrics-config"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/test"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/userinfo"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/values"
metricsconfig "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/metrics-config"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/test"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/userinfo"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/values"
"github.com/spf13/cobra"
)

View file

@ -5,7 +5,7 @@ import (
"text/template"
"github.com/Masterminds/sprig/v3"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/templates"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/templates"
"github.com/spf13/cobra"
)

View file

@ -5,7 +5,7 @@ import (
"strings"
"text/template"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/templates"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/templates"
"github.com/spf13/cobra"
)

View file

@ -5,7 +5,7 @@ import (
"text/template"
"github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/templates"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/templates"
"github.com/spf13/cobra"
authenticationv1 "k8s.io/api/authentication/v1"
)

View file

@ -5,8 +5,8 @@ import (
"strings"
"text/template"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create/templates"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/create/templates"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/spf13/cobra"
)

View file

@ -1,7 +1,7 @@
package fix
import (
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/fix/test"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/fix/test"
"github.com/spf13/cobra"
)

View file

@ -3,9 +3,9 @@ package jp
import (
"strings"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/jp/function"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/jp/parse"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/jp/query"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/jp/function"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/jp/parse"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/jp/query"
"github.com/spf13/cobra"
)

View file

@ -8,8 +8,8 @@ import (
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/authn/github"
"github.com/google/go-containerregistry/pkg/v1/google"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/oci/pull"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/oci/push"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/pull"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/push"
"github.com/spf13/cobra"
)

View file

@ -11,7 +11,7 @@ import (
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/oci/internal"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/internal"
policyutils "github.com/kyverno/kyverno/pkg/utils/policy"
yamlutils "github.com/kyverno/kyverno/pkg/utils/yaml"
"github.com/spf13/cobra"

View file

@ -12,7 +12,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/static"
"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/oci/internal"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/internal"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common"
"github.com/kyverno/kyverno/pkg/config"
"github.com/kyverno/kyverno/pkg/openapi"

View file

@ -7,7 +7,7 @@ import (
"github.com/go-git/go-billy/v5"
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/color"
filterutils "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/filter"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/output/table"

View file

@ -6,7 +6,7 @@ import (
"testing"
"github.com/go-git/go-billy/v5/memfs"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common"
"gotest.tools/assert"
"sigs.k8s.io/yaml"
@ -20,7 +20,7 @@ func Test_selectResourcesForCheck(t *testing.T) {
expectedDuplicates int
expectedUnused int
}
baseTestDir := "../../../../test/cli/test-unit/selectResourcesForCheck/"
baseTestDir := "../../../../../test/cli/test-unit/selectResourcesForCheck/"
testcases := []*TestCase{
{

View file

@ -8,7 +8,7 @@ import (
"github.com/go-git/go-billy/v5"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/common"
filterutils "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/filter"
pathutils "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/path"

View file

@ -5,28 +5,15 @@ import (
"fmt"
"os"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/apply"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/create"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/docs"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/fix"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/jp"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/oci"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/experimental"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/version"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands"
"github.com/kyverno/kyverno/pkg/logging"
"github.com/spf13/cobra"
)
func main() {
cli := &cobra.Command{
Use: "kyverno",
Long: "To enable experimental commands, KYVERNO_EXPERIMENTAL should be configured with true or 1.",
Short: "Kubernetes Native Policy Management",
}
configureLogs(cli)
registerCommands(cli)
if err := cli.Execute(); err != nil {
cmd := commands.RootCommand()
configureLogs(cmd)
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}
@ -39,20 +26,3 @@ func configureLogs(cli *cobra.Command) {
}
cli.PersistentFlags().AddGoFlagSet(flag.CommandLine)
}
func registerCommands(cli *cobra.Command) {
cli.AddCommand(
apply.Command(),
create.Command(),
docs.Command(cli),
jp.Command(),
test.Command(),
version.Command(),
)
if experimental.IsExperimentalEnabled() {
cli.AddCommand(
fix.Command(),
oci.Command(),
)
}
}

View file

@ -14,7 +14,7 @@ import (
"github.com/go-git/go-billy/v5"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
annotationsutils "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/annotations"
sanitizederror "github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/sanitizedError"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/source"

View file

@ -4,7 +4,7 @@ import (
"testing"
"github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
yamlutils "github.com/kyverno/kyverno/pkg/utils/yaml"
"gotest.tools/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View file

@ -12,7 +12,7 @@ import (
"github.com/go-git/go-billy/v5"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/source"
"github.com/kyverno/kyverno/pkg/autogen"
"github.com/kyverno/kyverno/pkg/clients/dclient"

View file

@ -2,7 +2,7 @@ package common
import (
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/pkg/autogen"
"github.com/kyverno/kyverno/pkg/clients/dclient"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

View file

@ -1,7 +1,7 @@
package common
import (
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/pkg/clients/dclient"
"k8s.io/api/admissionregistration/v1alpha1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

View file

@ -8,7 +8,7 @@ import (
"github.com/go-git/go-billy/v5"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
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/cmd/cli/kubectl-kyverno/utils/values"

View file

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"github.com/kyverno/kyverno/pkg/utils/wildcard"
)

View file

@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
)
func Test_policy_Apply(t *testing.T) {

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"github.com/go-git/go-billy/v5"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"k8s.io/apimachinery/pkg/util/yaml"
)

View file

@ -6,7 +6,7 @@ import (
"testing"
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
)
func TestTestCases_Errors(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"os"
"github.com/go-git/go-billy/v5"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
"k8s.io/apimachinery/pkg/util/yaml"
)

View file

@ -6,7 +6,7 @@ import (
"testing"
"github.com/go-git/go-billy/v5"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/test/api"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/test/api"
)
func Test_readFile(t *testing.T) {

View file

@ -6,6 +6,10 @@ Kubernetes Native Policy Management
To enable experimental commands, KYVERNO_EXPERIMENTAL should be configured with true or 1.
```
kyverno [flags]
```
### Options
```