Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEDA can not find scaleTargetRef even though that exists #6138

Closed
tusharvaswani714 opened this issue Sep 5, 2024 · 1 comment
Closed

KEDA can not find scaleTargetRef even though that exists #6138

tusharvaswani714 opened this issue Sep 5, 2024 · 1 comment

Comments

@tusharvaswani714
Copy link

Hey everyone. I have this RunnerDeployment resource:

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
    annotations:
        karpenter.sh/do-not-evict: "true"
    name: actions-runner-deployment
    namespace: actions
spec:
    template:
        spec:
            labels:
                - self-hosted-linux
            organization: SecondBrainLabs-SBL
            resources:
                requests:
                    cpu: 1500m
                    memory: 2000Mi

and I have this keda scaled object for that RunnerDeployment resource:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
    name: actions-runner-scaled-object
    namespace: actions
spec:
    scaleTargetRef:
        apiVersion: actions.summerwind.dev/v1alpha1
        kind: RunnerDeployment
        name: actions-runner-deployment
    minReplicaCount: 0
    maxReplicaCount: 1
    triggers:
        - type: github-runner
          metadata:
              githubApiURL: "https://api.github.com/"
              owner: "SecondBrainLabs-SBL"
              runnerScope: "org"
              targetWorkflowQueueLength: "1"
          authenticationRef:
              name: actions-runner-trigger-auth

Even though scaleTargetRef looks correct it's not scaling down to 0. These are the logs I see:

2024-09-05T12:37:53Z	ERROR	ScaledObject doesn't have correct scaleTargetRef specification	{"controller": "scaledobject", "controllerGroup": "keda.sh", "controllerKind": "ScaledObject", "ScaledObject": {"name":"actions-runner-scaled-object","namespace":"actions"}, "namespace": "actions", "name": "actions-runner-scaled-object", "reconcileID": "83a4d871-7f02-4b19-a8cf-fd74507e26e1", "error": "runnerdeployments.actions.summerwind.dev \"actions-runner-deployment\" not found"}
github.com/kedacore/keda/v2/controllers/keda.(*ScaledObjectReconciler).Reconcile
	/workspace/controllers/keda/scaledobject_controller.go:194
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
	/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:119
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:316
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227

If anyone could help that will be great.
Thanks

@kumarnaveentulasi
Copy link

Warning ScaledObjectCheckFailed 47m (x9 over 47m) keda-operator Target resource doesn't exist
Warning ScaledObjectCheckFailed 47m (x9 over 47m) keda-operator ScaledObject doesn't have correct scaleTargetRef specification
Normal KEDAScalersStarted 47m keda-operator Started scalers watch
Normal ScaledObjectReady 47m (x3 over 47m) keda-operator ScaledObject is ready for scaling
Warning KEDAScalerFailed 47m keda-operator error inspecting rabbitMQ: Exception (404) Reason: "NOT_FOUND - no queue 'inference_queue' in vhost '/'"
Normal KEDAScalersStarted 2m31s (x719 over 47m) keda-operator Scaler rabbitmq is built.

but my hpa was as follows

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: my-microservice-scaledobject
namespace: dev
spec:
scaleTargetRef:
name: my-microservice # The name of your deployment
pollingInterval: 5 # Time interval to poll RabbitMQ queue for messages
cooldownPeriod: 30 # Time to wait before scaling down after scaling up
minReplicaCount: 0 # Minimum replicas can scale to 0
maxReplicaCount: 20 # Maximum replicas (adjust based on your needs)
triggers:

type: rabbitmq
metadata:
host: "amqp://admin:Truefan@[email protected]:5672" # Correct RabbitMQ URL
queueName: "inference_queue" # The RabbitMQ queue name to monitor
vhost: "naveen-test-dev" # The vhost name (ensure this is the correct vhost in RabbitMQ)
queueLength: "1" # Scale 1 pod per message in the queue
i was the file name as hpa.yml and the deploying in the dev namespace and keda operator in the keda namespace can any help me with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready To Ship
Development

No branches or pull requests

2 participants