diff --git a/apis/keda/v1alpha1/scaledobject_types.go b/apis/keda/v1alpha1/scaledobject_types.go index 37c5e640963..ff488cd1392 100644 --- a/apis/keda/v1alpha1/scaledobject_types.go +++ b/apis/keda/v1alpha1/scaledobject_types.go @@ -75,7 +75,7 @@ const ( // HealthStatusFailing means the status of the health object is failing HealthStatusFailing HealthStatusType = "Failing" - // Composite metric name used for scalingModifiers composite metric + // CompositeMetricName is used for scalingModifiers composite metric CompositeMetricName string = "composite-metric" defaultHPAMinReplicas int32 = 1 diff --git a/apis/keda/v1alpha1/scaledobject_webhook.go b/apis/keda/v1alpha1/scaledobject_webhook.go index 41bd0355596..62325038866 100644 --- a/apis/keda/v1alpha1/scaledobject_webhook.go +++ b/apis/keda/v1alpha1/scaledobject_webhook.go @@ -231,8 +231,8 @@ func verifyHpas(incomingSo *ScaledObject, action string, _ bool) error { return err } - var incomingSoGckr GroupVersionKindResource - incomingSoGckr, err = ParseGVKR(restMapper, incomingSo.Spec.ScaleTargetRef.APIVersion, incomingSo.Spec.ScaleTargetRef.Kind) + var incomingSoGvkr GroupVersionKindResource + incomingSoGvkr, err = ParseGVKR(restMapper, incomingSo.Spec.ScaleTargetRef.APIVersion, incomingSo.Spec.ScaleTargetRef.Kind) if err != nil { scaledobjectlog.Error(err, "Failed to parse Group, Version, Kind, Resource from incoming ScaledObject", "apiVersion", incomingSo.Spec.ScaleTargetRef.APIVersion, "kind", incomingSo.Spec.ScaleTargetRef.Kind) return err @@ -245,13 +245,13 @@ func verifyHpas(incomingSo *ScaledObject, action string, _ bool) error { val, _ := json.MarshalIndent(hpa, "", " ") scaledobjectlog.V(1).Info(fmt.Sprintf("checking hpa %s: %v", hpa.Name, string(val))) - hpaGckr, err := ParseGVKR(restMapper, hpa.Spec.ScaleTargetRef.APIVersion, hpa.Spec.ScaleTargetRef.Kind) + hpaGvkr, err := ParseGVKR(restMapper, hpa.Spec.ScaleTargetRef.APIVersion, hpa.Spec.ScaleTargetRef.Kind) if err != nil { scaledobjectlog.Error(err, "Failed to parse Group, Version, Kind, Resource from HPA", "hpaName", hpa.Name, "apiVersion", hpa.Spec.ScaleTargetRef.APIVersion, "kind", hpa.Spec.ScaleTargetRef.Kind) return err } - if hpaGckr.GVKString() == incomingSoGckr.GVKString() && + if hpaGvkr.GVKString() == incomingSoGvkr.GVKString() && hpa.Spec.ScaleTargetRef.Name == incomingSo.Spec.ScaleTargetRef.Name { owned := false for _, owner := range hpa.OwnerReferences { @@ -268,7 +268,7 @@ func verifyHpas(incomingSo *ScaledObject, action string, _ bool) error { incomingSo.Spec.Advanced.HorizontalPodAutoscalerConfig.Name == hpa.Name { scaledobjectlog.Info(fmt.Sprintf("%s hpa ownership being transferred to %s", hpa.Name, incomingSo.Name)) } else { - err = fmt.Errorf("the workload '%s' of type '%s' is already managed by the hpa '%s'", incomingSo.Spec.ScaleTargetRef.Name, incomingSoGckr.GVKString(), hpa.Name) + err = fmt.Errorf("the workload '%s' of type '%s' is already managed by the hpa '%s'", incomingSo.Spec.ScaleTargetRef.Name, incomingSoGvkr.GVKString(), hpa.Name) scaledobjectlog.Error(err, "validation error") metricscollector.RecordScaledObjectValidatingErrors(incomingSo.Namespace, action, "other-hpa") return err @@ -363,13 +363,13 @@ func verifyCPUMemoryScalers(incomingSo *ScaledObject, action string, dryRun bool Namespace: incomingSo.Namespace, Name: incomingSo.Spec.ScaleTargetRef.Name, } - incomingSoGckr, err := ParseGVKR(restMapper, incomingSo.Spec.ScaleTargetRef.APIVersion, incomingSo.Spec.ScaleTargetRef.Kind) + incomingSoGvkr, err := ParseGVKR(restMapper, incomingSo.Spec.ScaleTargetRef.APIVersion, incomingSo.Spec.ScaleTargetRef.Kind) if err != nil { scaledobjectlog.Error(err, "Failed to parse Group, Version, Kind, Resource from incoming ScaledObject", "apiVersion", incomingSo.Spec.ScaleTargetRef.APIVersion, "kind", incomingSo.Spec.ScaleTargetRef.Kind) return err } - switch incomingSoGckr.GVKString() { + switch incomingSoGvkr.GVKString() { case "apps/v1.Deployment": deployment := &appsv1.Deployment{} if err := getFromCacheOrDirect(context.Background(), key, deployment); err != nil { diff --git a/tests/internals/events/events_test.go b/tests/internals/events/events_test.go index 3f9122d81fe..d6c5f197087 100644 --- a/tests/internals/events/events_test.go +++ b/tests/internals/events/events_test.go @@ -324,12 +324,12 @@ func getTemplateData() (templateData, []Template) { }, []Template{} } -func checkingEvent(t *testing.T, namespace string, scaledObject string, index int, eventreason string, message string) { +func checkingEvent(t *testing.T, namespace string, scaledObject string, index int, eventReason string, message string) { result, err := ExecuteCommand(fmt.Sprintf("kubectl get events -n %s --field-selector involvedObject.name=%s --sort-by=.metadata.creationTimestamp -o jsonpath=\"{.items[%d].reason}:{.items[%d].message}\"", namespace, scaledObject, index, index)) assert.NoError(t, err) lastEventMessage := strings.Trim(string(result), "\"") - assert.Equal(t, lastEventMessage, eventreason+":"+message) + assert.Equal(t, eventReason+":"+message, lastEventMessage) } func testNormalEvent(t *testing.T, kc *kubernetes.Clientset, data templateData) {