diff --git a/CHANGELOG.md b/CHANGELOG.md index ccfef70786b..850cc1bcffb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio ### New -**General**: Add scaleTargetRef exists check in webhook and revise some variable name ([#6350](https://github.com/kedacore/keda/pull/6350)) +- **General**: Introduce new NSQ scaler ([#3281](https://github.com/kedacore/keda/issues/3281)) #### Experimental diff --git a/apis/keda/v1alpha1/scaledobject_types.go b/apis/keda/v1alpha1/scaledobject_types.go index 6cc6e97add3..e10982c4e69 100644 --- a/apis/keda/v1alpha1/scaledobject_types.go +++ b/apis/keda/v1alpha1/scaledobject_types.go @@ -270,7 +270,7 @@ func (so *ScaledObject) CheckScaleTargetRefIfExist(ctx context.Context) error { gvkString := soGvkr.GVKString() unstruct := &unstructured.Unstructured{} unstruct.SetGroupVersionKind(soGvkr.GroupVersionKind()) - if err := kc.Get(ctx, client.ObjectKey{Namespace: so.Namespace, Name: so.Spec.ScaleTargetRef.Name}, unstruct); err != nil { + if err := getFromCacheOrDirect(ctx, client.ObjectKey{Namespace: so.Namespace, Name: so.Spec.ScaleTargetRef.Name}, unstruct); err != nil { // resource doesn't exist scaledobjectlog.Error(err, message.ScaleTargetNotFoundMsg, "resource", gvkString, "name", so.Spec.ScaleTargetRef.Name) return err diff --git a/apis/keda/v1alpha1/scaledobject_webhook_test.go b/apis/keda/v1alpha1/scaledobject_webhook_test.go index 75edace5250..04d10695116 100644 --- a/apis/keda/v1alpha1/scaledobject_webhook_test.go +++ b/apis/keda/v1alpha1/scaledobject_webhook_test.go @@ -557,7 +557,7 @@ var _ = It("shouldn't validate the so creation with cpu and memory when stateful }).Should(HaveOccurred()) }) -var _ = It("shouldn't validate the so creation without cpu and memory when custom resources without real StatefulSet", func() { +var _ = It("shouldn't validate the so creation without cpu and memory when custom resources and real StatefulSet not found", func() { namespaceName := "crd-not-resources" namespace := createNamespace(namespaceName)