-
Bug
-
Resolution: Done-Errata
-
Normal
-
CNV v4.17.5
-
Quality / Stability / Reliability
-
3
-
False
-
-
False
-
CNV v4.19.0.rhel9-121
-
-
None
Description of problem:
If you create a new VM or edit an existing VM to add both a 'preferredDuringSchedulingIgnoredDuringExecution' and 'requiredDuringSchedulingIgnoredDuringExecution' rule for nodeAffinity, the requiredDuringSchedulingIgnoredDuringExecution is always removed or overwritten.
Version-Release number of selected component (if applicable):
4.17.5
How reproducible:
Always
Steps to Reproduce:
1. New VM from Template - using a default rhel 9 is fine 2. Click the Scheduling tab 3. Click Affinity rules 4. Add affinity rule Type: Node Affinity Condition: Required during scheduling 5. Add expression kubernetes.io/os In linux 6. Save affinity rule 7. Add affinity rule Type: Node Affinity Condition: Perferred during scheduling Weight: 50 (doesn't really matter for this) 8. Add expression - Nodes have a label performance with a value of standard and high performance In standard 9. Save affinity rule Now it shows both rules and 17 Nodes matching, 3 matching preferred Nodes found Click Apply Rules Now under: Affinity rules It only shows: 1 affinity rules
If you look at the yaml, only applied preferredDuringSchedulingIgnoredDuringExecution:
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: performnce
operator: In
values:
- standard
weight: 50
Similarly, if you first apply the requiredDuringSchedulingIgnoredDuringExecution rule and save it, you get the correct affinity config:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
Now if you go back and add the preferredDuringSchedulingIgnoredDuringExecution, it overwrites the existing requiredDuringSchedulingIgnoredDuringExecution rule:
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: performnce
operator: In
values:
- standard
weight: 50
If you add them both via YAML and save the YAML, it sales both and shows both in the UI.
If you edit them after that via the UI, it again overwrites requiredDuringSchedulingIgnoredDuringExecution.
Actual results:
Only preferredDuringSchedulingIgnoredDuringExecution gets applies.
Expected results:
preferredDuringSchedulingIgnoredDuringExecution and requiredDuringSchedulingIgnoredDuringExecution should be applied
Additional info:
- links to
-
RHEA-2025:145122
OpenShift Virtualization 4.19.0 Images
- mentioned on