Let's assume I have a node labeled with the labels myKey1: 2
, myKey2: 5
, myKey3: 3
, myKey4: 6
. I now want to check if one of those labels has a value greater than 4 and if so schedule my workload on this node. For that I use the following nodeAffinity
rule:
spec:
containers:
- name: wl1
image: myImage:latest
imagePullPolicy: IfNotPresent
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: myKey1
operator: Gt
values:
- 4
nodeSelectorTerms:
- matchExpressions:
- key: myKey2
operator: Gt
values:
- 4
nodeSelectorTerms:
- matchExpressions:
- key: myKey3
operator: Gt
values:
- 4
nodeSelectorTerms:
- matchExpressions:
- key: myKey4
operator: Gt
values:
- 4
I would instead love to use something shorter to be able to address a bunch of similar labels like e.g.
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: myKey*
operator: Gt
values:
- 4
so basically using a key
-wildcard and the different checks connected via a logical OR
. Is this possible or is there another solution to check the value of multiple similar labels?