Thanks for the blog post. I have been trying to solve exactly this but somehow it does not work. Here are my KEDA rules:
param scalingrules array = [
{
name: 'cpu-scale-rule'
custom: {
type: 'cpu'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
{
name: 'memory-scale-rule'
custom: {
type: 'memory'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
]
// Extra cron-regler för test och stage (ej prod)
var cronScalingRules = environment != 'prod' ? [
{
name: 'scale-up-office-hours'
custom: {
type: 'cron'
metadata: {
timezone: 'Europe/Stockholm'
start: '0 7 * * 1-5' // mån–fre 07:00
end: '0 20 * * 1-5' // mån–fre 20:00
desiredReplicas: '1'
}
}
}
{
name: 'scale-down-weeknights'
custom: {
type: 'cron'
metadata: {
timezone: 'Europe/Stockholm'
start: '0 20 * * 1-4' // mån–tors 20:00
end: '0 7 * * 2-5' // tis–fre 07:00
desiredReplicas: '0'
}
}
}
{
name: 'scale-down-weekend'
custom: {
type: 'cron'
metadata: {
timezone: 'Europe/Stockholm'
start: '0 20 * * 5' // fredag 20:00
end: '0 7 * * 1' // måndag 07:00
desiredReplicas: '0'
}
}
}
] : [] // Tom array för prod-miljö
// Slå samman reglerna
var combinedScalingRules = concat(scalingrules, cronScalingRules)
....
scale: {
minReplicas: environment != 'prod' ? 0 : minReplicas
maxReplicas: maxReplicas
rules: combinedScalingRules
}
I can see the KEDA rules in the Azure portal, but the do not get triggered