github valkey-io/valkey-operator untagged-48c56bfad42e282c9b5f
v0.10.0

29 minutes ago

v0.10.0 adds a pause annotation, opt-in rotation of the system users' passwords, tunable probes, and a manual takeover for persistent clusters that lose quorum. A new replica's pod is not Ready until it has its shard's data, and each node pins its config revision. It also fixes several ways a scale-in, scale-out or rebalance could lose slots or stall. Thank you to everyone who contributed to this release!

Contents: Breaking · Upgrade notes · Features · Fixes · Known issues · What's Changed

Breaking

Every enabled user must name its password Secret (#661, closes #592)

The <cluster>-users default is gone. An enabled user whose password.type is Secret, the default, must set password.secret.name, or passwordSecret.name in the deprecated spec.users. The API server rejects a new or changed user without it, and the operator no longer reads <cluster>-users.

# Before: the password came from <cluster>-users, key alice
spec:
  acl:
    users:
      - name: alice
        permissions: "+@read ~app:*"

# After: name the same Secret
spec:
  acl:
    users:
      - name: alice
        password:
          secret:
            name: my-cluster-users
        permissions: "+@read ~app:*"

keys still defaults to the username. See Check for specs the new rules reject.

Upgrade notes

Upgrade in this order:

  1. Check for specs the new rules reject, and fix them.
  2. Apply both CRDs.
  3. If you maintain your own ClusterRole, add pods/status.
  4. Upgrade the operator. This rolls every cluster once.

Check for specs the new rules reject

v0.10.0 adds validation rules that a cluster created by v0.9.0 can already break:

  • spec.config keys must be lowercase (#670).
  • spec.config must not set a key the operator owns, such as protected-mode or port (#399). See Reserved keys.
  • Every enabled user must name its password Secret (#661).

The API server accepts a stored value while it is unchanged (#724), so these clusters keep running after the upgrade. Until you fix them:

  • A cluster with an uppercase key cannot create ValkeyNodes. Raising shards or replicasPerShard fails with a ValkeyNodeFailed event, and the cluster reports state Failed with reason ValkeyNodeError. Its existing pods keep serving.
  • Any edit to spec.config is rejected while it holds an uppercase or operator-owned key, because the rules apply to the whole map.
  • A cluster with a user that names no Secret reports Degraded with reason UsersACLUnresolved.

List the clusters to fix with this check:

kubectl get valkeyclusters -A -o json | jq -r '.items[] | . as $c
| ([(.spec.config // {} | keys[]) | select(test("^[a-z0-9._-]+$") | not) | "config key not lowercase: \(.)"]
 + [(.spec.config // {} | keys[]) | ascii_downcase | select(IN("aclfile","cluster-allow-replica-migration","cluster-announce-hostname","cluster-announce-ip","cluster-config-file","cluster-enabled","cluster-preferred-endpoint-type","cluster-replica-validity-factor","dir","port","primaryauth","primaryuser","protected-mode","shutdown-on-sigterm","tls-auth-clients","tls-auth-clients-user","tls-ca-cert-file","tls-cert-file","tls-cluster","tls-key-file","tls-port","tls-replication")) | "operator-owned config key: \(.)"]
 + [(.spec.acl.users // [])[] | select(.state != "Disabled" and ((.password.type // "Secret") == "Secret") and ((.password.secret.name // "") == "")) | "acl.users \(.name): no password.secret.name"]
 + [(.spec.users // [])[] | select(.enabled != false and ((.nopass // false) | not) and ((.resetpass // false) | not) and ((.passwordSecret.name // "") == "")) | "users \(.name): no passwordSecret.name"])
| select(length > 0) | "\($c.metadata.namespace)/\($c.metadata.name): \(join("; "))"'

Rename a key in one patch, so the old key is removed in the same update:

kubectl patch valkeycluster my-cluster --type=merge -p '{"spec":{"config":{"MaxMemory":null,"maxmemory":"64mb"}}}'

On v0.9.0 the rename rolls the cluster once, like other config changes. After the upgrade, in testing, lowercasing MaxMemory rolled no pod, and a cluster stuck on a scale-up added its new node 20 seconds later. Remove an operator-owned key: v0.9.0 replaced the user value with its own, except port and the tls- keys on a cluster without TLS (#399).

Apply both CRDs before upgrading the operator

kubectl apply --server-side --force-conflicts -f https://raw.githubusercontent.com/valkey-io/valkey-operator/v0.10.0/config/crd/bases/valkey.io_valkeyclusters.yaml
kubectl apply --server-side --force-conflicts -f https://raw.githubusercontent.com/valkey-io/valkey-operator/v0.10.0/config/crd/bases/valkey.io_valkeynodes.yaml

Helm users: follow the valkey-operator chart's UPGRADE.md, which covers the CRDs and the ClusterRole for each chart version.

With the v0.9.0 CRDs, or with only the new ValkeyCluster CRD, the v0.10.0 operator updates ValkeyNodes in a loop. Every cluster stays in Reconciling with reason UpdatingNodes, a new cluster gets ValkeyNodes but no pods, and spec.probes never reaches the pods. If the operator ran on the old CRDs, restart its Deployment after applying them. In testing, an operator that was already running kept looping until it restarted.

The operator needs get and patch on pods/status

Each Valkey pod now has the readiness gate valkey.io/initial-sync-complete (#637), which the operator sets once the pod has its shard's data. The kustomize manifests add the rule to the ClusterRole. If you maintain your own ClusterRole, add:

- apiGroups: [""]
  resources: ["pods/status"]
  verbs: ["get", "patch"]

Without it, the first pod the upgrade replaces stays not Ready and the roll stops there. The cluster reports Ready=False and Progressing=True with reason InitialSyncGateFailed, and a Warning event of the same name names the pod.

Upgrading rolls every cluster once

The pod template changes, so the operator replaces every pod, one node at a time, replicas before primaries, with a failover before each primary. The changes:

  • The volumes reference the renamed Secrets (#661).
  • Each pod mounts its config from its own valkey-<node> ConfigMap, at a pinned revision (#669, #670).
  • The valkey.io/initial-sync-complete readiness gate is added (#637).
  • The server command reads the system passwords from a mounted Secret (#567).
  • VALKEY_USER is replaced by VALKEYCLI_USER (#678).
  • The probe commands pass their timeout to the check scripts (#702).

In testing, the roll lost no acked writes on a cluster with persistence or on one without, and had at most one pod not Ready per cluster at a time.

A shard with no replica and no persistence loses its data in any roll, and this upgrade rolls every pod. Add a replica or persistence first, or hold the cluster with the valkey.io/pause-reconciliation: "true" annotation until you can.

Operator-managed Secrets are renamed (#661)

Before After
internal-<cluster>-acl valkey-<cluster>-acl
internal-<cluster>-system-passwords valkey-<cluster>-system-passwords

The operator copies each old Secret to its new name, with every key, and never generates new system passwords while an old Secret exists. It keeps the old Secret in step while any pod still references it, then deletes it. Update anything of your own that reads the old names. See Operator-managed Secrets.

spec.replicas and spec.users cannot be added or changed (#697)

The API server rejects a new or changed spec.replicas or spec.users. A cluster that already stores them keeps reconciling. Remove spec.replicas in the same update that sets spec.replicasPerShard to the stored count, and spec.users in the same update that lists every user under spec.acl.users. See Migrating from spec.replicas and Migrating from spec.users.

New conditions and events

  • ValkeyCluster: ReconciliationPaused, ExporterPasswordHeld, Degraded with reason AwaitingManualTakeover or RebalanceFailed, and ConfigurationWarning with reason StartupProbeTooShort.
  • ValkeyNode Ready=False reasons: NoParent, InvalidPodTemplate, ConfigRevisionMismatch and ConfigMapError.
  • Events: InitialSyncGateFailed, SlotRebalanceFailed, SlotsRebalancePending, NoParent, InvalidPodTemplate, and the SystemPasswordRotation* events.

See Status conditions.

The minimum Kubernetes version is unchanged at 1.31.

Features

Pause reconciliation of one cluster (#564, closes #504)

valkey.io/pause-reconciliation: "true" on a ValkeyCluster stops the operator from changing it or its ValkeyNodes, for example during a manual repair. The cluster reports ReconciliationPaused. Removing the annotation applies any spec changes made in the meantime. See Pausing reconciliation.

Rotate the system users' passwords (#567, closes #623)

spec.acl.systemUsers.passwordRotation.intervalDays turns on rotation of the _operator, _replication and _exporter passwords. Every node accepts the new password before any client uses it, and the old one stays accepted until every client has switched. A rotation changes only Secret data, so it rolls no pod. Rotation is off unless the field is set. See System password rotation.

Tune the server probes and disable liveness (#686, closes #598)

spec.probes sets the timing of the server container's startup, liveness and readiness probes, and liveness.mode: Disabled removes the liveness probe. Unset fields keep the current defaults, so a cluster without spec.probes keeps its probe timings. See Probes.

Approve a takeover on a persistent cluster without quorum (#494, closes #492)

When a persistent cluster loses a primary and has no failover quorum, the operator reports Degraded with reason AwaitingManualTakeover. The message names the failed primary and the candidate replica with its replication offset, and gives the command to approve the takeover with the valkey.io/force-takeover annotation. The operator promotes the replica once you approve. See Persistence.

valkey-cli in a pod logs in as _operator (#678, closes #679)

On Valkey 9.2 and later, kubectl exec <pod> -c server -- valkey-cli logs in as _operator with no flags. Set VALKEYCLI_USER and VALKEYCLI_AUTH on the server container through spec.containers to log in as your own user. Older images ignore VALKEYCLI_USER. See valkey-cli in a node's pod.

Each node pins its config revision (#668, #669, #670, #671, closes #227 and #404)

Each ValkeyNode owns a valkey-<node> ConfigMap that holds its restart-only config at a pinned revision and a live.conf with the live keys it has applied. A pod restarted mid-roll boots the config it was running, and each node renders version-gated config for its own image. Adding a key to the operator's live-settable list in a later release will not roll pods.

Lower operator memory and faster scrapes (#656, closes #649; #658, #659, #660, #665, #677, #681, #693)

The operator dials nodes in parallel when it scrapes a cluster, so an unreachable node no longer adds a 5-second dial timeout per address to each reconcile. It also requests only the INFO sections it reads, drops managedFields from its cache, and uses smaller client buffers.

Fixes

A drain no longer evicts a primary while its new replica is still copying (#637, closes #552; #687, closes #684)

A replacement replica turned Ready before it had its shard's data, so the PodDisruptionBudget counted it and a drain could evict the primary it was copying from. Without persistence the operator then promoted the empty replica. A pod is now Ready only once it has its shard's data, and the cluster reports Ready only once its pods do.

Lowering replicasPerShard fails the primary over first (#519, closes #459)

Lowering replicasPerShard could delete a node that was still its shard's primary. The operator now moves the primary role to a replica the new count keeps before deleting the node, and waits when no such replica is synced.

Failed slot migrations are reported (#517, closes #444; #716, closes #715)

A slot migration that failed after the server accepted it was re-issued every 2 seconds with no sign of the failure. The cluster now reports Degraded with reason RebalanceFailed and a SlotRebalanceFailed event, and retries after 2 minutes. A migration also waits until the destination sees the source owning the slots, which removes one cause of that failure.

A scale-out no longer gives away a deleted primary's slots (#705, closes #704)

When a primary's pod was deleted during a scale-out, before a replica was promoted, the new shards' primaries could take its slots and the shard's keys were lost while the cluster reported Ready. The slots now stay with the shard and its replica is promoted.

New nodes join the existing cluster when every primary is lost (#536, closes #535)

Without persistence, pods recreated after every primary was lost formed a separate cluster with no slots, and the ValkeyCluster stayed in Reconciling. They now join a member of the existing cluster.

The primary handoff no longer wipes data while no replica holds the shard (#654, closes #653)

A restarting replica briefly reports master, and the handoff script took that as proof a replica had taken over. It could then wipe the restarted primary's data while no node held the shard's slots. The script now requires a slot assignment.

A node that answers with errors is no longer counted as a healthy member (#557, closes #556)

A node whose CLUSTER MYID, CLUSTER MYSHARDID, CLUSTER INFO or CLUSTER NODES failed or came back empty was treated as a healthy member and could be picked as a CLUSTER MEET target. It is now skipped for that pass.

spec.config rejects keys the operator would ignore (#399, closes #393; #670)

An operator-owned key in spec.config was overridden without an error, and with TLS off a user could move the port the operator connects to. An uppercase key such as MAXMEMORY was neither applied live nor rolled. The API server now rejects both on create and on change.

ACL passwords (#643, closes #642; #695, closes #644)

An empty password in a Secret crashed the reconcile. A value starting with # that was not 64 lowercase hex characters was written to the aclfile as a hash, Valkey rejected the whole file, and a restarted pod crash-looped. An empty value is now hashed like any password, and a pre-hashed value must be # followed by 64 hex characters. Anything else is hashed as plaintext.

No StatefulSet update on every reconcile on Kubernetes 1.35+ (#683, closes #682)

From Kubernetes 1.35 the API server defaults maxUnavailable on StatefulSets, and the operator sent a no-op update for every ValkeyNode on every reconcile. It now sets the same value.

A ValkeyNode without a parent is left alone (#666, closes #632)

A ValkeyNode with no ValkeyCluster owner, such as one left by kubectl delete valkeycluster --cascade=orphan, applied a new pod template on its next reconcile and could recreate its pod. The operator now reports Ready=False with reason NoParent and changes nothing until the node has a parent again.

An invalid probe patch no longer replaces the workload (#702)

A spec.containers patch could leave a probe with no handler, or give it two, which is not a valid probe. The node now keeps its current pod and reports Ready=False with reason InvalidPodTemplate, naming the container and probe.

Known issues

A primary crash during a scale-in can lose acked writes (#638)

Unchanged from v0.9.0. A fix is in review in #690.

A scale-in can delete an excess primary whose pod is being rescheduled (#597)

Unchanged from v0.9.0. A fix is in review in #690.

Recreating the system passwords Secret locks the operator out (#506)

Unchanged from v0.9.0, with the Secret now named valkey-<cluster>-system-passwords. Do not delete it on a running cluster. Rotation changes them without a lockout.

A crash of a new primary during a scale-out can lose the keys moved to it (#742)

A scale-out moves slots onto a new primary before its replica has finished its first sync. If that primary crashes in the few seconds before the sync completes, the replica takes the slots over without their keys. v0.8.0 and v0.9.0 behave the same.

A proactive failover can time out once per roll on a cluster without persistence (#741)

A rolled pod without persistence joins with a new node ID. If the operator fails over to it before its primary has learnt that ID, the primary ignores the request and the operator retries 10 seconds later. In testing this added about 10 seconds to one shard per roll, with no client errors.

What's Changed

  • fix: add validation for rejecting operator owned keys by @deepakpunjabi in #399
  • feat: pause reconciliation with the valkey.io/pause-reconciliation annotation by @melancholictheory in #564
  • feat: do not reconcile a ValkeyNode without a known parent (#632) by @daanvinken in #666
  • feat: dial nodes in parallel when scraping cluster state by @jdheyburn in #656
  • feat: rotate system user passwords without dropping the one in use by @praveenc7 in #567
  • perf: parse CLUSTER NODES with less memory by @bjosv in #665
  • perf: parse only the myself line when reading a ValkeyNode's role by @jdheyburn in #677
  • fix(controller): gate pod readiness on the initial sync (#552) by @praveenc7 in #637
  • perf: strip managedFields from cached objects by @bjosv in #660
  • perf: size pooled Valkey client buffers for control-plane use by @bjosv in #659
  • test(e2e): delete a leftover client pod before each cluster access attempt by @jdheyburn in #685
  • feat: add pre-pr-review agent skill for contributors by @jdheyburn in #507
  • perf: read only the INFO sections the cluster-state scrape uses by @bjosv in #658
  • fix: stop no-op StatefulSet updates on Kubernetes 1.35+ by @bjosv in #683
  • perf: read only the INFO sections the ValkeyNode controller uses by @jdheyburn in #681
  • feat: record the live config a ValkeyNode last applied by @jdheyburn in #668
  • feat: roll ValkeyNodes on a pinned config revision by @jdheyburn in #669
  • feat!: name operator-owned Secrets valkey-- by @praveenc7 in #661
  • fix: wait for PodReady before marking the cluster ready by @melancholictheory in #687
  • feat: require sharedConfigMapName and stop making a scripts ConfigMap per node by @jdheyburn in #674
  • fix: handle empty ACL passwords by @melancholictheory in #643
  • fix: drop a node whose scrape lacks identity or topology by @praveenc7 in #557
  • feat: per-node config ConfigMap written by the node controller by @jdheyburn in #670
  • perf: store CLUSTER NODES flags as a bit set by @bjosv in #693
  • fix: accept only a 64-character hex hash as a pre-hashed ACL password by @Prashanna313 in #695
  • feat: tune the server container's probes and disable liveness through spec.probes by @praveenc7 in #686
  • feat: let users choose the valkey-cli user in the server container by @jdheyburn in #678
  • fix: join recreated nodes to the cluster when every primary is lost by @bjosv in #536
  • fix(controller): fail an excess primary over to a kept replica before scale-in deletes it by @choksi2212 in #519
  • fix(controller): surface asynchronous slot-migration failures instead of silently re-issuing them by @choksi2212 in #517
  • fix: harden per-node config revision handling by @jdheyburn in #671
  • feat: reject new or changed spec.replicas and spec.users (#662) by @daanvinken in #697
  • fix: require slot assignment before the primary handoff wipes the data dir by @niukanen1 in #654
  • fix(controller): keep the workload when a container probe has no handler or more than one by @praveenc7 in #702
  • fix: promote orphaned replicas with persistence after user intervention by @muzammilar in #494
  • Fixing aftersuite for wait valkeynodes by @Sasidharan3094 in #699
  • fix: keep a deleted primary's slots while a replica still follows it by @bjosv in #705
  • fix: wait for the destination to see the source's slots before migrating them by @jdheyburn in #716
  • test(e2e): give each single-node scale-up spec its own cluster name by @jdheyburn in #718
  • fix: let stored values that break the new CEL rules pass status writes on Kubernetes 1.31 and 1.32 by @jdheyburn in #724

New Contributors

Full Changelog: v0.9.0...v0.10.0

Don't miss a new valkey-operator release

NewReleases is sending notifications on new releases.