Skip to content

Commit 48b75fe

Browse files
committed
chore(manifests): add anti-affinity rules
Resolve DVO alerts by using anti-affinity rules to try to schedule clair replicas on different nodes. Signed-off-by: Ryan Wallace <rywallac@redhat.com>
1 parent 195cdb0 commit 48b75fe

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

contrib/openshift/manifests/manifests.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,21 @@ objects:
4141
labels:
4242
service: indexer
4343
app: clair
44+
${{INDEXER_COMPONENT_LABEL_KEY}}: ${{INDEXER_COMPONENT_LABEL_VALUE}}
4445
spec:
4546
serviceAccountName: ${SERVICE_ACCOUNT}
47+
affinity:
48+
podAntiAffinity:
49+
preferredDuringSchedulingIgnoredDuringExecution:
50+
- weight: 1
51+
podAffinityTerm:
52+
labelSelector:
53+
matchExpressions:
54+
- key: ${{INDEXER_COMPONENT_LABEL_KEY}}
55+
operator: In
56+
values:
57+
- ${{INDEXER_COMPONENT_LABEL_VALUE}}
58+
topologyKey: kubernetes.io/hostname
4659
volumes:
4760
- name: clair-config
4861
secret:
@@ -113,8 +126,21 @@ objects:
113126
labels:
114127
service: matcher
115128
app: clair
129+
${{MATCHER_COMPONENT_LABEL_KEY}}: ${{MATCHER_COMPONENT_LABEL_VALUE}}
116130
spec:
117131
serviceAccountName: ${SERVICE_ACCOUNT}
132+
affinity:
133+
podAntiAffinity:
134+
preferredDuringSchedulingIgnoredDuringExecution:
135+
- weight: 1
136+
podAffinityTerm:
137+
labelSelector:
138+
matchExpressions:
139+
- key: ${{MATCHER_COMPONENT_LABEL_KEY}}
140+
operator: In
141+
values:
142+
- ${{MATCHER_COMPONENT_LABEL_VALUE}}
143+
topologyKey: kubernetes.io/hostname
118144
volumes:
119145
- name: clair-config
120146
secret:
@@ -182,8 +208,21 @@ objects:
182208
labels:
183209
service: notifier
184210
app: clair
211+
${{NOTIFIER_COMPONENT_LABEL_KEY}}: ${{NOTIFIER_COMPONENT_LABEL_VALUE}}
185212
spec:
186213
serviceAccountName: ${SERVICE_ACCOUNT}
214+
affinity:
215+
podAntiAffinity:
216+
preferredDuringSchedulingIgnoredDuringExecution:
217+
- weight: 1
218+
podAffinityTerm:
219+
labelSelector:
220+
matchExpressions:
221+
- key: ${{NOTIFIER_COMPONENT_LABEL_KEY}}
222+
operator: In
223+
values:
224+
- ${{NOTIFIER_COMPONENT_LABEL_VALUE}}
225+
topologyKey: kubernetes.io/hostname
187226
volumes:
188227
- name: clair-config
189228
secret:
@@ -333,6 +372,12 @@ parameters:
333372
- name: INDEXER_STORAGE_REQS
334373
value: "200Gi"
335374
displayName: the indexer's VPC volume size
375+
- name: INDEXER_COMPONENT_LABEL_KEY
376+
value: "clair-indexer-component"
377+
displayName: the label key used for indexer pod anti-affinity
378+
- name: INDEXER_COMPONENT_LABEL_VALUE
379+
value: "indexer"
380+
displayName: the label value used for indexer pod anti-affinity
336381
#
337382
# matcher params
338383
#
@@ -351,6 +396,12 @@ parameters:
351396
- name: MATCHER_MEM_REQS
352397
value: "4096Mi"
353398
displayName: the matcher's memory requests in vCPUs
399+
- name: MATCHER_COMPONENT_LABEL_KEY
400+
value: "clair-matcher-component"
401+
displayName: the label key used for matcher pod anti-affinity
402+
- name: MATCHER_COMPONENT_LABEL_VALUE
403+
value: "matcher"
404+
displayName: the label value used for matcher pod anti-affinity
354405
#
355406
# notifier params
356407
#
@@ -369,6 +420,12 @@ parameters:
369420
- name: NOTIFIER_MEM_REQS
370421
value: "4096Mi"
371422
displayName: the matcher's memory requests in vCPUs
423+
- name: NOTIFIER_COMPONENT_LABEL_KEY
424+
value: "clair-notifier-component"
425+
displayName: the label key used for notifier pod anti-affinity
426+
- name: NOTIFIER_COMPONENT_LABEL_VALUE
427+
value: "notifier"
428+
displayName: the label value used for notifier pod anti-affinity
372429
#
373430
# shared params
374431
#

0 commit comments

Comments
 (0)