Skip to content
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

remove unused flag for karmadactl promote #2193

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pkg/karmadactl/promote.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ type CommandPromoteOption struct {
// Cluster is the name of legacy cluster
Cluster string

// ClusterNamespace holds the namespace name where the member cluster secrets are stored.
ClusterNamespace string

// Namespace is the namespace of legacy resource
Namespace string

Expand Down Expand Up @@ -129,7 +126,6 @@ func (o *CommandPromoteOption) AddFlags(flags *pflag.FlagSet) {

flags.StringVarP(&o.Namespace, "namespace", "n", "default", "-n=namespace or -n namespace")
flags.StringVarP(&o.Cluster, "cluster", "C", "", "the name of legacy cluster (eg -C=member1)")
flags.StringVar(&o.ClusterNamespace, "cluster-namespace", options.DefaultKarmadaClusterNamespace, "Namespace in the control plane where member cluster secrets are stored.")
flags.StringVar(&o.ClusterContext, "cluster-context", "",
"Context name of legacy cluster in kubeconfig. Only works when there are multiple contexts in the kubeconfig.")
flags.StringVar(&o.ClusterKubeConfig, "cluster-kubeconfig", "",
Expand Down
22 changes: 8 additions & 14 deletions test/e2e/karmadactl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {
// Step 2, promote namespace used by the deployment from member1 to karmada
ginkgo.By(fmt.Sprintf("Promoting namespace %s from member: %s to karmada control plane", deploymentNamespace, member1), func() {
namespaceOpts = karmadactl.CommandPromoteOption{
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Cluster: member1,
}
args := []string{"namespace", deploymentNamespace}
// init args: place namespace name to CommandPromoteOption.name
Expand All @@ -102,9 +101,8 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {
// Step 3, promote deployment from cluster member1 to karmada
ginkgo.By(fmt.Sprintf("Promoting deployment %s from member: %s to karmada", deploymentName, member1), func() {
deploymentOpts = karmadactl.CommandPromoteOption{
Namespace: deploymentNamespace,
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Namespace: deploymentNamespace,
Cluster: member1,
}
args := []string{"deployment", deploymentName}
// init args: place deployment name to CommandPromoteOption.name
Expand Down Expand Up @@ -192,8 +190,7 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {
// Step2, promote clusterrole and clusterrolebinding from member1
ginkgo.By(fmt.Sprintf("Promoting clusterrole %s and clusterrolebindings %s from member to karmada", clusterRoleName, clusterRoleBindingName), func() {
clusterRoleOpts = karmadactl.CommandPromoteOption{
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Cluster: member1,
}

args := []string{"clusterrole", clusterRoleName}
Expand All @@ -206,8 +203,7 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())

clusterRoleBindingOpts = karmadactl.CommandPromoteOption{
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Cluster: member1,
}

args = []string{"clusterrolebinding", clusterRoleBindingName}
Expand Down Expand Up @@ -259,8 +255,7 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {

ginkgo.By(fmt.Sprintf("Promoting namespace %s from member: %s to karmada control plane", serviceNamespace, member1), func() {
opts := karmadactl.CommandPromoteOption{
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Cluster: member1,
}
args := []string{"namespace", serviceNamespace}
err := opts.Complete(args)
Expand All @@ -274,9 +269,8 @@ var _ = ginkgo.Describe("Karmadactl promote testing", func() {

ginkgo.By(fmt.Sprintf("Promoting service %s from member: %s to karmada control plane", serviceName, member1), func() {
opts := karmadactl.CommandPromoteOption{
Namespace: serviceNamespace,
Cluster: member1,
ClusterNamespace: options.DefaultKarmadaClusterNamespace,
Namespace: serviceNamespace,
Cluster: member1,
}
args := []string{"service", serviceName}
err := opts.Complete(args)
Expand Down