From 7dccac44b4b5cae9f462458cb35781443da5b618 Mon Sep 17 00:00:00 2001 From: dibaro Date: Mon, 22 Sep 2025 14:17:32 +0330 Subject: [PATCH] feat: Add support for using existing PriorityClass when level=0 --- imgproxy/templates/_helpers.tpl | 4 ++-- imgproxy/values.yaml | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/imgproxy/templates/_helpers.tpl b/imgproxy/templates/_helpers.tpl index d7c68a9..af16ef1 100644 --- a/imgproxy/templates/_helpers.tpl +++ b/imgproxy/templates/_helpers.tpl @@ -71,7 +71,7 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht {{- if (include "imgproxy.versions.priorityClass" $) }} {{- $defaultName := (include "imgproxy.fullname" $ | printf "%s-priority") }} {{- $name := default $defaultName .name }} - {{- if (has $name $systemNames | or .level) }} + {{- if (has $name $systemNames | or .level | or .name) }} {{- $name }} {{- end }} {{- end }} @@ -83,7 +83,7 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht {{- with .Values.resources.deployment.priority }} {{- $systemNames := list "set-cluster-critical" "set-node-critical" }} {{- $name := include "imgproxy.resources.priorityClassName" $ }} - {{- if ($name | and (not (has $name $systemNames))) }} + {{- if ($name | and (not (has $name $systemNames)) | and .level) }} {{- $name }} {{- end }} {{- end }} diff --git a/imgproxy/values.yaml b/imgproxy/values.yaml index 6f94cb2..2aae280 100644 --- a/imgproxy/values.yaml +++ b/imgproxy/values.yaml @@ -26,14 +26,19 @@ resources: # The name of the priority class to be used in both pod.PriorityClassName # and the PriorityClass (when a level is above 0). - # When a level is not set, or set to 0 (default), then the definition - # of the corresponding PriorityClass is up to the user. + # + # Usage scenarios: + # 1. level > 0: A new PriorityClass will be created with this name and assigned to pods + # 2. level = 0 + name provided: Use an existing PriorityClass with this name (no new PriorityClass created) + # 3. level = 0 + no name: No PriorityClass will be used + # # You can use system names like `set-cluster-critical` and `set-node-critical` as well, # in this case the class won't be created and level is ignored. name: ~ # If the level is above 0, then a correspoding PriorityClass will be created - # and assigned to the pod by the `PriorityClassName` + # and assigned to the pod by the `PriorityClassName`. + # If level is 0 but name is provided, an existing PriorityClass with that name will be used. level: 0 # This setting is supported in K8s v1.19+, otherwise it will be ignored