Skip to content

etcd-operator upgrade fails on 1.5.x→1.6.0-rc.1: Deployment spec.selector is immutable #3242

Closed

Description

@myasnikovdaniil

What happened

Upgrading from 1.5.x to v1.6.0-rc.1, the etcd-operator HelmRelease fails to upgrade:

cannot patch "etcd-operator-controller-manager" with kind Deployment: Deployment.apps
"etcd-operator-controller-manager" is invalid: spec.selector: Invalid value:
{"matchLabels":{"app.kubernetes.io/name":"etcd-operator","control-plane":"controller-manager"}}: field is immutable

1.6 replaces the upstream etcd-operator chart with the cozystack-authored one (#2859), which changes the controller Deployment's spec.selector.matchLabels:

  • 1.5: {app.kubernetes.io/instance: etcd-operator, app.kubernetes.io/name: etcd-operator}
  • 1.6: {app.kubernetes.io/name: etcd-operator, control-plane: controller-manager}

spec.selector is immutable, so helm upgrade cannot patch it. The etcd-operator (and the new etcd-operator.cozystack.io v1alpha2 CRDs) never come up, which in turn blocks the etcd v1alpha2 adoption.

Impact

Every 1.5 → 1.6 upgrade. Fresh installs are unaffected, so fresh-install CI does not catch it.

Reproduction

Upgrade a 1.5.x cluster to v1.6.0-rc.1.

Workaround (verified)

kubectl delete deployment -n cozy-etcd-operator etcd-operator-controller-manager

then reconcile the HelmRelease — it recreates the Deployment with the new selector and goes Ready.

Suggested fix

Ship a pre-upgrade hook / migration that deletes the old Deployment before the chart upgrade (or keep the Deployment selector labels stable across the chart swap).

Found via a 1.5.0 → 1.6.0-rc.1 upgrade test on a 3-node cluster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions