From c8423cb2375f5c6bba70b2dc47f41c752d9d74bc Mon Sep 17 00:00:00 2001 From: whitewindmills Date: Fri, 1 Sep 2023 17:21:09 +0800 Subject: [PATCH] fix spelling errors Signed-off-by: whitewindmills --- .../app/controllermanager.go | 2 +- docs/proposals/service-discovery/README.md | 2 +- operator/pkg/certs/store.go | 12 +++++----- operator/pkg/constants/constants.go | 2 +- operator/pkg/tasks/init/cert.go | 2 +- operator/pkg/tasks/init/etcd.go | 2 +- operator/pkg/tasks/init/karmadaresource.go | 6 ++--- operator/pkg/tasks/init/upload.go | 2 +- operator/pkg/tasks/init/wait.go | 8 +++---- operator/pkg/util/apiclient/idempotency.go | 2 +- operator/pkg/util/apiclient/wait.go | 6 ++--- operator/pkg/util/patcher/pather.go | 6 ++--- operator/pkg/util/util.go | 4 ++-- .../cluster/v1alpha1/well_known_constants.go | 2 +- .../federatedhpa/federatedhpa_controller.go | 4 ++-- .../status/work_status_controller_test.go | 20 ++++++++-------- pkg/karmadactl/addons/disable.go | 2 +- pkg/karmadactl/addons/enable.go | 2 +- pkg/karmadactl/addons/init/global.go | 2 +- pkg/karmadactl/addons/list.go | 2 +- pkg/karmadactl/cmdinit/karmada/deploy.go | 4 ++-- pkg/karmadactl/cmdinit/utils/util_test.go | 24 +++++++++---------- pkg/karmadactl/exec/exec.go | 2 +- pkg/karmadactl/get/get.go | 2 +- pkg/karmadactl/register/register.go | 10 ++++---- pkg/karmadactl/util/factory.go | 4 ++-- pkg/modeling/modeling.go | 12 +++++----- .../default/native/healthy_test.go | 2 +- .../core/spreadconstraint/group_clusters.go | 4 ++-- pkg/search/backendstore/defaultstore.go | 8 +++---- pkg/util/cluster.go | 2 +- pkg/util/helper/work_test.go | 2 +- pkg/util/interpreter/rule_test.go | 2 +- 33 files changed, 84 insertions(+), 84 deletions(-) diff --git a/cmd/controller-manager/app/controllermanager.go b/cmd/controller-manager/app/controllermanager.go index 854f4928be11..f8cd45e16a0c 100644 --- a/cmd/controller-manager/app/controllermanager.go +++ b/cmd/controller-manager/app/controllermanager.go @@ -566,7 +566,7 @@ func startFederatedHorizontalPodAutoscalerController(ctx controllerscontext.Cont EventRecorder: ctx.Mgr.GetEventRecorderFor(federatedhpa.ControllerName), RESTMapper: ctx.Mgr.GetRESTMapper(), DownscaleStabilisationWindow: ctx.Opts.HPAControllerConfiguration.HorizontalPodAutoscalerDownscaleStabilizationWindow.Duration, - HorizontalPodAutoscalerSyncPeroid: ctx.Opts.HPAControllerConfiguration.HorizontalPodAutoscalerSyncPeriod.Duration, + HorizontalPodAutoscalerSyncPeriod: ctx.Opts.HPAControllerConfiguration.HorizontalPodAutoscalerSyncPeriod.Duration, ReplicaCalc: replicaCalculator, ClusterScaleClientSetFunc: util.NewClusterScaleClientSet, TypedInformerManager: typedmanager.GetInstance(), diff --git a/docs/proposals/service-discovery/README.md b/docs/proposals/service-discovery/README.md index a07af1456126..020d47f5ca4a 100644 --- a/docs/proposals/service-discovery/README.md +++ b/docs/proposals/service-discovery/README.md @@ -165,7 +165,7 @@ The optimization design for the MultiClusterService API needs to be further iter Before delving into the specific design details, let's first take a look from the user's perspective at what preparations they need to make. -1. The user creates a foo Deployment and Service on the Karmad control panel, and creates a PropagationPolicy to distribute them into the member cluster member1. +1. The user creates a foo Deployment and Service on the Karmada control panel, and creates a PropagationPolicy to distribute them into the member cluster member1. ![image](statics/user-operation-01.png) diff --git a/operator/pkg/certs/store.go b/operator/pkg/certs/store.go index ffb4d85d0b61..d11d5fa15bee 100644 --- a/operator/pkg/certs/store.go +++ b/operator/pkg/certs/store.go @@ -13,7 +13,7 @@ type CertStore interface { AddCert(cert *KarmadaCert) GetCert(name string) *KarmadaCert CertList() []*KarmadaCert - LoadCertFormSercret(sercret *corev1.Secret) error + LoadCertFromSecret(secret *corev1.Secret) error } type splitToPairNameFunc func(name string) string @@ -65,7 +65,7 @@ func (store *KarmadaCertStore) GetCert(name string) *KarmadaCert { return nil } -// CertList lists all of karmada certs in the cert chache. +// CertList lists all of karmada certs in the cert cache. func (store *KarmadaCertStore) CertList() []*KarmadaCert { certs := make([]*KarmadaCert, 0, len(store.certs)) @@ -76,15 +76,15 @@ func (store *KarmadaCertStore) CertList() []*KarmadaCert { return certs } -// LoadCertFormSercret loads a set of certs form k8s secret resource. we get cert +// LoadCertFromSecret loads a set of certs form k8s secret resource. we get cert // cache key by calling the pairNameFunc function. if the secret data key suffix is ".crt", // it be considered cert data. if the suffix is ".key", it be considered cert key data. -func (store *KarmadaCertStore) LoadCertFormSercret(sercret *corev1.Secret) error { - if len(sercret.Data) == 0 { +func (store *KarmadaCertStore) LoadCertFromSecret(secret *corev1.Secret) error { + if len(secret.Data) == 0 { return fmt.Errorf("cert data is empty") } - for name, data := range sercret.Data { + for name, data := range secret.Data { pairName := store.pairNameFunc(name) kc := store.GetCert(pairName) if kc == nil { diff --git a/operator/pkg/constants/constants.go b/operator/pkg/constants/constants.go index 5313b1bc252f..3bbd5c406f05 100644 --- a/operator/pkg/constants/constants.go +++ b/operator/pkg/constants/constants.go @@ -105,7 +105,7 @@ const ( // KarmadaOperatorLabelKeyName defines a label key used by all resources created by karmada operator KarmadaOperatorLabelKeyName = "app.kubernetes.io/managed-by" - // APIServiceName defines the karmada aggregated apiserver APISerivce resource name. + // APIServiceName defines the karmada aggregated apiserver APIService resource name. APIServiceName = "v1alpha1.cluster.karmada.io" ) diff --git a/operator/pkg/tasks/init/cert.go b/operator/pkg/tasks/init/cert.go index d273a789fbc4..7898fe06a6cd 100644 --- a/operator/pkg/tasks/init/cert.go +++ b/operator/pkg/tasks/init/cert.go @@ -46,7 +46,7 @@ func skipCerts(d workflow.RunData) (bool, error) { return false, nil } - if err := data.LoadCertFormSercret(secret); err != nil { + if err := data.LoadCertFromSecret(secret); err != nil { return false, err } diff --git a/operator/pkg/tasks/init/etcd.go b/operator/pkg/tasks/init/etcd.go index 59ce284ec3af..328e5a41aaf1 100644 --- a/operator/pkg/tasks/init/etcd.go +++ b/operator/pkg/tasks/init/etcd.go @@ -53,7 +53,7 @@ func runDeployEtcd(r workflow.RunData) error { } if cfg.Etcd.Local == nil { - return errors.New("unexpect empty etcd local configuration") + return errors.New("unexpected empty etcd local configuration") } err := etcd.EnsureKarmadaEtcd(data.RemoteClient(), cfg.Etcd.Local, data.GetName(), data.GetNamespace()) diff --git a/operator/pkg/tasks/init/karmadaresource.go b/operator/pkg/tasks/init/karmadaresource.go index 901df91a187f..fbfe29404d28 100644 --- a/operator/pkg/tasks/init/karmadaresource.go +++ b/operator/pkg/tasks/init/karmadaresource.go @@ -102,7 +102,7 @@ func runCrds(r workflow.RunData) error { cert := data.GetCert(constants.CaCertAndKeyName) if len(cert.CertData()) == 0 { - return errors.New("unexpect empty ca cert data") + return errors.New("unexpected empty ca cert data") } caBase64 := base64.StdEncoding.EncodeToString(cert.CertData()) @@ -149,7 +149,7 @@ func patchCrds(crdsClient *crdsclient.Clientset, patchPath string, caBundle stri } crdPath := path.Join(patchPath, file.Name()) - crdBytes, err := util.RelpaceYamlForReg(crdPath, caBundle, reg) + crdBytes, err := util.ReplaceYamlForReg(crdPath, caBundle, reg) if err != nil { return err } @@ -171,7 +171,7 @@ func runWebhookConfiguration(r workflow.RunData) error { cert := data.GetCert(constants.CaCertAndKeyName) if len(cert.CertData()) == 0 { - return errors.New("unexpect empty ca cert data for webhookConfiguration") + return errors.New("unexpected empty ca cert data for webhookConfiguration") } caBase64 := base64.StdEncoding.EncodeToString(cert.CertData()) diff --git a/operator/pkg/tasks/init/upload.go b/operator/pkg/tasks/init/upload.go index 0eef189bd1c1..8e76bbc170de 100644 --- a/operator/pkg/tasks/init/upload.go +++ b/operator/pkg/tasks/init/upload.go @@ -168,7 +168,7 @@ func runUploadCerts(r workflow.RunData) error { klog.V(4).InfoS("[upload-certs] Running upload-certs task", "karmada", klog.KObj(data)) if len(data.CertList()) == 0 { - return errors.New("there is no certs in store, please reload crets to store") + return errors.New("there is no certs in store, please reload certs to store") } return nil } diff --git a/operator/pkg/tasks/init/wait.go b/operator/pkg/tasks/init/wait.go index c52b642008ac..8a92f28cd88d 100644 --- a/operator/pkg/tasks/init/wait.go +++ b/operator/pkg/tasks/init/wait.go @@ -78,14 +78,14 @@ func runWaitControlPlane(r workflow.RunData) error { return nil } -func newWaitControlPlaneSubTask(component string, lables labels.Set) workflow.Task { +func newWaitControlPlaneSubTask(component string, ls labels.Set) workflow.Task { return workflow.Task{ Name: component, - Run: runWaitControlPlaneSubTask(component, lables), + Run: runWaitControlPlaneSubTask(component, ls), } } -func runWaitControlPlaneSubTask(component string, lables labels.Set) func(r workflow.RunData) error { +func runWaitControlPlaneSubTask(component string, ls labels.Set) func(r workflow.RunData) error { return func(r workflow.RunData) error { data, ok := r.(InitData) if !ok { @@ -93,7 +93,7 @@ func runWaitControlPlaneSubTask(component string, lables labels.Set) func(r work } waiter := apiclient.NewKarmadaWaiter(nil, data.RemoteClient(), componentBeReadyTimeout) - if err := waiter.WaitForSomePods(lables.String(), data.GetNamespace(), 1); err != nil { + if err := waiter.WaitForSomePods(ls.String(), data.GetNamespace(), 1); err != nil { return fmt.Errorf("waiting for %s to ready timeout, err: %w", component, err) } diff --git a/operator/pkg/util/apiclient/idempotency.go b/operator/pkg/util/apiclient/idempotency.go index 5016084b22b9..1d6b735b70e9 100644 --- a/operator/pkg/util/apiclient/idempotency.go +++ b/operator/pkg/util/apiclient/idempotency.go @@ -196,7 +196,7 @@ func CreateCustomResourceDefinitionIfNeed(client *crdsclient.Clientset, obj *api return nil } -// PatchCustomResourceDefinition patchs a crd resource. +// PatchCustomResourceDefinition patches a crd resource. func PatchCustomResourceDefinition(client *crdsclient.Clientset, name string, data []byte) error { crd := client.ApiextensionsV1().CustomResourceDefinitions() if _, err := crd.Patch(context.TODO(), name, types.StrategicMergePatchType, data, metav1.PatchOptions{}); err != nil { diff --git a/operator/pkg/util/apiclient/wait.go b/operator/pkg/util/apiclient/wait.go index 42ac8f82e4df..3154aefa0d45 100644 --- a/operator/pkg/util/apiclient/wait.go +++ b/operator/pkg/util/apiclient/wait.go @@ -41,7 +41,7 @@ type KarmadaWaiter struct { timeout time.Duration } -// NewKarmadaWaiter reurn a karmada waiter, the rest config is to create crd client or aggregate client. +// NewKarmadaWaiter returns a karmada waiter, the rest config is to create crd client or aggregate client. func NewKarmadaWaiter(config *rest.Config, client clientset.Interface, timeout time.Duration) Waiter { return &KarmadaWaiter{ karmadaConfig: config, @@ -169,8 +169,8 @@ func isPodRunning(pod corev1.Pod) bool { return false } - for _, condtion := range pod.Status.Conditions { - if condtion.Type == corev1.PodReady && condtion.Status == corev1.ConditionTrue { + for _, condition := range pod.Status.Conditions { + if condition.Type == corev1.PodReady && condition.Status == corev1.ConditionTrue { return true } } diff --git a/operator/pkg/util/patcher/pather.go b/operator/pkg/util/patcher/pather.go index b36fbfe6be0d..4061ab8bcec8 100644 --- a/operator/pkg/util/patcher/pather.go +++ b/operator/pkg/util/patcher/pather.go @@ -76,7 +76,7 @@ func (p *Patcher) ForDeployment(deployment *appsv1.Deployment) { overrideArgs := map[string]string{} - // merge featureGates and build to an argurment. + // merge featureGates and build to an argument. if len(p.featureGates) != 0 { baseFeatureGates := map[string]bool{} @@ -147,7 +147,7 @@ func parseFeatrueGatesArgumentToMap(featureGates string) map[string]bool { featureGatesMap := map[string]bool{} for _, featureGate := range featureGateSlice { - key, val, err := parseFeatrueGate(featureGate) + key, val, err := parseFeatureGate(featureGate) if err != nil { continue } @@ -221,7 +221,7 @@ func parseArgument(arg string) (string, string, error) { return keyvalSlice[0], keyvalSlice[1], nil } -func parseFeatrueGate(featureGate string) (string, bool, error) { +func parseFeatureGate(featureGate string) (string, bool, error) { if !strings.Contains(featureGate, "=") { return "", false, errors.New("the featureGate should have a '=' between the flag and the value") } diff --git a/operator/pkg/util/util.go b/operator/pkg/util/util.go index f4128cdca732..b7ec11c17211 100644 --- a/operator/pkg/util/util.go +++ b/operator/pkg/util/util.go @@ -169,8 +169,8 @@ func ReadYamlFile(path string) ([]byte, error) { return yaml.YAMLToJSON(data) } -// RelpaceYamlForReg replace content of yaml file with a Regexp -func RelpaceYamlForReg(path, destResource string, reg *regexp.Regexp) ([]byte, error) { +// ReplaceYamlForReg replace content of yaml file with a Regexp +func ReplaceYamlForReg(path, destResource string, reg *regexp.Regexp) ([]byte, error) { data, err := os.ReadFile(path) if err != nil { return nil, err diff --git a/pkg/apis/cluster/v1alpha1/well_known_constants.go b/pkg/apis/cluster/v1alpha1/well_known_constants.go index 2f811686bae3..5069cef5b333 100644 --- a/pkg/apis/cluster/v1alpha1/well_known_constants.go +++ b/pkg/apis/cluster/v1alpha1/well_known_constants.go @@ -2,7 +2,7 @@ package v1alpha1 const ( // TaintClusterUnscheduler will be added when cluster becomes unschedulable - // and removed when cluster becomes scheduable. + // and removed when cluster becomes schedulable. TaintClusterUnscheduler = "cluster.karmada.io/unschedulable" // TaintClusterNotReady will be added when cluster is not ready // and removed when cluster becomes ready. diff --git a/pkg/controllers/federatedhpa/federatedhpa_controller.go b/pkg/controllers/federatedhpa/federatedhpa_controller.go index 9cc03091f1de..63a9ccc216ca 100644 --- a/pkg/controllers/federatedhpa/federatedhpa_controller.go +++ b/pkg/controllers/federatedhpa/federatedhpa_controller.go @@ -74,7 +74,7 @@ type FederatedHPAController struct { monitor monitor.Monitor - HorizontalPodAutoscalerSyncPeroid time.Duration + HorizontalPodAutoscalerSyncPeriod time.Duration DownscaleStabilisationWindow time.Duration // Latest unstabilized recommendations for each autoscaler. recommendations map[string][]timestampedRecommendation @@ -166,7 +166,7 @@ func (c *FederatedHPAController) Reconcile(ctx context.Context, req controllerru return controllerruntime.Result{}, err } - return controllerruntime.Result{RequeueAfter: c.HorizontalPodAutoscalerSyncPeroid}, nil + return controllerruntime.Result{RequeueAfter: c.HorizontalPodAutoscalerSyncPeriod}, nil } //nolint:gocyclo diff --git a/pkg/controllers/status/work_status_controller_test.go b/pkg/controllers/status/work_status_controller_test.go index 3d38091c87e9..90c55ddcc902 100644 --- a/pkg/controllers/status/work_status_controller_test.go +++ b/pkg/controllers/status/work_status_controller_test.go @@ -555,7 +555,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod *corev1.Pod raw []byte controllerWithoutInformer bool - workWithRigntNS bool + workWithRightNS bool expectedError bool workWithDeletionTimestamp bool wrongWorkNS bool @@ -566,7 +566,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: true, }, { @@ -575,7 +575,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: true, }, { @@ -584,7 +584,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: false, - workWithRigntNS: true, + workWithRightNS: true, expectedError: true, }, { @@ -592,7 +592,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { obj: newPodObj("karmada-es-cluster"), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: false, }, { @@ -601,7 +601,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName, true), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: false, }, { @@ -610,7 +610,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: false, + workWithRightNS: false, expectedError: false, }, { @@ -619,7 +619,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod1","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: true, }, { @@ -628,7 +628,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { pod: newPod(workNs, workName), raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`), controllerWithoutInformer: true, - workWithRigntNS: true, + workWithRightNS: true, expectedError: true, wrongWorkNS: true, }, @@ -656,7 +656,7 @@ func TestWorkStatusController_syncWorkStatus(t *testing.T) { } var work *workv1alpha1.Work - if tt.workWithRigntNS { + if tt.workWithRightNS { work = testhelper.NewWork(workName, workNs, workUID, tt.raw) } else { work = testhelper.NewWork(workName, fmt.Sprintf("%v-test", workNs), workUID, tt.raw) diff --git a/pkg/karmadactl/addons/disable.go b/pkg/karmadactl/addons/disable.go index 7ef43c47afcc..3c3e0ae9cb3b 100644 --- a/pkg/karmadactl/addons/disable.go +++ b/pkg/karmadactl/addons/disable.go @@ -29,7 +29,7 @@ var ( # Specify the Karmada control plane kubeconfig %[1]s disable karmada-search --karmada-kubeconfig /etc/karmada/karmada-apiserver.config - # Sepcify the namespace where Karmada components are installed + # Specify the namespace where Karmada components are installed %[1]s disable karmada-search --namespace karmada-system `) ) diff --git a/pkg/karmadactl/addons/enable.go b/pkg/karmadactl/addons/enable.go index 72fb26a071b1..314c55bb69b4 100644 --- a/pkg/karmadactl/addons/enable.go +++ b/pkg/karmadactl/addons/enable.go @@ -34,7 +34,7 @@ var ( # Specify the karmada-search image %[1]s enable karmada-search --karmada-search-image docker.io/karmada/karmada-search:latest - # Sepcify the namespace where Karmada components are installed + # Specify the namespace where Karmada components are installed %[1]s enable karmada-search --namespace karmada-system `) ) diff --git a/pkg/karmadactl/addons/init/global.go b/pkg/karmadactl/addons/init/global.go index 9725d5290374..4be58bd52005 100644 --- a/pkg/karmadactl/addons/init/global.go +++ b/pkg/karmadactl/addons/init/global.go @@ -19,7 +19,7 @@ type GlobalCommandOptions struct { KarmadaConfig string KarmadaContext string - // Namespace holds the namespace where Karmada components intalled + // Namespace holds the namespace where Karmada components installed Namespace string // Cluster holds the name of member cluster to enable or disable scheduler estimator diff --git a/pkg/karmadactl/addons/list.go b/pkg/karmadactl/addons/list.go index 2d1e67340c7c..b6e8196c93e0 100644 --- a/pkg/karmadactl/addons/list.go +++ b/pkg/karmadactl/addons/list.go @@ -23,7 +23,7 @@ var ( # Specify the karmada control plane kubeconfig %[1]s list --karmada-kubeconfig /etc/karmada/karmada-apiserver.config - # Sepcify the namespace where Karmada components are installed + # Specify the namespace where Karmada components are installed %[1]s list --namespace karmada-system `) ) diff --git a/pkg/karmadactl/cmdinit/karmada/deploy.go b/pkg/karmadactl/cmdinit/karmada/deploy.go index 712a3ec222af..606ffe3dd5ac 100644 --- a/pkg/karmadactl/cmdinit/karmada/deploy.go +++ b/pkg/karmadactl/cmdinit/karmada/deploy.go @@ -104,7 +104,7 @@ func InitKarmadaResources(dir, caBase64, systemNamespace string) error { klog.Exitln(err) } - if err = createExtralResources(clientSet, dir); err != nil { + if err = createExtraResources(clientSet, dir); err != nil { klog.Exitln(err) } @@ -143,7 +143,7 @@ func InitKarmadaBootstrapToken(dir string) (string, error) { return registerCommand, nil } -func createExtralResources(clientSet *kubernetes.Clientset, dir string) error { +func createExtraResources(clientSet *kubernetes.Clientset, dir string) error { // grant view clusterrole with karamda resource permission if err := grantKarmadaPermissionToViewClusterRole(clientSet); err != nil { return err diff --git a/pkg/karmadactl/cmdinit/utils/util_test.go b/pkg/karmadactl/cmdinit/utils/util_test.go index caf7d277ad45..730e8fd94af8 100644 --- a/pkg/karmadactl/cmdinit/utils/util_test.go +++ b/pkg/karmadactl/cmdinit/utils/util_test.go @@ -83,19 +83,19 @@ func TestDownloadFile(t *testing.T) { func TestListFiles(t *testing.T) { tests := []struct { - name string - path string - tempfils []string + name string + path string + tempfiles []string }{ { - name: "get files from path", - path: "temp-path" + randString(), - tempfils: []string{"tempfiles1" + randString(), "tempfiles2" + randString()}, + name: "get files from path", + path: "temp-path" + randString(), + tempfiles: []string{"tempfiles1" + randString(), "tempfiles2" + randString()}, }, { - name: "no files from path", - path: "temp-path" + randString(), - tempfils: []string{}, + name: "no files from path", + path: "temp-path" + randString(), + tempfiles: []string{}, }, } for _, tt := range tests { @@ -106,9 +106,9 @@ func TestListFiles(t *testing.T) { defer os.RemoveAll(tt.path) var want []string - for i := 0; i < len(tt.tempfils); i++ { - want = append(want, tt.path+"/"+tt.tempfils[i]) - _, err = os.Create(tt.path + "/" + tt.tempfils[i]) + for i := 0; i < len(tt.tempfiles); i++ { + want = append(want, tt.path+"/"+tt.tempfiles[i]) + _, err = os.Create(tt.path + "/" + tt.tempfiles[i]) if err != nil { t.Fatal(err) } diff --git a/pkg/karmadactl/exec/exec.go b/pkg/karmadactl/exec/exec.go index fb59969a8725..0c788ca0e2f0 100644 --- a/pkg/karmadactl/exec/exec.go +++ b/pkg/karmadactl/exec/exec.go @@ -30,7 +30,7 @@ var ( %[1]s exec mypod -c ruby-container -C=member1 -- date # Get output from running the 'date' command in ruby-container from pod mypod in cluster(member1) - %[1]sexec mypod -c ruby-container -C=member1 -- date + %[1]s exec mypod -c ruby-container -C=member1 -- date # Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod in cluster(member1) # and sends stdout/stderr from 'bash' back to the client diff --git a/pkg/karmadactl/get/get.go b/pkg/karmadactl/get/get.go index 7dc746358b19..bd13f99ae3f8 100644 --- a/pkg/karmadactl/get/get.go +++ b/pkg/karmadactl/get/get.go @@ -767,7 +767,7 @@ func (g *CommandGetOptions) printGeneric(r *resource.Result) error { var obj runtime.Object if !singleItemImplied || len(infos) != 1 { - // we have zero or multple items, so coerce all items into a list. + // we have zero or multiple items, so coerce all items into a list. // we don't want an *unstructured.Unstructured list yet, as we // may be dealing with non-unstructured objects. Compose all items // into an corev1.List, and then decode using an unstructured scheme. diff --git a/pkg/karmadactl/register/register.go b/pkg/karmadactl/register/register.go index c1b7dd812f7d..92be07884e44 100644 --- a/pkg/karmadactl/register/register.go +++ b/pkg/karmadactl/register/register.go @@ -211,7 +211,7 @@ type CommandRegisterOption struct { EnableCertRotation bool // CACertPath is the path to the SSL certificate authority used to - // secure comunications between member cluster and karmada-control-plane. + // secure communications between member cluster and karmada-control-plane. // Defaults to "/etc/karmada/pki/ca.crt". CACertPath string @@ -310,7 +310,7 @@ func (o *CommandRegisterOption) Run(parentCommand string) error { fmt.Printf("\n[preflight] Please check the above errors\n") return nil } - fmt.Println("[prefligt] All pre-flight checks were passed") + fmt.Println("[preflight] All pre-flight checks were passed") if o.DryRun { return nil @@ -472,7 +472,7 @@ func (o *CommandRegisterOption) discoveryBootstrapConfigAndClusterInfo(bootstrap func (o *CommandRegisterOption) constructKarmadaAgentConfig(bootstrapClient *kubeclient.Clientset, karmadaClusterInfo *clientcmdapi.Cluster) (*clientcmdapi.Config, error) { var cert []byte - pk, csr, err := generatKeyAndCSR(o.ClusterName) + pk, csr, err := generateKeyAndCSR(o.ClusterName) if err != nil { return nil, err } @@ -720,8 +720,8 @@ func (o *CommandRegisterOption) makeKarmadaAgentDeployment() *appsv1.Deployment return karmadaAgent } -// generatKeyAndCSR generate private key and csr -func generatKeyAndCSR(clusterName string) (*rsa.PrivateKey, []byte, error) { +// generateKeyAndCSR generate private key and csr +func generateKeyAndCSR(clusterName string) (*rsa.PrivateKey, []byte, error) { pk, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return nil, nil, err diff --git a/pkg/karmadactl/util/factory.go b/pkg/karmadactl/util/factory.go index 8e4884b3e389..14135dbc26f7 100644 --- a/pkg/karmadactl/util/factory.go +++ b/pkg/karmadactl/util/factory.go @@ -96,8 +96,8 @@ func (f *factoryImpl) FactoryForMemberCluster(clusterName string) (cmdutil.Facto WrapConfigFn: f.kubeConfigFlags.WrapConfigFn, } // Override the kube-apiserver address. - memberAPIserver := karmadaAPIServer + fmt.Sprintf(proxyURL, clusterName) - kubeConfigFlags.APIServer = &memberAPIserver + memberAPIServer := karmadaAPIServer + fmt.Sprintf(proxyURL, clusterName) + kubeConfigFlags.APIServer = &memberAPIServer matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags) return cmdutil.NewFactory(matchVersionKubeConfigFlags), nil } diff --git a/pkg/modeling/modeling.go b/pkg/modeling/modeling.go index 82cc6ed150ce..f94ea0a64c7c 100644 --- a/pkg/modeling/modeling.go +++ b/pkg/modeling/modeling.go @@ -52,7 +52,7 @@ type ClusterResourceNode struct { quantity int // resourceList records the resource list of this node. - // It maybe contain cpu, mrmory, gpu... + // It maybe contain cpu, memory, gpu... // User can specify which parameters need to be included before the cluster starts // +required resourceList ResourceList @@ -240,9 +240,9 @@ func rbtConvertToLl(rbt *rbt.Tree) *list.List { } // ConvertToResourceList is convert from corev1.ResourceList to ResourceList -func ConvertToResourceList(rslist corev1.ResourceList) ResourceList { +func ConvertToResourceList(rsList corev1.ResourceList) ResourceList { resourceList := ResourceList{} - for name, quantity := range rslist { + for name, quantity := range rsList { if name == corev1.ResourceCPU { resourceList[clusterapis.ResourceCPU] = quantity } else if name == corev1.ResourceMemory { @@ -265,16 +265,16 @@ func (rs *ResourceSummary) GetNodeNumFromModel(model *resourceModels) int { } else if model.linkedlist == nil && model.redblackTree == nil { return 0 } else if model.linkedlist != nil && model.redblackTree != nil { - klog.Info("GetNodeNum: unknow error") + klog.Info("GetNodeNum: unknown error") } return 0 } -// DeleteFromResourceSummary dalete resource node into modeling summary +// DeleteFromResourceSummary deletes resource node into modeling summary func (rs *ResourceSummary) DeleteFromResourceSummary(crn ClusterResourceNode) error { index := rs.getIndex(crn) if index == -1 { - return errors.New("ClusterResource can not delet the resource summary: index is invalid.") + return errors.New("ClusterResource can not delete the resource summary: index is invalid") } modeling := &(*rs)[index] if rs.GetNodeNumFromModel(modeling) >= 6 { diff --git a/pkg/resourceinterpreter/default/native/healthy_test.go b/pkg/resourceinterpreter/default/native/healthy_test.go index fd13ac56531a..9c96e248a6b1 100644 --- a/pkg/resourceinterpreter/default/native/healthy_test.go +++ b/pkg/resourceinterpreter/default/native/healthy_test.go @@ -352,7 +352,7 @@ func Test_interpretDaemonSetHealth(t *testing.T) { wantErr: false, }, { - name: "updatedNumberScheduled < desiredNumberSchedulerd", + name: "updatedNumberScheduled < desiredNumberScheduled", object: &unstructured.Unstructured{ Object: map[string]interface{}{ "status": map[string]interface{}{ diff --git a/pkg/scheduler/core/spreadconstraint/group_clusters.go b/pkg/scheduler/core/spreadconstraint/group_clusters.go index 5ce6925801a5..d3a2da1dae9c 100644 --- a/pkg/scheduler/core/spreadconstraint/group_clusters.go +++ b/pkg/scheduler/core/spreadconstraint/group_clusters.go @@ -72,7 +72,7 @@ func GroupClustersWithScore( calAvailableReplicasFunc func(clusters []*clusterv1alpha1.Cluster, spec *workv1alpha2.ResourceBindingSpec) []workv1alpha2.TargetCluster, ) *GroupClustersInfo { if isTopologyIgnored(placement) { - return groupClustersIngoreTopology(clustersScore, spec, calAvailableReplicasFunc) + return groupClustersIgnoringTopology(clustersScore, spec, calAvailableReplicasFunc) } return groupClustersBasedTopology(clustersScore, spec, placement.SpreadConstraints, calAvailableReplicasFunc) @@ -98,7 +98,7 @@ func groupClustersBasedTopology( return groupClustersInfo } -func groupClustersIngoreTopology( +func groupClustersIgnoringTopology( clustersScore framework.ClusterScoreList, rbSpec *workv1alpha2.ResourceBindingSpec, calAvailableReplicasFunc func(clusters []*clusterv1alpha1.Cluster, spec *workv1alpha2.ResourceBindingSpec) []workv1alpha2.TargetCluster, diff --git a/pkg/search/backendstore/defaultstore.go b/pkg/search/backendstore/defaultstore.go index 76ad9257ed61..d66301cb7759 100644 --- a/pkg/search/backendstore/defaultstore.go +++ b/pkg/search/backendstore/defaultstore.go @@ -8,14 +8,14 @@ import ( // Default is the default BackendStore type Default struct { - resourceEventHander cache.ResourceEventHandler + resourceEventHandler cache.ResourceEventHandler } // NewDefaultBackend create a new default BackendStore func NewDefaultBackend(cluster string) *Default { klog.Infof("create default backend store: %s", cluster) return &Default{ - resourceEventHander: &cache.ResourceEventHandlerFuncs{ + resourceEventHandler: &cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { us, ok := obj.(*unstructured.Unstructured) if !ok { @@ -45,9 +45,9 @@ func NewDefaultBackend(cluster string) *Default { }}} } -// ResourceEventHandlerFuncs return the ResourceEventHandlerFuncs +// ResourceEventHandlerFuncs returns the ResourceEventHandler func (d *Default) ResourceEventHandlerFuncs() cache.ResourceEventHandler { - return d.resourceEventHander + return d.resourceEventHandler } // Close close the BackendStore diff --git a/pkg/util/cluster.go b/pkg/util/cluster.go index c4c9bba9f519..0901df3b8d15 100644 --- a/pkg/util/cluster.go +++ b/pkg/util/cluster.go @@ -194,7 +194,7 @@ func IsClusterIdentifyUnique(controlPlaneClient karmadaclientset.Interface, id s return true, "", nil } -// ClusterAccessCredentialChanged checks whether the cluster a ccess credential changed +// ClusterAccessCredentialChanged checks whether the cluster access credential changed func ClusterAccessCredentialChanged(newSpec, oldSpec clusterv1alpha1.ClusterSpec) bool { if oldSpec.APIEndpoint == newSpec.APIEndpoint && oldSpec.InsecureSkipTLSVerification == newSpec.InsecureSkipTLSVerification && diff --git a/pkg/util/helper/work_test.go b/pkg/util/helper/work_test.go index 0c0f07af8da9..1cfdb9d8209d 100644 --- a/pkg/util/helper/work_test.go +++ b/pkg/util/helper/work_test.go @@ -39,7 +39,7 @@ func TestGenEventRef(t *testing.T) { wantErr: false, }, { - name: "missing metadata.uid but has resourcetemplate.karmada.io/uid annontation", + name: "missing metadata.uid but has resourcetemplate.karmada.io/uid annotation", obj: &unstructured.Unstructured{ Object: map[string]interface{}{ "apiVersion": "apps/v1", diff --git a/pkg/util/interpreter/rule_test.go b/pkg/util/interpreter/rule_test.go index 2b9e11752da5..52b9f5ad54a6 100644 --- a/pkg/util/interpreter/rule_test.go +++ b/pkg/util/interpreter/rule_test.go @@ -689,7 +689,7 @@ func TestGetByOperation(t *testing.T) { expectedRule: nil, }, { - name: "case-insensitive operation namee", + name: "case-insensitive operation name", operation: "InterpretDEPendency", expectedRule: &dependencyInterpretationRule{}, },