grafana / rollout-operator

Kubernetes Rollout Operator
Apache License 2.0
130 stars 17 forks source link

Mirror replicas from different resource #129

Closed pstibrany closed 7 months ago

pstibrany commented 7 months ago

This PR allows the statefulset's desired replicas to follow replicas in different resource (configured using

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:

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.

pstibrany commented 7 months ago

I think this is ready for another review, please take a look.