Skip to content

Commit

Permalink
fix: fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Liang Deng <[email protected]>
  • Loading branch information
YTGhost committed Oct 7, 2023
1 parent 10609e6 commit f3a0dea
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/admiralctl/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var (

// NewCmdMigrate defines the `migrate` command that migrate resources from legacy clusters
func NewCmdMigrate(f util.Factory, parentCommand string) *cobra.Command {
opts := CommandmigrateOption{}
opts := CommandMigrateOption{}
opts.JSONYamlPrintFlags = genericclioptions.NewJSONYamlPrintFlags()

cmd := &cobra.Command{
Expand Down Expand Up @@ -114,8 +114,8 @@ func NewCmdMigrate(f util.Factory, parentCommand string) *cobra.Command {
return cmd
}

// CommandmigrateOption holds all command options for migrate
type CommandmigrateOption struct {
// CommandMigrateOption holds all command options for migrate
type CommandMigrateOption struct {
// Cluster is the name of legacy cluster
Cluster string

Expand Down Expand Up @@ -156,7 +156,7 @@ type CommandmigrateOption struct {
}

// AddFlags adds flags to the specified FlagSet.
func (o *CommandmigrateOption) AddFlags(flags *pflag.FlagSet) {
func (o *CommandMigrateOption) AddFlags(flags *pflag.FlagSet) {
flags.BoolVar(&o.AutoCreatePolicy, "auto-create-policy", true,
"Automatically create a PropagationPolicy for namespace-scoped resources or "+
"create a ClusterPropagationPolicy for cluster-scoped resources.")
Expand All @@ -176,7 +176,7 @@ func (o *CommandmigrateOption) AddFlags(flags *pflag.FlagSet) {
}

// Preflight ensures that options are valid and marshals them if necessary
func (o *CommandmigrateOption) Preflight(f util.Factory, args []string) error {
func (o *CommandMigrateOption) Preflight(f util.Factory, args []string) error {
var err error

if len(args) != 2 {
Expand Down Expand Up @@ -232,7 +232,7 @@ func (o *CommandmigrateOption) Preflight(f util.Factory, args []string) error {
}

// Run migrate resources from legacy clusters
func (o *CommandmigrateOption) Run(f util.Factory, args []string) error {
func (o *CommandMigrateOption) Run(f util.Factory, args []string) error {
var memberClusterFactory cmdutil.Factory
var err error

Expand Down Expand Up @@ -268,7 +268,7 @@ func (o *CommandmigrateOption) Run(f util.Factory, args []string) error {
return o.migrate(controlPlaneRestConfig, obj, gvr)
}

func (o *CommandmigrateOption) migrate(controlPlaneRestConfig *rest.Config, obj *unstructured.Unstructured,
func (o *CommandMigrateOption) migrate(controlPlaneRestConfig *rest.Config, obj *unstructured.Unstructured,
gvr schema.GroupVersionResource,
) error {
if err := preprocessResource(obj); err != nil {
Expand All @@ -277,7 +277,7 @@ func (o *CommandmigrateOption) migrate(controlPlaneRestConfig *rest.Config, obj

if o.OutputFormat != "" {
// only print the resource template and Policy
err := o.printObjectAndPolicy(obj, gvr)
err := o.printObjectAndPolicy(obj)

return err
}
Expand Down Expand Up @@ -393,7 +393,7 @@ type Obj struct {
}

// getObjInfo get obj info in member cluster
func (o *CommandmigrateOption) getObjInfo(f cmdutil.Factory, cluster string, args []string) (*Obj, error) {
func (o *CommandMigrateOption) getObjInfo(f cmdutil.Factory, cluster string, args []string) (*Obj, error) {
r := f.NewBuilder().
Unstructured().
NamespaceParam(o.Namespace).
Expand Down Expand Up @@ -425,7 +425,7 @@ func (o *CommandmigrateOption) getObjInfo(f cmdutil.Factory, cluster string, arg
}

// printObjectAndPolicy print the converted resource
func (o *CommandmigrateOption) printObjectAndPolicy(obj *unstructured.Unstructured, gvr schema.GroupVersionResource) error {
func (o *CommandMigrateOption) printObjectAndPolicy(obj *unstructured.Unstructured) error {
printer, err := o.Printer(nil, nil, false, false)
if err != nil {
return fmt.Errorf("failed to initialize k8s printer. err: %w", err)
Expand Down Expand Up @@ -458,7 +458,7 @@ func (o *CommandmigrateOption) printObjectAndPolicy(obj *unstructured.Unstructur
}

// createPropagationPolicy create PropagationPolicy in Kubeadmiral control plane
func (o *CommandmigrateOption) createPropagationPolicy(kubeadmiralClient *fedclient.Clientset) (string, error) {
func (o *CommandMigrateOption) createPropagationPolicy(kubeadmiralClient *fedclient.Clientset) (string, error) {
var policyName string
if o.PolicyName == "" {
policyName = names.GeneratePolicyName(o.Namespace, o.name, o.gvk.String())
Expand All @@ -482,7 +482,7 @@ func (o *CommandmigrateOption) createPropagationPolicy(kubeadmiralClient *fedcli
}

// createClusterPropagationPolicy create ClusterPropagationPolicy in Kubeadmiral control plane
func (o *CommandmigrateOption) createClusterPropagationPolicy(kubeadmiralClient *fedclient.Clientset) (string, error) {
func (o *CommandMigrateOption) createClusterPropagationPolicy(kubeadmiralClient *fedclient.Clientset) (string, error) {
var policyName string
if o.PolicyName == "" {
policyName = names.GeneratePolicyName("", o.name, o.gvk.String())
Expand Down

0 comments on commit f3a0dea

Please sign in to comment.