|
| 1 | +{{/* vim: set filetype=helm: */}} |
| 2 | +{{- define "app.resources.vpa" -}} |
| 3 | +{{- if .Values.vpa.enabled }} |
| 4 | +--- |
| 5 | +apiVersion: autoscaling.k8s.io/v1 |
| 6 | +kind: VerticalPodAutoscaler |
| 7 | +metadata: |
| 8 | + name: {{ include "common.names.fullname" . }} |
| 9 | + namespace: {{ include "common.names.namespace" . | quote }} |
| 10 | + labels: {{- include "common.labels.standard" . | nindent 4 }} |
| 11 | + {{- include "app.labels.component" . | nindent 4 }} |
| 12 | + {{- if .Values.commonLabels }} |
| 13 | + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 14 | + {{- end }} |
| 15 | + {{- if or .Values.vpa.annotations .Values.commonAnnotations }} |
| 16 | + annotations: |
| 17 | + {{- if .Values.commonAnnotations }} |
| 18 | + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 19 | + {{- end }} |
| 20 | + {{- if .Values.vpa.annotations }} |
| 21 | + {{- include "common.tplvalues.render" ( dict "value" .Values.vpa.annotations "context" $) | nindent 4 }} |
| 22 | + {{- end }} |
| 23 | + {{- end }} |
| 24 | +spec: |
| 25 | + targetRef: |
| 26 | + {{- if and .Values.app.workload.enabled (has .Values.app.workload.type (list "statefulset" "sts")) }} |
| 27 | + apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }} |
| 28 | + kind: StatefulSet |
| 29 | + {{- end }} |
| 30 | + {{- if and .Values.app.workload.enabled (eq .Values.app.workload.type "deployment") }} |
| 31 | + apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} |
| 32 | + kind: Deployment |
| 33 | + {{- end }} |
| 34 | + name: {{ template "common.names.fullname" . }} |
| 35 | + updatePolicy: |
| 36 | + {{- with .Values.vpa.updatePolicy }} |
| 37 | + updateMode: {{ .updateMode }} |
| 38 | + minReplicas: {{ .minReplicas }} |
| 39 | + {{- with .evictionRequirements }} |
| 40 | + evictionRequirements: {{- toYaml . | nindent 6 }} |
| 41 | + {{- end }} |
| 42 | + {{- end }} |
| 43 | + {{- with .Values.vpa.recommenders }} |
| 44 | + recommenders: {{- toYaml . | nindent 4 }} |
| 45 | + {{- end }} |
| 46 | + {{- with .Values.vpa.resourcePolicy.containerPolicies }} |
| 47 | + resourcePolicy: |
| 48 | + containerPolicies: {{- toYaml . | nindent 6 }} |
| 49 | + {{- end }} |
| 50 | + |
| 51 | +{{- end }} |
| 52 | +{{- end -}} |
| 53 | + |
| 54 | +{{/* Include the resource */}} |
| 55 | +{{- if eq "direct" (include "app.chart.mode" .) -}} |
| 56 | + {{- range $_, $component := concat (list "") $.Values.app.components -}} |
| 57 | + {{- $values := ternary $.Values (get $.Values "component") (eq $component "") | default dict -}} |
| 58 | + {{- include "app.vpa" (dict "component" $component "values" $values "top" $) -}} |
| 59 | + {{- end -}} |
| 60 | +{{- end -}} |
0 commit comments