From 547e1b0d83c36fb7393b31043fe4d52803473ea3 Mon Sep 17 00:00:00 2001 From: Sanket Sudake Date: Wed, 10 Nov 2021 08:47:54 +0530 Subject: [PATCH] Add termination policy customization in helm chart (#2255) Currently default pod termination logs go to /dev/termination-log. With CI we need to change customize path somewhere to /var/log for exporting logs with the kind export logs command. Setting FallbackToLogsOnError as termination policy for skaffold. Signed-off-by: Sanket Sudake --- .../templates/analytics/post-install-job.yaml | 6 +++++ .../templates/analytics/post-upgrade-job.yaml | 6 +++++ .../templates/buildermgr/deployment.yaml | 6 +++++ .../templates/controller/deployment.yaml | 7 ++++++ .../templates/executor/deployment.yaml | 10 ++++++++ .../templates/kubewatcher/deployment.yaml | 6 +++++ .../deployment.yaml | 6 +++++ .../mqt-fission-kafka/deployment.yaml | 6 +++++ .../mqt-fission-nats/deployment.yaml | 6 +++++ .../templates/mqt-keda/deployment.yaml | 6 +++++ .../pre-upgrade-checks/pre-upgrade-job.yaml | 6 +++++ .../templates/router/deployment.yaml | 10 ++++++++ .../templates/storagesvc/deployment.yaml | 6 +++++ .../templates/timer/deployment.yaml | 6 +++++ charts/fission-all/values.yaml | 24 +++++++++++++++++++ skaffold.yaml | 5 +++- 16 files changed, 121 insertions(+), 1 deletion(-) diff --git a/charts/fission-all/templates/analytics/post-install-job.yaml b/charts/fission-all/templates/analytics/post-install-job.yaml index e570fb2b..d78c4c56 100644 --- a/charts/fission-all/templates/analytics/post-install-job.yaml +++ b/charts/fission-all/templates/analytics/post-install-job.yaml @@ -41,5 +41,11 @@ spec: env: - name: GA_TRACKING_ID value: "{{ .Values.gaTrackingID }}" + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- end }} diff --git a/charts/fission-all/templates/analytics/post-upgrade-job.yaml b/charts/fission-all/templates/analytics/post-upgrade-job.yaml index 8dec148f..313f6c17 100644 --- a/charts/fission-all/templates/analytics/post-upgrade-job.yaml +++ b/charts/fission-all/templates/analytics/post-upgrade-job.yaml @@ -41,5 +41,11 @@ spec: env: - name: GA_TRACKING_ID value: "{{ .Values.gaTrackingID }}" + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- end }} diff --git a/charts/fission-all/templates/buildermgr/deployment.yaml b/charts/fission-all/templates/buildermgr/deployment.yaml index 03078417..f7fb573f 100644 --- a/charts/fission-all/templates/buildermgr/deployment.yaml +++ b/charts/fission-all/templates/buildermgr/deployment.yaml @@ -48,6 +48,12 @@ spec: value: {{ .Values.pprof.enabled | quote }} {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/charts/fission-all/templates/controller/deployment.yaml b/charts/fission-all/templates/controller/deployment.yaml index a0ea1aad..9df2919f 100644 --- a/charts/fission-all/templates/controller/deployment.yaml +++ b/charts/fission-all/templates/controller/deployment.yaml @@ -37,6 +37,12 @@ spec: fieldPath: metadata.namespace {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} readinessProbe: httpGet: path: "/healthz" @@ -61,6 +67,7 @@ spec: - containerPort: 6060 name: pprof {{- end }} + serviceAccountName: fission-svc volumes: - name: config-volume diff --git a/charts/fission-all/templates/executor/deployment.yaml b/charts/fission-all/templates/executor/deployment.yaml index 845d362b..86e8289b 100644 --- a/charts/fission-all/templates/executor/deployment.yaml +++ b/charts/fission-all/templates/executor/deployment.yaml @@ -78,6 +78,16 @@ spec: - containerPort: 6060 name: pprof {{- end }} + {{- if .Values.executor.terminationMessagePath }} + terminationMessagePath: {{ .Values.executor.terminationMessagePath }} + {{- else if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.executor.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.executor.terminationMessagePolicy }} + {{- else if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.executor.priorityClassName }} priorityClassName: {{ .Values.executor.priorityClassName }} diff --git a/charts/fission-all/templates/kubewatcher/deployment.yaml b/charts/fission-all/templates/kubewatcher/deployment.yaml index 39bf036c..8409050f 100644 --- a/charts/fission-all/templates/kubewatcher/deployment.yaml +++ b/charts/fission-all/templates/kubewatcher/deployment.yaml @@ -28,6 +28,12 @@ spec: value: {{ .Values.pprof.enabled | quote }} {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/charts/fission-all/templates/mqt-fission-azurestoragequeue/deployment.yaml b/charts/fission-all/templates/mqt-fission-azurestoragequeue/deployment.yaml index 35c0a55d..61eb5e02 100644 --- a/charts/fission-all/templates/mqt-fission-azurestoragequeue/deployment.yaml +++ b/charts/fission-all/templates/mqt-fission-azurestoragequeue/deployment.yaml @@ -45,6 +45,12 @@ spec: value: {{ .Values.pprof.enabled | quote }} {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.extraCoreComponentPodConfig }} {{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}} diff --git a/charts/fission-all/templates/mqt-fission-kafka/deployment.yaml b/charts/fission-all/templates/mqt-fission-kafka/deployment.yaml index 406cc054..549b61de 100644 --- a/charts/fission-all/templates/mqt-fission-kafka/deployment.yaml +++ b/charts/fission-all/templates/mqt-fission-kafka/deployment.yaml @@ -55,6 +55,12 @@ spec: - name: kafka-secrets mountPath: /etc/fission/secrets {{- end }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.kafka.authentication.tls.enabled }} volumes: diff --git a/charts/fission-all/templates/mqt-fission-nats/deployment.yaml b/charts/fission-all/templates/mqt-fission-nats/deployment.yaml index 3881962f..7851099e 100644 --- a/charts/fission-all/templates/mqt-fission-nats/deployment.yaml +++ b/charts/fission-all/templates/mqt-fission-nats/deployment.yaml @@ -51,6 +51,12 @@ spec: port: 4223 initialDelaySeconds: 30 periodSeconds: 5 + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- 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 2ad1054a..00073a67 100644 --- a/charts/fission-all/templates/mqt-keda/deployment.yaml +++ b/charts/fission-all/templates/mqt-keda/deployment.yaml @@ -46,6 +46,12 @@ spec: value: "{{ .Values.mqt_keda.connector_images.redis.image }}:{{ .Values.mqt_keda.connector_images.redis.tag }}" {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/charts/fission-all/templates/pre-upgrade-checks/pre-upgrade-job.yaml b/charts/fission-all/templates/pre-upgrade-checks/pre-upgrade-job.yaml index bd7cf1cb..aafcea74 100644 --- a/charts/fission-all/templates/pre-upgrade-checks/pre-upgrade-job.yaml +++ b/charts/fission-all/templates/pre-upgrade-checks/pre-upgrade-job.yaml @@ -35,5 +35,11 @@ spec: imagePullPolicy: {{ .Values.pullPolicy }} command: [ "/pre-upgrade-checks" ] args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"] + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- end }} diff --git a/charts/fission-all/templates/router/deployment.yaml b/charts/fission-all/templates/router/deployment.yaml index a9ac2b8a..58b06a9a 100644 --- a/charts/fission-all/templates/router/deployment.yaml +++ b/charts/fission-all/templates/router/deployment.yaml @@ -89,6 +89,16 @@ spec: - containerPort: 6060 name: pprof {{- end }} + {{- if .Values.router.terminationMessagePath }} + terminationMessagePath: {{ .Values.router.terminationMessagePath }} + {{- else if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.router.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.router.terminationMessagePolicy }} + {{- else if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.router.priorityClassName }} priorityClassName: {{ .Values.router.priorityClassName }} diff --git a/charts/fission-all/templates/storagesvc/deployment.yaml b/charts/fission-all/templates/storagesvc/deployment.yaml index 83ed777d..bd6f801e 100644 --- a/charts/fission-all/templates/storagesvc/deployment.yaml +++ b/charts/fission-all/templates/storagesvc/deployment.yaml @@ -76,6 +76,12 @@ spec: - containerPort: 6060 name: pprof {{- end }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if and (.Values.persistence.enabled) (ne (.Values.persistence.storageType | default "local") "s3") }} volumes: diff --git a/charts/fission-all/templates/timer/deployment.yaml b/charts/fission-all/templates/timer/deployment.yaml index f770f8eb..1a63f973 100644 --- a/charts/fission-all/templates/timer/deployment.yaml +++ b/charts/fission-all/templates/timer/deployment.yaml @@ -28,6 +28,12 @@ spec: value: {{ .Values.pprof.enabled | quote }} {{- include "opentracing.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }} + {{- if .Values.terminationMessagePath }} + terminationMessagePath: {{ .Values.terminationMessagePath }} + {{- end }} + {{- if .Values.terminationMessagePolicy }} + terminationMessagePolicy: {{ .Values.terminationMessagePolicy }} + {{- end }} serviceAccountName: fission-svc {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} diff --git a/charts/fission-all/values.yaml b/charts/fission-all/values.yaml index 851b1647..7b30d40a 100644 --- a/charts/fission-all/values.yaml +++ b/charts/fission-all/values.yaml @@ -38,6 +38,18 @@ pullPolicy: IfNotPresent ## priorityClassName: "" +## terminationMessagePath is the path at which the pod termination message will be written. +## executor.terminationMessagePath takes precedence over this value for executor. +## router.terminationMessagePath takes precedence over this value for router. +## +terminationMessagePath: /dev/termination-log + +## terminationMessagePolicy is the policy for the termination message. +## executor.terminationMessagePolicy takes precedence over this value for executor. +## router.terminationMessagePolicy takes precedence over this value for router. +## +terminationMessagePolicy: File + ## controllerPort represents the port at which the Fission controller service should be exposed. ## controllerPort: 31313 @@ -99,6 +111,12 @@ executor: ## Recommended to use system-cluster-critical for executor pods. ## priorityClassName: "" + ## terminationMessagePath is the path at which the file to which the executor will write a message upon termination. + ## + terminationMessagePath: "" + ## terminationMessagePolicy is the policy for the executor termination message. + ## + terminationMessagePolicy: "" ## adoptExistingResources decides whether to adopt existing resources when executor restarts or Fission is redeployed. ## adoptExistingResources: false @@ -115,6 +133,12 @@ router: ## Recommended to use system-cluster-critical for router pods. ## priorityClassName: "" + ## terminationMessagePath is the path at which the file to which the router will write a message upon termination. + ## + terminationMessagePath: "" + ## terminationMessagePolicy is the policy for the router termination message. + ## + terminationMessagePolicy: "" ## deployAsDaemonSet decides whether to deploy router as a DaemonSet or a Deployment. ## deployAsDaemonSet: false diff --git a/skaffold.yaml b/skaffold.yaml index 4e4630e0..45c81d89 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -53,7 +53,10 @@ deploy: openTracing.enabled: false openTelemetry.otlpCollectorEndpoint: "" openTelemetry.otlpInsecure: true - priorityClassName: "system-cluster-critical" + priorityClassName: system-cluster-critical + # Use /var/log directory for kind logs export + terminationMessagePath: /var/log/termination-log + terminationMessagePolicy: FallbackToLogsOnError wait: true flags: install: