From 9a7714cfead5747fa8d65da0fffe146c4a58def3 Mon Sep 17 00:00:00 2001 From: Sanjay Tiwari Date: Fri, 4 Nov 2022 11:16:00 -0400 Subject: [PATCH] Add HPA and PDB --- charts/metrics-agent/templates/hpa.yaml | 14 ++++++++++++++ charts/metrics-agent/templates/pdb.yaml | 11 +++++++++++ charts/metrics-agent/values.yaml | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 charts/metrics-agent/templates/hpa.yaml create mode 100644 charts/metrics-agent/templates/pdb.yaml diff --git a/charts/metrics-agent/templates/hpa.yaml b/charts/metrics-agent/templates/hpa.yaml new file mode 100644 index 00000000..222f68e1 --- /dev/null +++ b/charts/metrics-agent/templates/hpa.yaml @@ -0,0 +1,14 @@ +{{- if .Values.hpa.enabled }} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "metrics-agent.fullname" . }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "metrics-agent.fullname" . }} + minReplicas: {{ .Values.hpa.minReplicas }} + maxReplicas: {{ .Values.hpa.maxReplicas }} + targetCPUUtilizationPercentage: {{ .Values.hpa.targetCPUUtilizationPercentage }} +{{- end }} \ No newline at end of file diff --git a/charts/metrics-agent/templates/pdb.yaml b/charts/metrics-agent/templates/pdb.yaml new file mode 100644 index 00000000..6d81ac89 --- /dev/null +++ b/charts/metrics-agent/templates/pdb.yaml @@ -0,0 +1,11 @@ +{{- if .Values.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "metrics-agent.fullname" . }} +spec: + minAvailable: {{ .Values.pdb.minAvailable }} + selector: + matchLabels: + app: {{ include "metrics-agent.fullname" . }} +{{- end }} \ No newline at end of file diff --git a/charts/metrics-agent/values.yaml b/charts/metrics-agent/values.yaml index 32b8cf76..f843a07a 100644 --- a/charts/metrics-agent/values.yaml +++ b/charts/metrics-agent/values.yaml @@ -28,6 +28,16 @@ image: pullPolicy: Always imagePullSecrets: [] +# HorizontalPodAutoscaler +hpa: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 80 +#Disruption Budget for the Application in caes of node upgrades +pdb: + enabled: false + minAvailable: 1 resources: requests: