diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 8dc51396e6e..39697d557d9 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -144,8 +144,8 @@ rules: verbs: - create - nonResourceURLs: - - /apis/antctl.antrea.tanzu.vmware.com/v1 - - /apis/antctl.antrea.tanzu.vmware.com/v1/* + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1 + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1/* verbs: - get --- @@ -334,9 +334,9 @@ kind: APIService metadata: labels: app: antrea - name: v1.antctl.antrea.tanzu.vmware.com + name: v1.clusterinfo.antrea.tanzu.vmware.com spec: - group: antctl.antrea.tanzu.vmware.com + group: clusterinfo.antrea.tanzu.vmware.com groupPriorityMinimum: 1000 insecureSkipTLSVerify: true service: diff --git a/build/yamls/base/antctl.yml b/build/yamls/base/antctl.yml index 4e3f3e70f62..b8478422da8 100644 --- a/build/yamls/base/antctl.yml +++ b/build/yamls/base/antctl.yml @@ -10,8 +10,8 @@ metadata: name: antctl rules: - nonResourceURLs: - - /apis/antctl.antrea.tanzu.vmware.com/v1 - - /apis/antctl.antrea.tanzu.vmware.com/v1/* + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1 + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1/* verbs: - get --- diff --git a/build/yamls/base/controller-rbac.yml b/build/yamls/base/controller-rbac.yml index 89c89077791..7a1f55042e6 100644 --- a/build/yamls/base/controller-rbac.yml +++ b/build/yamls/base/controller-rbac.yml @@ -57,8 +57,8 @@ rules: verbs: - create - nonResourceURLs: - - /apis/antctl.antrea.tanzu.vmware.com/v1 - - /apis/antctl.antrea.tanzu.vmware.com/v1/* + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1 + - /apis/clusterinfo.antrea.tanzu.vmware.com/v1/* verbs: - get --- diff --git a/build/yamls/base/controller.yml b/build/yamls/base/controller.yml index bbb903bcd93..2492a69bc91 100644 --- a/build/yamls/base/controller.yml +++ b/build/yamls/base/controller.yml @@ -14,10 +14,10 @@ spec: apiVersion: apiregistration.k8s.io/v1 kind: APIService metadata: - name: v1.antctl.antrea.tanzu.vmware.com + name: v1.clusterinfo.antrea.tanzu.vmware.com spec: insecureSkipTLSVerify: true - group: antctl.antrea.tanzu.vmware.com + group: clusterinfo.antrea.tanzu.vmware.com groupPriorityMinimum: 1000 versionPriority: 15 service: diff --git a/pkg/antctl/commandbundle.go b/pkg/antctl/commandbundle.go index 0352c26bd66..52a61df90e6 100644 --- a/pkg/antctl/commandbundle.go +++ b/pkg/antctl/commandbundle.go @@ -104,13 +104,13 @@ func (b *CommandBundle) ApplyToRootCommand(root *cobra.Command, client *Client, func (b *CommandBundle) applyToRootCommand(root *cobra.Command, isAgent bool) { defaultPath := filepath.Join(homedir.HomeDir(), ".kube", "config") - root.PersistentFlags().BoolP("debug", "d", false, "enable debug mode") + root.PersistentFlags().BoolP("verbose", "v", false, "enable verbose output") root.PersistentFlags().StringP("kubeconfig", "k", defaultPath, "absolute path to the kubeconfig file") root.PersistentPreRun = func(cmd *cobra.Command, args []string) { - enableDebug, _ := root.PersistentFlags().GetBool("debug") - flag.Set("logtostderr", fmt.Sprint(enableDebug)) - flag.Set("alsologtostderr", fmt.Sprint(enableDebug)) - if enableDebug { + enableVerbose, _ := root.PersistentFlags().GetBool("verbose") + flag.Set("logtostderr", fmt.Sprint(enableVerbose)) + flag.Set("alsologtostderr", fmt.Sprint(enableVerbose)) + if enableVerbose { flag.Set("v", "0") } } diff --git a/pkg/antctl/commandbundle_test.go b/pkg/antctl/commandbundle_test.go index a701b844c4c..792d81c22a0 100644 --- a/pkg/antctl/commandbundle_test.go +++ b/pkg/antctl/commandbundle_test.go @@ -57,7 +57,7 @@ var TestBundle = &CommandBundle{ }, }, GroupVersion: &schema.GroupVersion{ - Group: "test-antctl.antrea.tanzu.vmware.com", + Group: "test-clusterinfo.antrea.tanzu.vmware.com", Version: "v1", }, } diff --git a/pkg/antctl/definitions.go b/pkg/antctl/definitions.go index 43aecb2ea79..97ced6cda14 100644 --- a/pkg/antctl/definitions.go +++ b/pkg/antctl/definitions.go @@ -28,8 +28,8 @@ import ( ) type VersionResponse struct { - handlers.ComponentVersionResponse - AntctlVersion string `json:"antctlVersion,omitempty" yaml:"antctlVersion,omitempty"` + handlers.ComponentVersionResponse `json:",inline" yaml:",inline"` + AntctlVersion string `json:"antctlVersion,omitempty" yaml:"antctlVersion,omitempty"` } func versionTransform(reader io.Reader, single bool) (interface{}, error) { @@ -65,6 +65,6 @@ var Definition = &CommandBundle{ AddonTransform: versionTransform, }, }, - GroupVersion: &schema.GroupVersion{Group: "antctl.antrea.tanzu.vmware.com", Version: "v1"}, + GroupVersion: &schema.GroupVersion{Group: "clusterinfo.antrea.tanzu.vmware.com", Version: "v1"}, Codec: scheme.Codecs, } diff --git a/test/e2e/antctl_test.go b/test/e2e/antctl_test.go index ef4b213ae92..69763378dd3 100644 --- a/test/e2e/antctl_test.go +++ b/test/e2e/antctl_test.go @@ -9,8 +9,8 @@ import ( ) func antctlOutput(stdout, stderr string, tb testing.TB) { - tb.Logf("`antctl version` stdout:\n%s", stdout) - tb.Logf("`antctl version` stderr:\n%s", stderr) + tb.Logf("antctl stdout:\n%s", stdout) + tb.Logf("antctl stderr:\n%s", stderr) } func runAntctl(podName string, subCmds []string, data *TestData, tb testing.TB) (string, string, error) { @@ -21,7 +21,7 @@ func runAntctl(podName string, subCmds []string, data *TestData, tb testing.TB) containerName = "antrea-controller" } - cmds := []string{"antctl", "-d"} + cmds := []string{"antctl", "-v"} stdout, stderr, err := data.runCommandFromPod(AntreaNamespace, podName, containerName, append(cmds, subCmds...)) antctlOutput(stdout, stderr, tb) @@ -72,7 +72,7 @@ func TestAntctlControllerRemoteAccess(t *testing.T) { _, _, _, err = RunCommandOnNode(masterNodeName(), cmd) assert.Nil(t, err, "Error when copying antctl from %s", podName) - _, stdout, stderr, err := RunCommandOnNode(masterNodeName(), "~/antctl -d version") + _, stdout, stderr, err := RunCommandOnNode(masterNodeName(), "~/antctl -v version") antctlOutput(stdout, stderr, t) if err != nil { t.Fatalf("Error when running `antctl version` from %s: %v", masterNodeName(), err) @@ -92,10 +92,10 @@ func TestAntctlDebugMode(t *testing.T) { commands []string }{ {name: "RootNonDebug", hasStderr: false, commands: []string{"antctl"}}, - {name: "RootDebug", hasStderr: false, commands: []string{"antctl", "-d"}}, + {name: "RootDebug", hasStderr: false, commands: []string{"antctl", "-v"}}, {name: "CommandNonDebug", hasStderr: false, commands: []string{"antctl", "version"}}, - {name: "CommandDebug", hasStderr: true, commands: []string{"antctl", "-d", "version"}}, - {name: "CommandDebug", hasStderr: true, commands: []string{"antctl", "version", "-d"}}, + {name: "CommandDebug", hasStderr: true, commands: []string{"antctl", "-v", "version"}}, + {name: "CommandDebug", hasStderr: true, commands: []string{"antctl", "version", "-v"}}, } { t.Run(tc.name, func(t *testing.T) { podName, err := data.getAntreaController()