From 6b7cb070c7d88878fee758c84642691523d38067 Mon Sep 17 00:00:00 2001 From: Sanket Sudake Date: Mon, 8 Nov 2021 10:51:29 +0530 Subject: [PATCH] Add support to mention priorityClassName for Fission components (#2254) In Fission CI as well in a couple of scenarios, noticed Fission pods getting preempted when Function pods are getting created. As both Fission components and function pods have the same priority class fission component pods might get preempted. It to be recommended to set higher priority class for components such as Fission router, executor, controller so that Fission functioning doesn't get disrupted. Most of the Fission components work fine with restart except the executor. So user should set priorityClass for Fission executor. Signed-off-by: Sanket Sudake --- .../templates/buildermgr/deployment.yaml | 3 +++ .../templates/controller/deployment.yaml | 3 +++ .../templates/executor/deployment.yaml | 5 +++++ .../templates/kubewatcher/deployment.yaml | 3 +++ .../templates/mqt-keda/deployment.yaml | 3 +++ .../templates/router/deployment.yaml | 5 +++++ .../templates/storagesvc/deployment.yaml | 3 +++ .../fission-all/templates/timer/deployment.yaml | 3 +++ charts/fission-all/values.yaml | 17 +++++++++++++++++ skaffold.yaml | 1 + 10 files changed, 46 insertions(+) diff --git a/charts/fission-all/templates/buildermgr/deployment.yaml b/charts/fission-all/templates/buildermgr/deployment.yaml index aa210c3c4..03078417f 100644 --- a/charts/fission-all/templates/buildermgr/deployment.yaml +++ b/charts/fission-all/templates/buildermgr/deployment.yaml @@ -49,6 +49,9 @@ spec: {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} serviceAccountName: fission-svc +{{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} \ No newline at end of file diff --git a/charts/fission-all/templates/controller/deployment.yaml b/charts/fission-all/templates/controller/deployment.yaml index c576b2544..a0ea1aada 100644 --- a/charts/fission-all/templates/controller/deployment.yaml +++ b/charts/fission-all/templates/controller/deployment.yaml @@ -66,6 +66,9 @@ spec: - name: config-volume configMap: name: feature-config +{{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} \ No newline at end of file diff --git a/charts/fission-all/templates/executor/deployment.yaml b/charts/fission-all/templates/executor/deployment.yaml index c392338c9..845d362b9 100644 --- a/charts/fission-all/templates/executor/deployment.yaml +++ b/charts/fission-all/templates/executor/deployment.yaml @@ -79,6 +79,11 @@ spec: name: pprof {{- end }} serviceAccountName: fission-svc +{{- if .Values.executor.priorityClassName }} + priorityClassName: {{ .Values.executor.priorityClassName }} +{{- else if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} \ No newline at end of file diff --git a/charts/fission-all/templates/kubewatcher/deployment.yaml b/charts/fission-all/templates/kubewatcher/deployment.yaml index ed67a7129..39bf036c2 100644 --- a/charts/fission-all/templates/kubewatcher/deployment.yaml +++ b/charts/fission-all/templates/kubewatcher/deployment.yaml @@ -29,6 +29,9 @@ spec: {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} serviceAccountName: fission-svc +{{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} diff --git a/charts/fission-all/templates/mqt-keda/deployment.yaml b/charts/fission-all/templates/mqt-keda/deployment.yaml index 61c3b8478..2ad1054a2 100644 --- a/charts/fission-all/templates/mqt-keda/deployment.yaml +++ b/charts/fission-all/templates/mqt-keda/deployment.yaml @@ -47,6 +47,9 @@ spec: {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} serviceAccountName: fission-svc +{{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} diff --git a/charts/fission-all/templates/router/deployment.yaml b/charts/fission-all/templates/router/deployment.yaml index 034808479..a9ac2b8ae 100644 --- a/charts/fission-all/templates/router/deployment.yaml +++ b/charts/fission-all/templates/router/deployment.yaml @@ -90,6 +90,11 @@ spec: name: pprof {{- end }} serviceAccountName: fission-svc +{{- if .Values.router.priorityClassName }} + priorityClassName: {{ .Values.router.priorityClassName }} +{{- else if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.router.extraCoreComponentPodConfig }} {{ toYaml .Values.router.extraCoreComponentPodConfig | indent 6 -}} {{- else }} diff --git a/charts/fission-all/templates/storagesvc/deployment.yaml b/charts/fission-all/templates/storagesvc/deployment.yaml index 6aab88a4d..83ed777da 100644 --- a/charts/fission-all/templates/storagesvc/deployment.yaml +++ b/charts/fission-all/templates/storagesvc/deployment.yaml @@ -87,6 +87,9 @@ spec: - name: fission-storage emptyDir: {} {{- end }} +{{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} +{{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} diff --git a/charts/fission-all/templates/timer/deployment.yaml b/charts/fission-all/templates/timer/deployment.yaml index bb14b8aab..f770f8ebd 100644 --- a/charts/fission-all/templates/timer/deployment.yaml +++ b/charts/fission-all/templates/timer/deployment.yaml @@ -29,6 +29,9 @@ spec: {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} serviceAccountName: fission-svc + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} {{- end }} \ No newline at end of file diff --git a/charts/fission-all/values.yaml b/charts/fission-all/values.yaml index 8e6f51a3b..871218cf2 100644 --- a/charts/fission-all/values.yaml +++ b/charts/fission-all/values.yaml @@ -31,6 +31,13 @@ imageTag: v1.15.0-rc2 ## pullPolicy: IfNotPresent +## priorityClassName represents the priority class name to use for Fission components. +## Refer to https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ +## executor.priorityClassName takes precedence over this value for executor. +## router.priorityClassName takes precedence over this value for router. +## +priorityClassName: "" + ## controllerPort represents the port at which the Fission controller service should be exposed. ## controllerPort: 31313 @@ -87,6 +94,11 @@ fetcher: ## executor is responsible for providing resources to your functions. ## executor: + ## executor priorityClassName + ## Ref. https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ + ## Recommended to use system-cluster-critical for executor pods. + ## + priorityClassName: "" ## adoptExistingResources decides whether to adopt existing resources when executor restarts or Fission is redeployed. ## adoptExistingResources: false @@ -98,6 +110,11 @@ executor: ## router is responsible for routing function calls to the appropriate function. ## router: + ## router priorityClassName + ## Ref. https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ + ## Recommended to use system-cluster-critical for router pods. + ## + priorityClassName: "" ## deployAsDaemonSet decides whether to deploy router as a DaemonSet or a Deployment. ## deployAsDaemonSet: false diff --git a/skaffold.yaml b/skaffold.yaml index 0aed85019..4e4630e02 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -53,6 +53,7 @@ deploy: openTracing.enabled: false openTelemetry.otlpCollectorEndpoint: "" openTelemetry.otlpInsecure: true + priorityClassName: "system-cluster-critical" wait: true flags: install: