Skip to content

Commit c0ce6bb

Browse files
adrianrezaCopilotCopilot
authored andcommitted
feat(magnum,libvirt): add priorityClassName support for libvirt and Magnum aux workloads (#3897)
Closes #3896 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Signed-off-by: adrianreza <adrian.reza@vexxhost.com> Signed-off-by: Mohammed Naser <mnaser@vexxhost.com> (cherry picked from commit 88ca766) Signed-off-by: Adrian Reza <adrian.reza@vexxhost.com>
1 parent dd8e2a9 commit c0ce6bb

6 files changed

Lines changed: 117 additions & 62 deletions

File tree

charts/libvirt/templates/daemonset-libvirt.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ spec:
6565
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
6666
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
6767
spec:
68+
{{ tuple "libvirt" . | include "helm-toolkit.snippets.kubernetes_pod_priority_class" | indent 6 }}
6869
{{ dict "envAll" $envAll "application" "libvirt" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
6970
serviceAccountName: {{ $serviceAccountName }}
7071
nodeSelector:

charts/libvirt/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ conf:
208208
fi
209209
210210
pod:
211+
priorityClassName:
212+
libvirt: ""
211213
probes:
212214
libvirt:
213215
libvirt:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/libvirt/templates/daemonset-libvirt.yaml b/libvirt/templates/daemonset-libvirt.yaml
2+
index a64318e9..508f163c 100644
3+
--- a/libvirt/templates/daemonset-libvirt.yaml
4+
+++ b/libvirt/templates/daemonset-libvirt.yaml
5+
@@ -65,6 +65,7 @@ spec:
6+
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
7+
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
8+
spec:
9+
+{{ tuple "libvirt" . | include "helm-toolkit.snippets.kubernetes_pod_priority_class" | indent 6 }}
10+
{{ dict "envAll" $envAll "application" "libvirt" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
11+
serviceAccountName: {{ $serviceAccountName }}
12+
nodeSelector:
13+
diff --git a/libvirt/values.yaml b/libvirt/values.yaml
14+
index 626efd3a..8ff4b8f4 100644
15+
--- a/libvirt/values.yaml
16+
+++ b/libvirt/values.yaml
17+
@@ -217,6 +217,8 @@ conf:
18+
fi
19+
20+
pod:
21+
+ priorityClassName:
22+
+ libvirt: ""
23+
probes:
24+
libvirt:
25+
libvirt:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
features:
3+
- |
4+
The ``libvirt`` DaemonSet now honors the standard
5+
``pod.priorityClassName.libvirt`` Helm value, so operators can assign a
6+
Kubernetes PriorityClass to it as with other OpenStack components.
7+
- |
8+
The Magnum cluster API proxy DaemonSet and Magnum registry deployment
9+
now support the ``magnum_cluster_api_proxy_priority_class_name`` and
10+
``magnum_registry_priority_class_name`` Ansible variables to set a
11+
Kubernetes PriorityClass.

roles/magnum/defaults/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,15 @@ magnum_cluster_api_proxy_ovs_node_selector:
5353
openstack-control-plane: enabled
5454
magnum_cluster_api_proxy_ovn_node_selector:
5555
openvswitch: enabled
56+
57+
# Name of the Kubernetes PriorityClass to assign to the magnum-cluster-api-proxy
58+
# daemonset pods. Leave empty to omit the field (no priority class).
59+
#
60+
# magnum_cluster_api_proxy_priority_class_name: platform
61+
magnum_cluster_api_proxy_priority_class_name: ""
62+
63+
# Name of the Kubernetes PriorityClass to assign to the magnum-registry
64+
# deployment pods. Leave empty to omit the field (no priority class).
65+
#
66+
# magnum_registry_priority_class_name: platform
67+
magnum_registry_priority_class_name: ""

roles/magnum/tasks/main.yml

Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,46 @@
4848

4949
- name: Deploy "magnum-cluster-api-proxy"
5050
run_once: true
51+
vars:
52+
_magnum_cluster_api_proxy_pod_spec:
53+
containers:
54+
- name: magnum-cluster-api-proxy
55+
command: ["magnum-cluster-api-proxy"]
56+
image: "{{ atmosphere_images['magnum_cluster_api_proxy'] | vexxhost.kubernetes.docker_image('ref') }}"
57+
securityContext:
58+
privileged: true
59+
readOnlyRootFilesystem: true
60+
volumeMounts:
61+
- name: pod-tmp
62+
mountPath: /tmp
63+
- name: pod-run
64+
mountPath: /run
65+
- name: config
66+
mountPath: /etc/sudoers.d/magnum_capi_sudoers
67+
subPath: magnum_capi_sudoers
68+
readOnly: true
69+
- name: haproxy-state
70+
mountPath: /var/lib/magnum/.magnum-cluster-api-proxy
71+
- name: host-run-netns
72+
mountPath: /run/netns
73+
mountPropagation: Bidirectional
74+
nodeSelector: "{{ magnum_cluster_api_proxy_ovn_node_selector if atmosphere_network_backend == 'ovn' else magnum_cluster_api_proxy_ovs_node_selector }}" # noqa: yaml[line-length]
75+
securityContext:
76+
runAsUser: 42424
77+
serviceAccountName: magnum-conductor
78+
volumes:
79+
- name: pod-tmp
80+
emptyDir: {}
81+
- name: pod-run
82+
emptyDir: {}
83+
- name: config
84+
configMap:
85+
name: magnum-cluster-api-proxy-config
86+
- name: haproxy-state
87+
emptyDir: {}
88+
- name: host-run-netns
89+
hostPath:
90+
path: /run/netns
5191
kubernetes.core.k8s:
5292
state: present
5393
definition:
@@ -80,45 +120,7 @@
80120
labels:
81121
application: magnum
82122
component: cluster-api-proxy
83-
spec:
84-
containers:
85-
- name: magnum-cluster-api-proxy
86-
command: ["magnum-cluster-api-proxy"]
87-
image: "{{ atmosphere_images['magnum_cluster_api_proxy'] | vexxhost.kubernetes.docker_image('ref') }}"
88-
securityContext:
89-
privileged: true
90-
readOnlyRootFilesystem: true
91-
volumeMounts:
92-
- name: pod-tmp
93-
mountPath: /tmp
94-
- name: pod-run
95-
mountPath: /run
96-
- name: config
97-
mountPath: /etc/sudoers.d/magnum_capi_sudoers
98-
subPath: magnum_capi_sudoers
99-
readOnly: true
100-
- name: haproxy-state
101-
mountPath: /var/lib/magnum/.magnum-cluster-api-proxy
102-
- name: host-run-netns
103-
mountPath: /run/netns
104-
mountPropagation: Bidirectional
105-
nodeSelector: "{{ magnum_cluster_api_proxy_ovn_node_selector if atmosphere_network_backend == 'ovn' else magnum_cluster_api_proxy_ovs_node_selector }}" # noqa: yaml[line-length]
106-
securityContext:
107-
runAsUser: 42424
108-
serviceAccountName: magnum-conductor
109-
volumes:
110-
- name: pod-tmp
111-
emptyDir: {}
112-
- name: pod-run
113-
emptyDir: {}
114-
- name: config
115-
configMap:
116-
name: magnum-cluster-api-proxy-config
117-
- name: haproxy-state
118-
emptyDir: {}
119-
- name: host-run-netns
120-
hostPath:
121-
path: /run/netns
123+
spec: "{{ _magnum_cluster_api_proxy_pod_spec | combine({'priorityClassName': magnum_cluster_api_proxy_priority_class_name} if magnum_cluster_api_proxy_priority_class_name else {}) }}" # noqa: yaml[line-length]
122124

123125
- name: Create Ingress
124126
ansible.builtin.include_role:
@@ -132,6 +134,30 @@
132134

133135
- name: Deploy magnum registry
134136
run_once: true
137+
vars:
138+
_magnum_registry_pod_spec:
139+
containers:
140+
- name: registry
141+
image: "{{ atmosphere_images['magnum_registry'] | vexxhost.kubernetes.docker_image('ref') }}"
142+
env:
143+
- name: REGISTRY_STORAGE_MAINTENANCE_READONLY
144+
value: '{"enabled": true}'
145+
ports:
146+
- name: registry
147+
containerPort: 5000
148+
protocol: TCP
149+
livenessProbe:
150+
httpGet:
151+
path: /
152+
port: 5000
153+
scheme: HTTP
154+
readinessProbe:
155+
httpGet:
156+
path: /
157+
port: 5000
158+
scheme: HTTP
159+
nodeSelector:
160+
openstack-control-plane: enabled
135161
kubernetes.core.k8s:
136162
state: present
137163
definition:
@@ -154,29 +180,7 @@
154180
labels:
155181
application: magnum
156182
component: registry
157-
spec:
158-
containers:
159-
- name: registry
160-
image: "{{ atmosphere_images['magnum_registry'] | vexxhost.kubernetes.docker_image('ref') }}"
161-
env:
162-
- name: REGISTRY_STORAGE_MAINTENANCE_READONLY
163-
value: '{"enabled": true}'
164-
ports:
165-
- name: registry
166-
containerPort: 5000
167-
protocol: TCP
168-
livenessProbe:
169-
httpGet:
170-
path: /
171-
port: 5000
172-
scheme: HTTP
173-
readinessProbe:
174-
httpGet:
175-
path: /
176-
port: 5000
177-
scheme: HTTP
178-
nodeSelector:
179-
openstack-control-plane: enabled
183+
spec: "{{ _magnum_registry_pod_spec | combine({'priorityClassName': magnum_registry_priority_class_name} if magnum_registry_priority_class_name else {}) }}" # noqa: yaml[line-length]
180184

181185
- apiVersion: v1
182186
kind: Service

0 commit comments

Comments
 (0)