Skip to content

Commit

Permalink
fix spelling errors
Browse files Browse the repository at this point in the history
Signed-off-by: whitewindmills <[email protected]>
  • Loading branch information
whitewindmills committed Sep 1, 2023
1 parent dd6a313 commit 6b4dc48
Show file tree
Hide file tree
Showing 34 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion cmd/controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion docs/proposals/service-discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions operator/pkg/certs/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CertStore interface {
AddCert(cert *KarmadaCert)
GetCert(name string) *KarmadaCert
CertList() []*KarmadaCert
LoadCertFormSercret(sercret *corev1.Secret) error
LoadCertFormSecret(secret *corev1.Secret) error
}

type splitToPairNameFunc func(name string) string
Expand Down Expand Up @@ -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))

Expand All @@ -76,15 +76,15 @@ func (store *KarmadaCertStore) CertList() []*KarmadaCert {
return certs
}

// LoadCertFormSercret loads a set of certs form k8s secret resource. we get cert
// LoadCertFormSecret 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) LoadCertFormSecret(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 {
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/tasks/init/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func skipCerts(d workflow.RunData) (bool, error) {
return false, nil
}

if err := data.LoadCertFormSercret(secret); err != nil {
if err := data.LoadCertFormSecret(secret); err != nil {
return false, err
}

Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/tasks/init/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/tasks/init/karmadaresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
}
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/tasks/init/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions operator/pkg/tasks/init/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ 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 {
return errors.New("wait-controlPlane task invoked with an invalid data struct")
}

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

Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/util/apiclient/idempotency.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/util/apiclient/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
}
Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/util/patcher/pather.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions operator/pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/cluster/v1alpha1/well_known_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/federatedhpa/federatedhpa_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions pkg/controllers/status/work_status_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -584,15 +584,15 @@ 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,
},
{
name: "obj not found in informer, wrong dynamicClientSet without pod",
obj: newPodObj("karmada-es-cluster"),
raw: []byte(`{"apiVersion":"v1","kind":"Pod","metadata":{"name":"pod","namespace":"default"}}`),
controllerWithoutInformer: true,
workWithRigntNS: true,
workWithRightNS: true,
expectedError: false,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/karmadactl/addons/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`)
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/karmadactl/addons/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`)
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/karmadactl/addons/init/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/karmadactl/addons/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`)
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/karmadactl/cmdinit/karmada/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6b4dc48

Please sign in to comment.