Fix typo: Rename 'CommoOpts' to 'CommonOpts' (#523)

Signed-off-by: ohkinozomu <nozomunoise@gmail.com>
This commit is contained in:
Ohki Nozomu
2024-06-17 11:21:10 +09:00
committed by GitHub
parent 565af66103
commit 1227b71043
4 changed files with 10 additions and 10 deletions

View File

@@ -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())

View File

@@ -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()...)

View File

@@ -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

View File

@@ -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
}