Affinity constraints should not render a stray `nodeAffinity` spec section

Bug #2062934 reported by Leon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Committed
High
Ian Booth

Bug Description

When I deploy multiple units of an app with anti-affinity constraints per [1],

```bash
juju deploy --trust prometheus-k8s prom --num-units=2 \
  --constraints="tags=anti-pod.app.kubernetes.io/name=prom,anti-pod.topology-key=kubernetes.io/hostname"
```

Then the resulting statefulset has a stray "nodeAffinity" section that must be manually removed, otherwise the units are stuck in `waiting/allocating`:

```diff
-nodeAffinity:
- requiredDuringSchedulingIgnoredDuringExecution:
- nodeSelectorTerms:
- - {}
podAntiAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
          - key: app.kubernetes.io/name
            operator: In
            values:
              - prom
      topologyKey: kubernetes.io/hostname
```

[1]: https://discourse.charmhub.io/t/pod-priority-and-affinity-in-juju-charms/4091

Revision history for this message
Leon (sed-i) wrote :

Juju 3.4.2-genericlinux-amd64
MicroK8s v1.29.2 revision 6529
Ubuntu 22.04.4 on Multipass

Ian Booth (wallyworld)
Changed in juju:
milestone: none → 3.3.5
status: New → Triaged
importance: Undecided → High
Revision history for this message
Ian Booth (wallyworld) wrote :
Changed in juju:
assignee: nobody → Ian Booth (wallyworld)
status: Triaged → In Progress
Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Revision history for this message
Leon (sed-i) wrote :

❤️

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.