From 1bf9c618acba3217f2596cab5d281374f5de3e2c Mon Sep 17 00:00:00 2001 From: Daniel Reuter Date: Wed, 27 Sep 2023 10:56:31 +0200 Subject: [PATCH] feat: helm - add `priorityClassName` --- .../templates/deployment.yaml | 3 + .../__snapshot__/deployment_test.yaml.snap | 129 ++++++++++++++++++ .../tests/deployment_test.yaml | 12 ++ .../values.yaml | 3 + 4 files changed, 147 insertions(+) diff --git a/charts/steadybit-extension-prometheus/templates/deployment.yaml b/charts/steadybit-extension-prometheus/templates/deployment.yaml index f7b73fb..4a25b97 100644 --- a/charts/steadybit-extension-prometheus/templates/deployment.yaml +++ b/charts/steadybit-extension-prometheus/templates/deployment.yaml @@ -29,6 +29,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: + {{- with .Values.priorityClassName }} + priorityClassName: {{ . }} + {{- end }} {{- with .Values.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} diff --git a/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap b/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap index a75d5cd..9371316 100644 --- a/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap +++ b/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap @@ -424,6 +424,135 @@ manifest should match snapshot with mutual TLS using containerPaths: volumeMounts: null serviceAccountName: steadybit-extension-prometheus volumes: null +manifest should match snapshot with podSecurityContext: + 1: | + apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + steadybit.com/discovery-disabled: "true" + name: RELEASE-NAME-steadybit-extension-prometheus + namespace: NAMESPACE + spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: steadybit-extension-prometheus + template: + metadata: + annotations: null + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: steadybit-extension-prometheus + steadybit.com/discovery-disabled: "true" + spec: + containers: + - env: + - name: STEADYBIT_LOG_LEVEL + value: INFO + - name: STEADYBIT_LOG_FORMAT + value: text + - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_NAME + value: null + - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN + value: null + image: ghcr.io/steadybit/extension-prometheus:latest + imagePullPolicy: Always + livenessProbe: + httpGet: + path: /health/liveness + port: 8088 + name: extension + readinessProbe: + httpGet: + path: /health/readiness + port: 8088 + resources: + limits: + cpu: 200m + memory: 128Mi + requests: + cpu: 50m + memory: 32Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsGroup: 10000 + runAsNonRoot: true + runAsUser: 10000 + volumeMounts: null + securityContext: + runAsUser: 2222 + serviceAccountName: steadybit-extension-prometheus + volumes: null +manifest should match snapshot with priority class: + 1: | + apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + steadybit.com/discovery-disabled: "true" + name: RELEASE-NAME-steadybit-extension-prometheus + namespace: NAMESPACE + spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: steadybit-extension-prometheus + template: + metadata: + annotations: null + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: steadybit-extension-prometheus + steadybit.com/discovery-disabled: "true" + spec: + containers: + - env: + - name: STEADYBIT_LOG_LEVEL + value: INFO + - name: STEADYBIT_LOG_FORMAT + value: text + - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_NAME + value: null + - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN + value: null + image: ghcr.io/steadybit/extension-prometheus:latest + imagePullPolicy: Always + livenessProbe: + httpGet: + path: /health/liveness + port: 8088 + name: extension + readinessProbe: + httpGet: + path: /health/readiness + port: 8088 + resources: + limits: + cpu: 200m + memory: 128Mi + requests: + cpu: 50m + memory: 32Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsGroup: 10000 + runAsNonRoot: true + runAsUser: 10000 + volumeMounts: null + priorityClassName: my-priority-class + serviceAccountName: steadybit-extension-prometheus + volumes: null manifest should match snapshot without TLS: 1: | apiVersion: apps/v1 diff --git a/charts/steadybit-extension-prometheus/tests/deployment_test.yaml b/charts/steadybit-extension-prometheus/tests/deployment_test.yaml index 91d07a9..ee19f08 100644 --- a/charts/steadybit-extension-prometheus/tests/deployment_test.yaml +++ b/charts/steadybit-extension-prometheus/tests/deployment_test.yaml @@ -66,3 +66,15 @@ tests: tags.datadoghq.com/service: steadybit-extension asserts: - matchSnapshot: {} + - it: manifest should match snapshot with podSecurityContext + set: + podSecurityContext: + runAsUser: 2222 + asserts: + - matchSnapshot: {} + + - it: manifest should match snapshot with priority class + set: + priorityClassName: my-priority-class + asserts: + - matchSnapshot: {} diff --git a/charts/steadybit-extension-prometheus/values.yaml b/charts/steadybit-extension-prometheus/values.yaml index 9efcc8f..961ef0d 100644 --- a/charts/steadybit-extension-prometheus/values.yaml +++ b/charts/steadybit-extension-prometheus/values.yaml @@ -82,6 +82,9 @@ topologySpreadConstraints: [] # affinity -- Affinities to influence pod assignment. affinity: {} +# priorityClassName -- Priority class used to influence pod scheduling priority. +priorityClassName: "" + # podSecurityContext -- SecurityContext to apply to the pod. podSecurityContext: {}