Skip to content

Scaling Groups

A ScalingGroup is a CRD in Kedify KEDA allowing to set shared max capacity for multiple ScaledObjects belonging to a logical group. Group membership is defined dynamically by a label selector.

This feature must be enabled in the KEDA operator by setting env variable:

KEDIFY_SCALINGGROUPS_ENABLED=true

Architecture

Any already existing or new ScaledObjects can be added to a ScalingGroup by ensuring matching labels to the group’s selector. The group’s capacity is shared among all members, each ScaledObject is guaranteed to have their minReplicaCount and can scale up to maxReplicaCount unless the group capacity would be exceeded.

Scaling Groups

Only triggers with metrics from external.metrics.k8s.io are supported for ScalingGroups which means cpu and memory scalers are excluded from this functionality.

Example

Below is a simple ScalingGroup restricting the total capacity to 15 replicas. The group consists of three ScaledObjects with the label scaling-group: pear-db. Status of the group shows members and their scaling status.

apiVersion: keda.kedify.io/v1alpha1
kind: ScalingGroup
metadata:
name: pear-db
spec:
capacity: 15 # max capacity for the whole group
selector: # label selector to match ScaledObjects
matchLabels:
scaling-group: pear-db
status:
memberCount: 3 # how many ScaledObjects belong to the group
residualCapacity: 0 # capacity available to allocate for scale-out
scaledObjects: # scaling status for individual members
pear-store:
hpaDesiredReplicaCount: 7 # how many replicas KEDA allows HPA to scale to
cappedStatus:
replicaCountBasedOnMetrics: 14 # what would be the replica count purely based on the metric
replicaCountCapped: 7 # capped replica count
pear-tunes:
hpaDesiredReplicaCount: 3
cappedStatus:
replicaCountBasedOnMetrics: 9
replicaCountCapped: 3
pear-cloud:
hpaDesiredReplicaCount: 5
cappedStatus:
replicaCountBasedOnMetrics: 6
replicaCountCapped: 5