From 7b00d34c83c3d54548864e8bbb200f5df2e4ff64 Mon Sep 17 00:00:00 2001 From: Stephan Feurer Date: Wed, 17 Apr 2024 11:08:46 +0200 Subject: [PATCH] Add priorityclass system-cluster-critical to operator Ensure this component has precedence over user deployed workload. --- component/alerts-exporter.jsonnet | 13 +++++++++++++ .../apps_v1_deployment_alerts-exporter.yaml | 1 + .../apps_v1_deployment_alerts-exporter.yaml | 1 + 3 files changed, 15 insertions(+) diff --git a/component/alerts-exporter.jsonnet b/component/alerts-exporter.jsonnet index 7fb0dc1..f965881 100644 --- a/component/alerts-exporter.jsonnet +++ b/component/alerts-exporter.jsonnet @@ -41,6 +41,18 @@ local extraArgsPatch = [ value: arg, }, params.exporter.extraArgs); +local setPriorityClass = { + patch: ||| + - op: add + path: "/spec/template/spec/priorityClassName" + value: "system-cluster-critical" + |||, + target: { + kind: 'Deployment', + name: 'alerts-exporter', + }, +}; + com.Kustomization( '%(repository)s//%(subdir)s' % params.manifests, params.manifests.version, @@ -66,6 +78,7 @@ com.Kustomization( name: 'alerts-exporter', }, }, + setPriorityClass, ], labels+: [ { diff --git a/tests/golden/defaults/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml b/tests/golden/defaults/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml index 4b38fe5..0e00d96 100644 --- a/tests/golden/defaults/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml +++ b/tests/golden/defaults/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml @@ -67,6 +67,7 @@ spec: capabilities: drop: - ALL + priorityClassName: system-cluster-critical securityContext: runAsNonRoot: true seccompProfile: diff --git a/tests/golden/openshift4/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml b/tests/golden/openshift4/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml index 6aa5d3c..9f1a788 100644 --- a/tests/golden/openshift4/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml +++ b/tests/golden/openshift4/alerts-exporter/alerts-exporter/apps_v1_deployment_alerts-exporter.yaml @@ -72,6 +72,7 @@ spec: capabilities: drop: - ALL + priorityClassName: system-cluster-critical securityContext: runAsNonRoot: true seccompProfile: