From 5338bbf6b7ad71ddba2a912a517292e852f087f4 Mon Sep 17 00:00:00 2001 From: t3mi Date: Wed, 28 Aug 2024 18:05:02 +0000 Subject: [PATCH] feat(helm): add support for vpa Signed-off-by: t3mi --- ...calpodautoscaler_azureserviceoperator.yaml | 38 +++++++++++++++++++ v2/charts/azure-service-operator/values.yaml | 32 ++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 v2/charts/azure-service-operator/templates/autoscaling.k8s.io_v1_verticalpodautoscaler_azureserviceoperator.yaml diff --git a/v2/charts/azure-service-operator/templates/autoscaling.k8s.io_v1_verticalpodautoscaler_azureserviceoperator.yaml b/v2/charts/azure-service-operator/templates/autoscaling.k8s.io_v1_verticalpodautoscaler_azureserviceoperator.yaml new file mode 100644 index 00000000000..5d285066866 --- /dev/null +++ b/v2/charts/azure-service-operator/templates/autoscaling.k8s.io_v1_verticalpodautoscaler_azureserviceoperator.yaml @@ -0,0 +1,38 @@ +{{- if .Values.verticalPodAutoscaler.enabled }} +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: azureserviceoperator + namespace: {{ .Release.Namespace }} +spec: + {{- with .Values.verticalPodAutoscaler.recommenders }} + recommenders: + {{- toYaml . | nindent 4 }} + {{- end }} + resourcePolicy: + containerPolicies: + - containerName: manager + {{- with .Values.verticalPodAutoscaler.controlledResources }} + controlledResources: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.verticalPodAutoscaler.controlledValues }} + controlledValues: {{ .Values.verticalPodAutoscaler.controlledValues }} + {{- end }} + {{- if .Values.verticalPodAutoscaler.maxAllowed }} + maxAllowed: + {{- toYaml .Values.verticalPodAutoscaler.maxAllowed | nindent 8 }} + {{- end }} + {{- if .Values.verticalPodAutoscaler.minAllowed }} + minAllowed: + {{- toYaml .Values.verticalPodAutoscaler.minAllowed | nindent 8 }} + {{- end }} + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: azureserviceoperator-controller-manager + {{- with .Values.verticalPodAutoscaler.updatePolicy }} + updatePolicy: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/v2/charts/azure-service-operator/values.yaml b/v2/charts/azure-service-operator/values.yaml index c7d56d5880c..4e3eb8bc023 100644 --- a/v2/charts/azure-service-operator/values.yaml +++ b/v2/charts/azure-service-operator/values.yaml @@ -250,3 +250,35 @@ serviceAccount: # If not set and create is true, `azureserviceoperator-default` would be used as a name name: "" annotations: {} + +verticalPodAutoscaler: + # If true creates a Vertical Pod Autoscaler. + enabled: false + + # Recommender responsible for generating recommendation for the object. + # List should be empty (then the default recommender will generate the recommendation) + # or contain exactly one recommender. + recommenders: [] + # - name: custom-recommender-performance + + # List of resources that the vertical pod autoscaler can control. Defaults to cpu and memory + controlledResources: [] + # Specifies which resource values should be controlled: RequestsOnly or RequestsAndLimits. + controlledValues: RequestsAndLimits + + # Define the max allowed resources for the pod + maxAllowed: {} + # cpu: 500m + # memory: 512Mi + # Define the min allowed resources for the pod + minAllowed: {} + # cpu: 200m + # memory: 256Mi + + updatePolicy: + # Specifies minimal number of replicas which need to be alive for VPA Updater to attempt pod eviction + minReplicas: 1 + + # Specifies whether recommended updates are applied when a Pod is started and whether recommended updates + # are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto". + updateMode: Auto