rename host-as-* to karmada-as-*

Signed-off-by: Michael Grosser <michael@grosser.it>
This commit is contained in:
Michael Grosser 2024-06-25 18:50:13 -07:00
parent 1255a08f5d
commit b30210f303
No known key found for this signature in database
GPG Key ID: B19DB1587D698ED7
1 changed files with 15 additions and 15 deletions

View File

@ -107,14 +107,14 @@ type CommandJoinOption struct {
// more details about running Kubernetes in multiple zones. // more details about running Kubernetes in multiple zones.
ClusterZones []string ClusterZones []string
// HostAs represents the host cluster username to impersonate for the operation. User could be a regular user or a service account in a namespace // KarmadaAs represents the username to impersonate for the operation in karmada control plane. User could be a regular user or a service account in a namespace
HostAs string KarmadaAs string
// HostAsGroups represents the host cluster group to impersonate for the operation, this flag can be repeated to specify multiple groups // KarmadaAsGroups represents groups to impersonate for the operation in karmada control plane, this flag can be repeated to specify multiple groups
HostAsGroups []string KarmadaAsGroups []string
// HostAsUID represents the host cluster UID to impersonate for the operation. // KarmadaAsUID represents the UID to impersonate for the operation in karmada control plane.
HostAsUID string KarmadaAsUID string
// DryRun tells if run the command in dry-run mode, without making any server requests. // DryRun tells if run the command in dry-run mode, without making any server requests.
DryRun bool DryRun bool
@ -159,12 +159,12 @@ func (j *CommandJoinOption) AddFlags(flags *pflag.FlagSet) {
flags.StringVar(&j.ClusterProvider, "cluster-provider", "", "Provider of the joining cluster. The Karmada scheduler can use this information to spread workloads across providers for higher availability.") flags.StringVar(&j.ClusterProvider, "cluster-provider", "", "Provider of the joining cluster. The Karmada scheduler can use this information to spread workloads across providers for higher availability.")
flags.StringVar(&j.ClusterRegion, "cluster-region", "", "The region of the joining cluster. The Karmada scheduler can use this information to spread workloads across regions for higher availability.") flags.StringVar(&j.ClusterRegion, "cluster-region", "", "The region of the joining cluster. The Karmada scheduler can use this information to spread workloads across regions for higher availability.")
flags.StringSliceVar(&j.ClusterZones, "cluster-zones", nil, "The zones of the joining cluster. The Karmada scheduler can use this information to spread workloads across zones for higher availability.") flags.StringSliceVar(&j.ClusterZones, "cluster-zones", nil, "The zones of the joining cluster. The Karmada scheduler can use this information to spread workloads across zones for higher availability.")
flags.StringVar(&j.HostAs, "host-as", "", flags.StringVar(&j.KarmadaAs, "karmada-as", "",
"Host cluster username to impersonate for the operation. User could be a regular user or a service account in a namespace.") "Username to impersonate for the operation in karmada control plane. User could be a regular user or a service account in a namespace.")
flags.StringArrayVar(&j.HostAsGroups, "host-as-group", []string{}, flags.StringArrayVar(&j.KarmadaAsGroups, "karmada-as-group", []string{},
"Host cluster group to impersonate for the operation, this flag can be repeated to specify multiple groups.") "Group to impersonate for the operation in karmada control plane, this flag can be repeated to specify multiple groups.")
flags.StringVar(&j.HostAsUID, "host-as-uid", "", flags.StringVar(&j.KarmadaAsUID, "karmada-as-uid", "",
"Host cluster UID to impersonate for the operation.") "UID to impersonate for the operation in karmada control plane.")
flags.BoolVar(&j.DryRun, "dry-run", false, "Run the command in dry-run mode, without making any server requests.") flags.BoolVar(&j.DryRun, "dry-run", false, "Run the command in dry-run mode, without making any server requests.")
} }
@ -181,9 +181,9 @@ func (j *CommandJoinOption) Run(f cmdutil.Factory) error {
} }
// Configure impersonation // Configure impersonation
controlPlaneRestConfig.Impersonate.UserName = j.HostAs controlPlaneRestConfig.Impersonate.UserName = j.KarmadaAs
controlPlaneRestConfig.Impersonate.Groups = j.HostAsGroups controlPlaneRestConfig.Impersonate.Groups = j.KarmadaAsGroups
controlPlaneRestConfig.Impersonate.UID = j.HostAsUID controlPlaneRestConfig.Impersonate.UID = j.KarmadaAsUID
// Get cluster config // Get cluster config
clusterConfig, err := apiclient.RestConfig(j.ClusterContext, j.ClusterKubeConfig) clusterConfig, err := apiclient.RestConfig(j.ClusterContext, j.ClusterKubeConfig)