redis-operator icon indicating copy to clipboard operation
redis-operator copied to clipboard

Updating labels causing statefulset update failures

Open devkmsg opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

When updating labels the statefulset will not get updated because the same set of labels is used for metadata.labels, spec.selector.matchLabels, and spec.template.metadata.labels. Updates to the selector are not allowed so the only option is to enable redis.opstreelabs.in/recreate-statefulset which is pretty impactful as it takes down all pods in the statefulset at the same time.

Describe the solution you'd like

Split out spec.selector.matchLabels to a separate set of labels. Seeing as the resource names must be unique it's probably unnecessary for the selector to include any user defined labels.

Describe alternatives you've considered

To do trivial label updates I am doing the following currently:

  • Update labels on rediscluster object
  • Add new labels to all pods
  • Delete the statefulsets with --cascade=orphan
  • Set redis.opstreelabs.in/recreate-statefulset annotation
  • Let the statefulsets get recreated
  • Remove redis.opstreelabs.in/recreate-statefulset annotation

So in addition to or alternatively the recreate statefulset operation could use the cascade orphan option which will leave the underlying pods running so long as the pods labels still match the statefulsets selector.

What version of redis-operator are you using?

redis-operator version: 0.14

Additional context

devkmsg avatar Apr 12 '23 18:04 devkmsg