karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.42k stars 875 forks source link

[GoodFirst] fix `--cluster-namespace` misleading description #1166

Closed RainbowMango closed 2 years ago

RainbowMango commented 2 years ago

Task description: The description of --cluster-namespace for join command is misleading as the namespace not used to store Cluster objects but the secrets.

# kubectl-karmada join --help 
...
Flags:
...
      --cluster-namespace string    Namespace in the control plane where member cluster are stored. (default "karmada-cluster")

Solution: An alternative is:

diff --git a/pkg/karmadactl/join.go b/pkg/karmadactl/join.go
index acdb3137..937c21c8 100644
--- a/pkg/karmadactl/join.go
+++ b/pkg/karmadactl/join.go
@@ -136,7 +136,7 @@ func (j *CommandJoinOption) Validate() error {
 func (j *CommandJoinOption) AddFlags(flags *pflag.FlagSet) {
        j.GlobalCommandOptions.AddFlags(flags)

-       flags.StringVar(&j.ClusterNamespace, "cluster-namespace", options.DefaultKarmadaClusterNamespace, "Namespace in the control plane where member cluster are stored.")
+       flags.StringVar(&j.ClusterNamespace, "cluster-namespace", options.DefaultKarmadaClusterNamespace, "Namespace in the control plane where member cluster secrets are stored.")

        flags.StringVar(&j.ClusterContext, "cluster-context", "",
                "Context name of cluster in kubeconfig. Only works when there are multiple contexts in the kubeconfig.")
diff --git a/pkg/karmadactl/options/global.go b/pkg/karmadactl/options/global.go
index b1d8902b..6eeb0dca 100644
--- a/pkg/karmadactl/options/global.go
+++ b/pkg/karmadactl/options/global.go
@@ -6,8 +6,7 @@ import (
        "github.com/spf13/pflag"
 )

-// DefaultKarmadaClusterNamespace defines the default namespace where the member cluster objects are stored.
-// The secret owns by cluster objects will be stored in the namespace too.
+// DefaultKarmadaClusterNamespace defines the default namespace where the member cluster secrets are stored.
 const DefaultKarmadaClusterNamespace = "karmada-cluster"

 // DefaultKarmadactlCommandDuration defines the default timeout for karmadactl execute

Who can join or take the task:

The good first issue is intended for first-time contributors to get started on his/her contributor journey.

After a contributor has successfully completed 1-2 good first issue's, they should be ready to move on to help wanted items, saving the remaining good first issue for other new contributors.

How to join or take the task:

Just reply on the issue with the message /assign in a separate line.

Then, the issue will be assigned to you.

How to ask for help:

If you need help or have questions, please feel free to ask on this issue. The issue author or other members of the community will guide you through the contribution process.

liangyongzhenya commented 2 years ago

/assign

RainbowMango commented 2 years ago

Thanks @liangyongzhenya .