diff --git a/charts/descheduler/README.md b/charts/descheduler/README.md index 6b2a1262c..dc9a644d7 100644 --- a/charts/descheduler/README.md +++ b/charts/descheduler/README.md @@ -69,6 +69,8 @@ The following table lists the configurable parameters of the _descheduler_ chart | `podDisruptionBudget.annotations` | Annotations to add to the PodDisruptionBudget | `{}` | | `cmdOptions` | The options to pass to the _descheduler_ command | _see values.yaml_ | | `priorityClassName` | The name of the priority class to add to pods | `system-cluster-critical` | +| `schedulerName` | The name of the scheduler used to schedule the descheduler cronjob/deployment pods | `""` | +| `runtimeClassName` | The RuntimeClass applied to the descheduler cronjob/deployment pods | `""` | | `rbac.create` | If `true`, create & use RBAC resources | `true` | | `resources` | Descheduler container CPU and memory requests/limits | _see values.yaml_ | | `serviceAccount.create` | If `true`, create a service account for the cron job | `true` | diff --git a/charts/descheduler/templates/cronjob.yaml b/charts/descheduler/templates/cronjob.yaml index 7ab688a8c..611687ec5 100644 --- a/charts/descheduler/templates/cronjob.yaml +++ b/charts/descheduler/templates/cronjob.yaml @@ -87,6 +87,12 @@ spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName }} + {{- end }} + {{- if .Values.runtimeClassName }} + runtimeClassName: {{ .Values.runtimeClassName }} + {{- end }} serviceAccountName: {{ template "descheduler.serviceAccountName" . }} {{- if kindIs "bool" .Values.automountServiceAccountToken }} automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} diff --git a/charts/descheduler/templates/deployment.yaml b/charts/descheduler/templates/deployment.yaml index 86a331062..9bde9a2f3 100644 --- a/charts/descheduler/templates/deployment.yaml +++ b/charts/descheduler/templates/deployment.yaml @@ -41,6 +41,12 @@ spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName }} + {{- end }} + {{- if .Values.runtimeClassName }} + runtimeClassName: {{ .Values.runtimeClassName }} + {{- end }} serviceAccountName: {{ template "descheduler.serviceAccountName" . }} {{- if kindIs "bool" .Values.automountServiceAccountToken }} automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} diff --git a/charts/descheduler/tests/cronjob_test.yaml b/charts/descheduler/tests/cronjob_test.yaml index 3a3d7e195..1d25437f0 100644 --- a/charts/descheduler/tests/cronjob_test.yaml +++ b/charts/descheduler/tests/cronjob_test.yaml @@ -15,3 +15,29 @@ tests: asserts: - isKind: of: CronJob + + - it: sets schedulerName when provided + set: + schedulerName: custom-scheduler + template: templates/cronjob.yaml + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.schedulerName + value: custom-scheduler + + - it: sets runtimeClassName when provided + set: + runtimeClassName: gvisor + template: templates/cronjob.yaml + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.runtimeClassName + value: gvisor + + - it: omits schedulerName and runtimeClassName by default + template: templates/cronjob.yaml + asserts: + - notExists: + path: spec.jobTemplate.spec.template.spec.schedulerName + - notExists: + path: spec.jobTemplate.spec.template.spec.runtimeClassName diff --git a/charts/descheduler/tests/deployment_test.yaml b/charts/descheduler/tests/deployment_test.yaml index fa4d62be4..7e6607cac 100644 --- a/charts/descheduler/tests/deployment_test.yaml +++ b/charts/descheduler/tests/deployment_test.yaml @@ -47,3 +47,29 @@ tests: - contains: path: spec.template.spec.containers[0].args content: --leader-elect-resource-namespace=typo + + - it: sets schedulerName when provided + set: + schedulerName: custom-scheduler + template: templates/deployment.yaml + asserts: + - equal: + path: spec.template.spec.schedulerName + value: custom-scheduler + + - it: sets runtimeClassName when provided + set: + runtimeClassName: gvisor + template: templates/deployment.yaml + asserts: + - equal: + path: spec.template.spec.runtimeClassName + value: gvisor + + - it: omits schedulerName and runtimeClassName by default + template: templates/deployment.yaml + asserts: + - notExists: + path: spec.template.spec.schedulerName + - notExists: + path: spec.template.spec.runtimeClassName diff --git a/charts/descheduler/values.yaml b/charts/descheduler/values.yaml index b0d1bbbfb..b3a5e13c5 100644 --- a/charts/descheduler/values.yaml +++ b/charts/descheduler/values.yaml @@ -164,6 +164,14 @@ deschedulerPolicy: priorityClassName: system-cluster-critical +# schedulerName is the name of the scheduler used to schedule the descheduler pods. +# Leave empty to use the cluster default scheduler. +schedulerName: "" + +# runtimeClassName is the RuntimeClass applied to the descheduler pods. +# Leave empty to use the cluster default runtime. +runtimeClassName: "" + nodeSelector: {} # foo: bar