crate / crate/crate-operator

Pods are not restarted on update - label issue

Open
#724 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
27
Forks
9
Avg merge
3d 1h
Merged PRs (30d)
11

Description

The crate operator does not find pods to restart as the `app.kubernetes.io/managed-by` label copied over from the cratedb resource is not overwritten.
We are using helm to deploy a cratedb definition to the cluster and as of Helm 3.2 (quite old) it adds automatically the `app.kubernetes.io/managed-by` label with the value `Helm` to it. This ends up in the StatefulSet which gets initially deployed. On an update of the cratedb version attribute the StatefulSet gets updated, but the operator cannot find the pods to restart as the value of the managed-by label is not set to `crate-operator`.
It looks like in the following snippet that label gets overwritten by the one from the cratedb resource.
https://github.com/crate/crate-operator/blob/ae24778f403618d7dfce30fa7874d4b43d548fe1/crate/operator/handlers/handle_create_cratedb.py#L61-L68

Also the lookup of the pods are defined in the following snippet validates my assumption
https://github.com/crate/crate-operator/blob/ae24778f403618d7dfce30fa7874d4b43d548fe1/crate/operator/operations.py#L139-L157

I'm guessing the sequence should be turned around that the StatefulSet managed-by label should have the correct value of crate-operator.

## Steps to reproduce
1. Create a cratedb resource with the label `app.kubernetes.io/manged-by: foobar`
2. a statefulset with that label will be created by by the operator
3. update the version of the cratedb created in step1
4. StatefulSet gets updated, but the pods were not restarted

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.