Skip to content

Commit

Permalink
feat(base-cluster): add priorityClassName to critical applications (#535
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cwrau authored Sep 14, 2023
1 parent 960ee47 commit abcce53
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 7 deletions.
6 changes: 6 additions & 0 deletions charts/base-cluster/ci/priorityclasses-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global:
priorityClasses:
test:
value: 600
description: tesssssssst
preemptionPolicy: Never
1 change: 1 addition & 0 deletions charts/base-cluster/templates/backup/velero.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
deployNodeAgent: true # enable FSB
nodeAgent:
resources: {{- .Values.backup.nodeAgent.resources | toYaml | nindent 8 }}
priorityClassName: system-cluster-critical
configuration:
{{- if .Values.backup.backupStorageLocations }}
backupStorageLocation: {{- range $name, $spec := .Values.backup.backupStorageLocations }}
Expand Down
2 changes: 2 additions & 0 deletions charts/base-cluster/templates/cert-manager/cert-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
namespace: monitoring
{{- end }}
values:
global:
priorityClassName: cluster-components
installCRDs: true
{{- if .Values.global.imageRegistry }}
image:
Expand Down
1 change: 1 addition & 0 deletions charts/base-cluster/templates/descheduler/descheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
values:
cronJobApiVersion: {{ include "common.capabilities.cronjob.apiVersion" . }}
startingDeadlineSeconds: 120
priorityClassName: system-cluster-critical
deschedulerPolicy:
evictLocalStoragePods: true
strategies: {{- .Values.descheduler.strategies | toYaml | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions charts/base-cluster/templates/dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
namespace: monitoring
{{- end }}
values:
priorityClassName: cluster-components
{{- if .Values.global.imageRegistry }}
global:
imageRegistry: {{ $.Values.global.imageRegistry }}
Expand Down
13 changes: 13 additions & 0 deletions charts/base-cluster/templates/global/priorityClasses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- $defaultClasses := dict "cluster-components" (dict "value" 500000000) "monitoring-components" (dict "value" 250000000) -}}
{{- $priorityClasses := merge $defaultClasses .Values.global.priorityClasses -}}
{{- range $priorityClassName, $priorityClass := $priorityClasses }}
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: {{ $priorityClassName }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
description: {{ $priorityClass.description }}
preemptionPolicy: {{ $priorityClass.preemptionPolicy | default "PreemptLowerPriority" }}
value: {{ $priorityClass.value }}
---
{{- end }}
1 change: 1 addition & 0 deletions charts/base-cluster/templates/global/reflector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
spec: {{- include "base-cluster.helm.chartSpec" (dict "repo" "emberstack" "chart" "reflector" "context" $) | nindent 6 }}
interval: 1h
values:
priorityClassName: cluster-components
{{- if .Values.global.imageRegistry }}
image:
repository: {{ printf "%s/emberstack/kubernetes-reflector" $.Values.global.imageRegistry }}
Expand Down
1 change: 1 addition & 0 deletions charts/base-cluster/templates/ingress/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
{{- end }}
values:
controller:
priorityClassName: system-cluster-critical
watchIngressWithoutClass: true
metrics:
enabled: {{ .Values.monitoring.prometheus.enabled }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ alertmanagerSpec:
externalUrl: https://{{ include "base-cluster.alertmanager.host" $ }}
{{- end }}
retention: {{ .Values.monitoring.prometheus.alertmanager.retentionDuration }}
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
storageSpec:
volumeClaimTemplate:
spec: {{- include "common.storage.class" (dict "persistence" .Values.monitoring.prometheus.alertmanager.persistence "global" $.Values.global) | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resources: {{- .Values.monitoring.prometheus.kubeStateMetrics.resources | toYaml
{{- end }}
extraArgs:
- --metric-labels-allowlist={{- $metricLabelsAllowList | join "," }}
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
securityContext:
enabled: true
seccompProfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ image:
repository: {{ printf "%s/prometheus/node-exporter" .Values.global.imageRegistry }}
{{- end }}
resources: {{- .Values.monitoring.prometheus.nodeExporter.resources | toYaml | nindent 2 }}
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
securityContext:
seccompProfile:
type: RuntimeDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ grafana: {{- include "base-cluster.prometheus-stack.grafana.config" . | nindent
prometheusOperator:
secretFieldSelector: 'type!=helm.sh/release.v1'
resources: {{- .Values.monitoring.prometheus.operator.resources | toYaml | nindent 4 }}
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
securityContext:
seccompProfile:
type: RuntimeDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ prometheusSpec:
externalUrl: {{ printf "https://%s" (include "base-cluster.prometheus.host" $) }}
{{- end }}
resources: {{- .Values.monitoring.prometheus.resources | toYaml | nindent 4 }}
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
securityContext:
seccompProfile:
type: RuntimeDefault
Expand Down
2 changes: 1 addition & 1 deletion charts/base-cluster/templates/monitoring/loki/loki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
containerSecurityContext:
seccompProfile:
type: RuntimeDefault
priorityClassName: system-cluster-critical
priorityClassName: monitoring-components
serviceMonitor:
enabled: true
labels: {{- .Values.monitoring.labels | toYaml | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
cpu: 100m
memory: 64Mi
replicas: 2
priorityClassName: system-cluster-critical
priorityClassName: cluster-components
podSecurityContext:
enabled: true
seccompProfile:
Expand Down
29 changes: 29 additions & 0 deletions charts/base-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,35 @@
},
"additionalProperties": false
}
},
"priorityClasses": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"minimum": -2147483648,
"maximum": 1000000000
},
"description": {
"type": "string"
},
"preemptionPolicy": {
"type": "string",
"enum": [
"PreemptLowerPriority",
"Never"
],
"default": "PreemptLowerPriority"
}
},
"required": ["value"],
"additionalProperties": false
},
"propertyNames": {
"maxLength": 63
}
}
},
"required": [
Expand Down
1 change: 1 addition & 0 deletions charts/base-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ global:
baseDomain: null
imageRegistry: null
imageCredentials: {}
priorityClasses: {}
namespaces:
ingress:
condition: "{{ not (empty .Values.dns.provider) }}"
Expand Down

0 comments on commit abcce53

Please sign in to comment.