azure-functions-core-tools
azure-functions-core-tools copied to clipboard
No scaler found for timertrigger. func deploy generated scaledobject
Hello, I am trying to deploy to kubernetes an Azure Functions v3 project that has several Http Functions and one TimerTrigger function, and I see the created scaled object is the one below after executing the following command:
func kubernetes deploy --name timered --registry localhost:5000 --namespace
The default configured replicas are zero
uid: a8cdf04d-178f-4cdd-8add-aa455219cf28
spec:
maxReplicaCount: 5
minReplicaCount: 1
pollingInterval: 5
scaleTargetRef:
deploymentName: timered
triggers:
- metadata:
name: myTimer
schedule: '*/5 * * * * *'
type: timerTrigger
type: timertrigger
kind: List
I do not know what is the purpose of creating a trigger with type "timertrigger", as It seems it does not exist in keda, or maybe I am missing something?
The logs of the keda operator reflect the following error, and the deployment always has zero replicas.
"Reconciler error","controller":"scaledobject-controller","request":"delete/timered","error":"error getting scaler for trigger #0: no scaler found for type: timertrigger"
Are timertriggers thought to be working with ScaledObjects? Or can we get rid of the scaled object definition and just use an standard HPA and configure replicas in the deployment?
Thanks
@jeffhollan @ahmelsayed Do you know if we support timers in Keda?
KEDA doesn’t do azure functions style timer triggers yet.
Then, I suppose it would be a great option not generating the scaledobject for non keda scaler supported types:
https://github.com/Azure/azure-functions-core-tools/blob/8cbebb5264a2b21599031325c684fde0dabf3c7c/src/Azure.Functions.Cli/Kubernetes/KubernetesHelpers.cs#L685
Or at least offer an option in the cli to enable/disable the ScaledObject creation, as this scaledobject that is created in the cluster when deploying with az func is causing the operator to handle and fail the trigger all the time.
"Reconciler error","controller":"scaledobject-controller","request":"delete/timered","error":"error getting scaler for trigger #0: no scaler found for type: timertrigger"
Maybe something like: func kubernetes deploy [args] --create-scaledobject false or --no-scaledobject
I do not know what do you think is the best option
/cc @SatishRanjan
Keda 1.5 will have a Cron scaler, will it be supported then? https://keda.sh/docs/2.0/scalers/cron/
I think we can support it with the new scaler. There will be an implicit assumption there that the function can't take more than the cooldownPeriod
. In consumption plan on Azure, that's 10 minutes. In Keda that's defaulted to 5 minutes, but the core-tools can default it to 10 to make the behavior similar.
The Cron scalar has now been released in KEDA version 1.5.0
There is a difference in the CRON approach though. In KEDA we define a window to ramp up pods in, while here it indicates when a new run should happen.
Hello, guys
Any progress?
Also checking to see if there is an update on this.
I just noticed the func created timertrigger and my Keda doesn't like it.
KEDAScalerFailed
no scaler found for type: timertrigger
What's the status on this? What's the workaround?
It seems like it's safe to delete the timertrigger scaled obj, the function is handling the timing internally as long as its min 1?
I think the lack of Keda timertrigger support is problematic for the following reasons.
So lets say you have a function app with just a timertrigger, then there is no scaling that occurs and the timers run properly with internal timing as @teebu pointed out, because the replicas/pods never get scaled down to zero.
But lets say you have a function app with a timertrigger and a cosmostrigger (or other trigger). Then lets say the keda cosmos external scaler scales to 0 replicas because cosmos doc's aren't changing. Then I believe the internal timers will not fire (i.e. because no pods are running). So in short a timertrigger scaler would be required to fire up the pods.
So to summarize lack of a keda timertrigger scaler is problematic especially when other triggers are present.
I'm hoping whether someone with knowledge of keda triggers/Azure fn apps can confirm that my above understanding is correct. Also it would be good to know when/if keda support timertrigger scaler will be provided. As its kind of weird that the Azure Fn core tooling generates the timertrigger scaler for a non-existent keda trigger. I also would note that its been a heck of a long time (since 2020) since this issue was first brought up.
Also another thing I've been wondering about, but if there are multiple keda scalers, like a timertrigger (future) and cosmostrigger, presumably they would work in harmony together to keep the pods running/stopped?