Skip to content

1.5.0 reconciliation / new cluster fails with selector does not match template labels #488

@cayla

Description

@cayla

Hi,

I upgraded to 1.5.0 yesterday and since then, I am getting reconciliation errors and I cannot create new clusters.

Existing cluster example:

# Source: pulse/templates/dragonflydb.yaml
apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
  name: pm-switch-out-ai-api-dragonflydb
  namespace: pulse-stg
  labels:
    app.kubernetes.io/name: pulse
    app.kubernetes.io/instance: pm-switch-out-ai-api
    app.kubernetes.io/component: dragonflydb
    app.kubernetes.io/role: cache
spec:
  args:
    - --cache_mode=true
    - --proactor_threads=3
    - --maxmemory=800mb
  image: docker.dragonFlyDB.io/dragonflydb/dragonfly:v1.37.0
  labels:
    app.kubernetes.io/name: pulse
    app.kubernetes.io/instance: pm-switch-out-ai-api
    app.kubernetes.io/component: dragonflydb
    app.kubernetes.io/role: cache
  replicas: 1
  resources:
    limits:
      ephemeral-storage: 2Gi
      memory: 1Gi
    requests:
      cpu: 500m
      ephemeral-storage: 50Mi
      memory: 1Gi

Error:

manager 2026-03-22T20:33:19Z    ERROR    Reconciler error    {"controller": "Dragonfly", "controllerGroup": "dragonflydb.io", "controllerKind": "Dragonfly", "Dragonfly": {"name":"repro-dragonflydb","namespace":"dragonfly-repro"}, "namespace": "dragonfly-repro", "name": "repro-dragonflydb", "reconcileID": "c074cc5f-7ae4-4698-a
eb5-cf6fd58441f7", "error": "failed to reconcile dragonfly resources: failed to create resource: StatefulSet.apps \"repro-dragonflydb\" is invalid: spec.template.metadata.labels: Invalid value: {\"app\":\"repro-dragonflydb\",\"app.kubernetes.io/name\":\"myapp\",\"app.kubernetes.io/part-of\":\"dragonfly\"}: `selector` does not match template `labels`"}

With selector:

{
  "app": "pm-switch-out-ai-api-dragonflydb",
  "app.kubernetes.io/name": "dragonfly",
  "app.kubernetes.io/part-of": "dragonfly"
}

I also noticed new clusters fail to create. A minimal reproduction:

# repro-dragonfly.yaml
apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
  name: repro-dragonflydb
  namespace: dragonfly-repro
  labels:
    app.kubernetes.io/name: myapp # metadata labels don't matter
spec:
  replicas: 1
  image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.37.0
  labels:
    app.kubernetes.io/name: myapp # this is the trigger — overrides the hardcoded "dragonfly"

If I comment out the last two lines, it creates fine and it has the selectors:

{
  "app": "repro-dragonflydb",
  "app.kubernetes.io/name": "dragonfly",
  "app.kubernetes.io/part-of": "dragonfly"
}

I believe this was caused by #480. I apologize if I missed any required changes needed on my end.

It went away when I went back to 1.4.0.

Thank you for all your hard work. We have been happily trucking otherwise for sometime now. A great improvement over memcache and redis.

PS - and yes, I now see that my the label app.kubernetes.io/name was never applying cleanly from the CR in the first place and always dragonfly, but still thought this was worth reporting.

EDIT: I dropped the .spec.labels.app.kubernetes.io/name in our CRs so we could unblock the upgrade, but I am curious to understand if #480 was an incomplete fix and this is a bug or not.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions