Skip to content

Commit 798754e

Browse files
dibarogzigzigzeo
authored andcommitted
feat: Add support for using existing PriorityClass when level=0
1 parent 0b783d6 commit 798754e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

imgproxy/templates/_helpers.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht
7171
{{- if (include "imgproxy.versions.priorityClass" $) }}
7272
{{- $defaultName := (include "imgproxy.fullname" $ | printf "%s-priority") }}
7373
{{- $name := default $defaultName .name }}
74-
{{- if (has $name $systemNames | or .level) }}
74+
{{- if (has $name $systemNames | or .level | or .name) }}
7575
{{- $name }}
7676
{{- end }}
7777
{{- end }}
@@ -83,7 +83,7 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht
8383
{{- with .Values.resources.deployment.priority }}
8484
{{- $systemNames := list "set-cluster-critical" "set-node-critical" }}
8585
{{- $name := include "imgproxy.resources.priorityClassName" $ }}
86-
{{- if ($name | and (not (has $name $systemNames))) }}
86+
{{- if ($name | and (not (has $name $systemNames)) | and .level) }}
8787
{{- $name }}
8888
{{- end }}
8989
{{- end }}

imgproxy/values.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ resources:
2424
priority:
2525
# The name of the priority class to be used in both pod.PriorityClassName
2626
# and the PriorityClass (when a level is above 0).
27-
# When a level is not set, or set to 0 (default), then the definition
28-
# of the corresponding PriorityClass is up to the user.
27+
#
28+
# Usage scenarios:
29+
# 1. level > 0: A new PriorityClass will be created with this name and assigned to pods
30+
# 2. level = 0 + name provided: Use an existing PriorityClass with this name (no new PriorityClass created)
31+
# 3. level = 0 + no name: No PriorityClass will be used
32+
#
2933
# You can use system names like `set-cluster-critical` and `set-node-critical` as well,
3034
# in this case the class won't be created and level is ignored.
3135
name: ~
3236

3337
# If the level is above 0, then a correspoding PriorityClass will be created
34-
# and assigned to the pod by the `PriorityClassName`
38+
# and assigned to the pod by the `PriorityClassName`.
39+
# If level is 0 but name is provided, an existing PriorityClass with that name will be used.
3540
level: 0
3641

3742
# This setting is supported in K8s v1.19+, otherwise it will be ignored

0 commit comments

Comments
 (0)