From 1227b7104312bbdac11a26afddf684b357c6d9ce Mon Sep 17 00:00:00 2001 From: Ohki Nozomu Date: Mon, 17 Jun 2024 11:21:10 +0900 Subject: [PATCH] Fix typo: Rename 'CommoOpts' to 'CommonOpts' (#523) Signed-off-by: ohkinozomu --- pkg/cmd/spoke/operator.go | 2 +- pkg/cmd/spoke/registration.go | 2 +- pkg/cmd/spoke/work.go | 2 +- pkg/common/options/agent.go | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/cmd/spoke/operator.go b/pkg/cmd/spoke/operator.go index f6d2e594c..13c2012c8 100644 --- a/pkg/cmd/spoke/operator.go +++ b/pkg/cmd/spoke/operator.go @@ -60,7 +60,7 @@ func NewKlusterletAgentCmd() *cobra.Command { registrationOption := registration.NewSpokeAgentOptions() agentConfig := singletonspoke.NewAgentConfig(commonOptions, registrationOption, workOptions) - cmdConfig := commonOptions.CommoOpts. + cmdConfig := commonOptions.CommonOpts. NewControllerCommandConfig("klusterlet", version.Get(), agentConfig.RunSpokeAgent). WithHealthChecks(registrationOption.GetHealthCheckers()...) cmd := cmdConfig.NewCommandWithContext(context.TODO()) diff --git a/pkg/cmd/spoke/registration.go b/pkg/cmd/spoke/registration.go index f53558029..f02748f34 100644 --- a/pkg/cmd/spoke/registration.go +++ b/pkg/cmd/spoke/registration.go @@ -18,7 +18,7 @@ func NewRegistrationAgent() *cobra.Command { agentOptions := spoke.NewSpokeAgentOptions() commonOptions := commonoptions.NewAgentOptions() cfg := spoke.NewSpokeAgentConfig(commonOptions, agentOptions) - cmdConfig := commonOptions.CommoOpts. + cmdConfig := commonOptions.CommonOpts. NewControllerCommandConfig("registration-agent", version.Get(), cfg.RunSpokeAgent). WithHealthChecks(agentOptions.GetHealthCheckers()...) diff --git a/pkg/cmd/spoke/work.go b/pkg/cmd/spoke/work.go index fb29c9efd..b2e18e04c 100644 --- a/pkg/cmd/spoke/work.go +++ b/pkg/cmd/spoke/work.go @@ -19,7 +19,7 @@ func NewWorkAgent() *cobra.Command { commonOptions := commonoptions.NewAgentOptions() agentOption := spoke.NewWorkloadAgentOptions() cfg := spoke.NewWorkAgentConfig(commonOptions, agentOption) - cmdConfig := commonOptions.CommoOpts. + cmdConfig := commonOptions.CommonOpts. NewControllerCommandConfig("work-agent", version.Get(), cfg.RunWorkloadAgent) cmd := cmdConfig.NewCommandWithContext(context.TODO()) cmd.Use = agentCmdName diff --git a/pkg/common/options/agent.go b/pkg/common/options/agent.go index 27dba37b9..260292c8e 100644 --- a/pkg/common/options/agent.go +++ b/pkg/common/options/agent.go @@ -27,7 +27,7 @@ const ( // AgentOptions is the common agent options type AgentOptions struct { - CommoOpts *Options + CommonOpts *Options ComponentNamespace string SpokeKubeconfigFile string SpokeClusterName string @@ -41,7 +41,7 @@ func NewAgentOptions() *AgentOptions { opts := &AgentOptions{ HubKubeconfigDir: "/spoke/hub-kubeconfig", ComponentNamespace: defaultSpokeComponentNamespace, - CommoOpts: NewOptions(), + CommonOpts: NewOptions(), } // get component namespace of spoke agent nsBytes, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") @@ -52,7 +52,7 @@ func NewAgentOptions() *AgentOptions { } func (o *AgentOptions) AddFlags(flags *pflag.FlagSet) { - o.CommoOpts.AddFlags(flags) + o.CommonOpts.AddFlags(flags) flags.StringVar(&o.SpokeKubeconfigFile, "spoke-kubeconfig", o.SpokeKubeconfigFile, "Location of kubeconfig file to connect to spoke cluster. If this is not set, will use '--kubeconfig' to build client to connect to the managed cluster.") flags.StringVar(&o.SpokeClusterName, "spoke-cluster-name", o.SpokeClusterName, "Name of the spoke cluster.") @@ -68,8 +68,8 @@ func (o *AgentOptions) AddFlags(flags *pflag.FlagSet) { // SpokeKubeConfig builds kubeconfig for the spoke/managed cluster func (o *AgentOptions) SpokeKubeConfig(managedRestConfig *rest.Config) (*rest.Config, error) { if o.SpokeKubeconfigFile == "" { - managedRestConfig.QPS = o.CommoOpts.QPS - managedRestConfig.Burst = o.CommoOpts.Burst + managedRestConfig.QPS = o.CommonOpts.QPS + managedRestConfig.Burst = o.CommonOpts.Burst return managedRestConfig, nil } @@ -77,8 +77,8 @@ func (o *AgentOptions) SpokeKubeConfig(managedRestConfig *rest.Config) (*rest.Co if err != nil { return nil, fmt.Errorf("unable to load spoke kubeconfig from file %q: %w", o.SpokeKubeconfigFile, err) } - spokeRestConfig.QPS = o.CommoOpts.QPS - spokeRestConfig.Burst = o.CommoOpts.Burst + spokeRestConfig.QPS = o.CommonOpts.QPS + spokeRestConfig.Burst = o.CommonOpts.Burst return spokeRestConfig, nil }