redpanda
redpanda copied to clipboard
operator: add flag to restrict management of cluster based on rp version
Cover letter
In environments where the operator and redpanda are upgraded "at once" we end up performing a double restart of redpanda, once due to the operator, e.g., because a default in the statefulset changed, and again to upgrade redpanda itself by updating its version in the CR.
To avoid the double restart it is useful disable management of redpanda while the operator is being upgraded and the CR is updated. Once those are complete the operator can be activated performing a single rolling upgrade/restart.
Currently the operator offers a "managed" annotation, such that management can be disabled (per CR). However, when using terraform or similar declarative languages, it is inconvenient to express this logic.
To solve this problem, we introduce a flag restrict-redpanda-version that takes as its value a redpanda version and compares it to the version in the CR spec. The operator skips management of that cluster if there's a mismatch. If the value is missing it continues as today.
This allows us to update the operator, providing it with the new version in the flag, and then update the CR version. When the latter occurs the single rolling upgrade will take place.