Skip to content

Commit 43ca407

Browse files
committed
kubevirt: add support for affinity and resources
1 parent 5b1f58a commit 43ca407

File tree

8 files changed

+48
-28
lines changed

8 files changed

+48
-28
lines changed

charts/kubevirt/0.4.0/templates/kubevirt.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ spec:
2020
{{- if .Values.kubevirt.uninstallStrategy }}
2121
uninstallStrategy: {{ .Values.kubevirt.uninstallStrategy }}
2222
{{- end }}
23+
{{- with .Values.kubevirt.workloads }}
24+
workloads:
25+
{{- toYaml . | nindent 4 }}
26+
{{- end }}
2327
{{- with .Values.kubevirt.workloadUpdateStrategy }}
2428
workloadUpdateStrategy:
2529
{{- toYaml . | nindent 4 }}

charts/kubevirt/0.4.0/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ kubevirt:
1414
# Specifies if KubeVirt can be deleted if workloads are still present.
1515
# This is mainly a precaution to avoid accidental data loss.
1616
uninstallStrategy: ""
17+
# Selectors and tolerations that should apply to KubeVirt workloads.
18+
workloads: {}
1719
# WorkloadUpdateStrategy defines at the cluster level how to handle automated workload updates.
1820
workloadUpdateStrategy: {}
1921
# Optionally enable ServiceMonitor for prometheus, see

packages/cdi/charts/templates/cdi-operator.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -606,17 +606,7 @@ spec:
606606
prometheus.cdi.kubevirt.io: "true"
607607
spec:
608608
affinity:
609-
podAffinity:
610-
preferredDuringSchedulingIgnoredDuringExecution:
611-
- podAffinityTerm:
612-
labelSelector:
613-
matchExpressions:
614-
- key: cdi.kubevirt.io
615-
operator: In
616-
values:
617-
- cdi-operator
618-
topologyKey: kubernetes.io/hostname
619-
weight: 1
609+
{{- .Values.deployment.affinity | toYaml | nindent 8 }}
620610
containers:
621611
- env:
622612
- name: DEPLOY_CLUSTER_RESOURCES
@@ -650,9 +640,7 @@ spec:
650640
name: metrics
651641
protocol: TCP
652642
resources:
653-
requests:
654-
cpu: 100m
655-
memory: 150Mi
643+
{{- .Values.deployment.resources | toYaml | nindent 12 }}
656644
securityContext:
657645
allowPrivilegeEscalation: false
658646
capabilities:

packages/cdi/charts/templates/cdi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if ( .Values.cdi.enabled | ne false ) }}
12
apiVersion: cdi.kubevirt.io/v1beta1
23
kind: CDI
34
metadata:
@@ -19,3 +20,4 @@ spec:
1920
workload:
2021
{{- toYaml . | nindent 4 }}
2122
{{- end }}
23+
{{- end }}

packages/cdi/charts/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,25 @@ deployment:
88
uploadserverImage: registry.suse.com/suse/sles/15.6/cdi-uploadserver
99
uploadproxyImage: registry.suse.com/suse/sles/15.6/cdi-uploadproxy
1010
pullPolicy: IfNotPresent
11+
affinity:
12+
podAntiAffinity:
13+
preferredDuringSchedulingIgnoredDuringExecution:
14+
- podAffinityTerm:
15+
labelSelector:
16+
matchExpressions:
17+
- key: cdi.kubevirt.io
18+
operator: In
19+
values:
20+
- cdi-operator
21+
topologyKey: kubernetes.io/hostname
22+
weight: 1
23+
resources:
24+
requests:
25+
cpu: 100m
26+
memory: 150Mi
1127

1228
cdi:
29+
enabled: true
1330
config:
1431
featureGates:
1532
- HonorWaitForFirstConsumer

packages/kubevirt/charts/templates/kubevirt-operator.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,17 +1279,7 @@ spec:
12791279
name: virt-operator
12801280
spec:
12811281
affinity:
1282-
podAntiAffinity:
1283-
preferredDuringSchedulingIgnoredDuringExecution:
1284-
- podAffinityTerm:
1285-
labelSelector:
1286-
matchExpressions:
1287-
- key: kubevirt.io
1288-
operator: In
1289-
values:
1290-
- virt-operator
1291-
topologyKey: kubernetes.io/hostname
1292-
weight: 1
1282+
{{- .Values.operator.affinity | toYaml | nindent 8 }}
12931283
containers:
12941284
- args:
12951285
- --port
@@ -1325,9 +1315,7 @@ spec:
13251315
initialDelaySeconds: 5
13261316
timeoutSeconds: 10
13271317
resources:
1328-
requests:
1329-
cpu: 10m
1330-
memory: 450Mi
1318+
{{- .Values.operator.resources | toYaml | nindent 12 }}
13311319
securityContext:
13321320
allowPrivilegeEscalation: false
13331321
capabilities:

packages/kubevirt/charts/templates/kubevirt.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if ( .Values.kubevirt.enabled | ne false ) }}
12
apiVersion: kubevirt.io/v1
23
kind: KubeVirt
34
metadata:
@@ -30,3 +31,4 @@ spec:
3031
{{- if .Values.kubevirt.monitorAccount }}
3132
monitorAccount: {{ .Values.kubevirt.monitorAccount }}
3233
{{- end }}
34+
{{- end }}

packages/kubevirt/charts/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@ operator:
22
image: registry.suse.com/suse/sles/15.6/virt-operator
33
version: 1.3.1-150600.5.9.1
44
pullPolicy: IfNotPresent
5+
affinity:
6+
podAntiAffinity:
7+
preferredDuringSchedulingIgnoredDuringExecution:
8+
- podAffinityTerm:
9+
labelSelector:
10+
matchExpressions:
11+
- key: kubevirt.io
12+
operator: In
13+
values:
14+
- virt-operator
15+
topologyKey: kubernetes.io/hostname
16+
weight: 1
17+
resources:
18+
requests:
19+
cpu: 10m
20+
memory: 450Mi
521

622
kubevirt:
23+
enabled: true
724
# Holds kubevirt configurations. Same as the virt-configMap.
825
configuration: {}
926
customizeComponents: {}

0 commit comments

Comments
 (0)