Enable {priority,runtime}ClassName for Horizon

Change-Id: Idf39761d053be67dcd7165ca93699a25ecb53555
This commit is contained in:
Dong Ma committed 2025-02-10 13:19:19 +00:00
1 parent 4189c2b89e
commit 6be0a4838d
8 files changed
+211

No files matched your search

+6
View File
@@ -48,6 +48,12 @@ spec:
{{- end }}
{{ dict "envAll" $envAll "podName" "horizon" "containerNames" (list "horizon" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
{{ with .Values.pod.priorityClassName.horizon }}
priorityClassName: {{ . }}
{{ end }}
{{ with .Values.pod.runtimeClassName.horizon }}
runtimeClassName: {{ . }}
{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "horizon" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
affinity:
@@ -41,6 +41,12 @@ spec:
annotations:
{{ dict "envAll" $envAll "podName" "horizon-db-sync" "containerNames" (list "horizon-db-sync" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
{{ with .Values.pod.priorityClassName.db_sync }}
priorityClassName: {{ . }}
{{ end }}
{{ with .Values.pod.runtimeClassName.db_sync }}
runtimeClassName: {{ . }}
{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "db_sync" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
restartPolicy: OnFailure
@@ -34,6 +34,12 @@ metadata:
spec:
{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
restartPolicy: Never
{{ with .Values.pod.priorityClassName.horizon_tests }}
priorityClassName: {{ . }}
{{ end }}
{{ with .Values.pod.runtimeClassName.horizon_tests }}
runtimeClassName: {{ . }}
{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ if $envAll.Values.pod.tolerations.horizon.enabled }}
{{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
+8
View File
@@ -1103,6 +1103,14 @@ dependencies:
service: dashboard
pod:
priorityClassName:
horizon: null
horizon_tests: null
db_sync: null
runtimeClassName:
horizon: null
horizon_tests: null
db_sync: null
security_context:
horizon:
pod:
@@ -0,0 +1,85 @@
From 2db1eab6b5df7070e93d11cbbbcd492aa849ad9c Mon Sep 17 00:00:00 2001
From: Dong Ma <dong.ma@vexxhost.com>
Date: Mon, 10 Feb 2025 13:14:30 +0000
Subject: [PATCH] Enable {priority,runtime}ClassName for Horizon
---
horizon/templates/deployment.yaml | 6 ++++++
horizon/templates/job-db-sync.yaml | 6 ++++++
horizon/templates/pod-helm-tests.yaml | 6 ++++++
horizon/values.yaml | 8 ++++++++
4 files changed, 26 insertions(+)
diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml
index 0037fef3..666edd65 100644
--- a/horizon/templates/deployment.yaml
+++ b/horizon/templates/deployment.yaml
@@ -48,6 +48,12 @@ spec:
{{- end }}
{{ dict "envAll" $envAll "podName" "horizon" "containerNames" (list "horizon" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
+{{ with .Values.pod.priorityClassName.horizon }}
+ priorityClassName: {{ . }}
+{{ end }}
+{{ with .Values.pod.runtimeClassName.horizon }}
+ runtimeClassName: {{ . }}
+{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "horizon" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
affinity:
diff --git a/horizon/templates/job-db-sync.yaml b/horizon/templates/job-db-sync.yaml
index c2229cdd..8ae8643f 100644
--- a/horizon/templates/job-db-sync.yaml
+++ b/horizon/templates/job-db-sync.yaml
@@ -41,6 +41,12 @@ spec:
annotations:
{{ dict "envAll" $envAll "podName" "horizon-db-sync" "containerNames" (list "horizon-db-sync" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
+{{ with .Values.pod.priorityClassName.db_sync }}
+ priorityClassName: {{ . }}
+{{ end }}
+{{ with .Values.pod.runtimeClassName.db_sync }}
+ runtimeClassName: {{ . }}
+{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "db_sync" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
restartPolicy: OnFailure
diff --git a/horizon/templates/pod-helm-tests.yaml b/horizon/templates/pod-helm-tests.yaml
index 7d163039..4513053b 100644
--- a/horizon/templates/pod-helm-tests.yaml
+++ b/horizon/templates/pod-helm-tests.yaml
@@ -34,6 +34,12 @@ metadata:
spec:
{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
restartPolicy: Never
+{{ with .Values.pod.priorityClassName.horizon_tests }}
+ priorityClassName: {{ . }}
+{{ end }}
+{{ with .Values.pod.runtimeClassName.horizon_tests }}
+ runtimeClassName: {{ . }}
+{{ end }}
serviceAccountName: {{ $serviceAccountName }}
{{ if $envAll.Values.pod.tolerations.horizon.enabled }}
{{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
diff --git a/horizon/values.yaml b/horizon/values.yaml
index 4a060452..b3782c57 100644
--- a/horizon/values.yaml
+++ b/horizon/values.yaml
@@ -1103,6 +1103,14 @@ dependencies:
service: dashboard
pod:
+ priorityClassName:
+ horizon: null
+ horizon_tests: null
+ db_sync: null
+ runtimeClassName:
+ horizon: null
+ horizon_tests: null
+ db_sync: null
security_context:
horizon:
pod:
--
2.34.1
@@ -0,0 +1,4 @@
---
features:
- The Horizon role now allows users to configure the ``priorityClassName`` and
the ``runtimeClassName`` for all of the different components of the service.
@@ -0,0 +1,48 @@
suite: priorityclass
tests:
- it: should support not having a priority class
templates:
- templates/deployment.yaml
- templates/pod-helm-tests.yaml
- templates/job-db-sync.yaml
asserts:
- template: templates/deployment.yaml
documentIndex: 3
notExists:
path: spec.template.spec.priorityClassName
- template: templates/pod-helm-tests.yaml
documentIndex: 3
notExists:
path: spec.priorityClassName
- template: templates/job-db-sync.yaml
documentIndex: 3
notExists:
path: spec.template.spec.priorityClassName
- it: should support setting a priority class
templates:
- templates/deployment.yaml
- templates/pod-helm-tests.yaml
- templates/job-db-sync.yaml
set:
pod:
priorityClassName:
horizon: platform
horizon_tests: platform
db_sync: platform
asserts:
- template: templates/deployment.yaml
documentIndex: 3
equal:
path: spec.template.spec.priorityClassName
value: platform
- template: templates/pod-helm-tests.yaml
documentIndex: 3
equal:
path: spec.priorityClassName
value: platform
- template: templates/job-db-sync.yaml
documentIndex: 3
equal:
path: spec.template.spec.priorityClassName
value: platform
@@ -0,0 +1,48 @@
suite: runtimeclass
tests:
- it: should support not having a runtime class
templates:
- templates/deployment.yaml
- templates/pod-helm-tests.yaml
- templates/job-db-sync.yaml
asserts:
- template: templates/deployment.yaml
documentIndex: 3
notExists:
path: spec.template.spec.runtimeClassName
- template: templates/pod-helm-tests.yaml
documentIndex: 3
notExists:
path: spec.runtimeClassName
- template: templates/job-db-sync.yaml
documentIndex: 3
notExists:
path: spec.template.spec.runtimeClassName
- it: should support setting a runtime class
templates:
- templates/deployment.yaml
- templates/pod-helm-tests.yaml
- templates/job-db-sync.yaml
set:
pod:
runtimeClassName:
horizon: kata-clh
horizon_tests: kata-clh
db_sync: kata-clh
asserts:
- template: templates/deployment.yaml
documentIndex: 3
equal:
path: spec.template.spec.runtimeClassName
value: kata-clh
- template: templates/pod-helm-tests.yaml
documentIndex: 3
equal:
path: spec.runtimeClassName
value: kata-clh
- template: templates/job-db-sync.yaml
documentIndex: 3
equal:
path: spec.template.spec.runtimeClassName
value: kata-clh