Note that "status" subresource of target resource is used to determine number of replicas. status.replicas field of "from-resource" will be kept up-to-date with current number of replicas of statefulset.
This is similar to existing grafana.com/rollout-downscale-leader annotation, but there are some differences:
compared to grafana.com/rollout-downscale-leader, grafana.com/rollout-mirror-replicas-from-resource-* annotations can point to any kind of resource, including custom resource
grafana.com/min-time-between-zones-downscale is not respected when using rollout-mirror-replicas-* annotations
This can be used in combination with HPA, when it's undesireable to set target number of replicas directly on statefulset, because we want to add custom logic to the scaledown (such logic will be added to rollout-operator in the next step, specifically download-delay). In that case, HPA can update different resource (eg. custom resource), and rollout-operator can "mirror" number of replicas from this resource to target statefulset.
This PR allows the statefulset's desired replicas to follow replicas in different resource (configured using
grafana.com/rollout-mirror-replicas-from-resource-name
grafana.com/rollout-mirror-replicas-from-resource-kind
grafana.com/rollout-mirror-replicas-from-resource-api-version
annotations.
Note that "status" subresource of target resource is used to determine number of replicas.
status.replicas
field of "from-resource" will be kept up-to-date with current number of replicas of statefulset.This is similar to existing
grafana.com/rollout-downscale-leader
annotation, but there are some differences:grafana.com/rollout-downscale-leader
,grafana.com/rollout-mirror-replicas-from-resource-*
annotations can point to any kind of resource, including custom resourcegrafana.com/min-time-between-zones-downscale
is not respected when usingrollout-mirror-replicas-*
annotationsThis can be used in combination with HPA, when it's undesireable to set target number of replicas directly on statefulset, because we want to add custom logic to the scaledown (such logic will be added to rollout-operator in the next step, specifically download-delay). In that case, HPA can update different resource (eg. custom resource), and rollout-operator can "mirror" number of replicas from this resource to target statefulset.