diff --git a/chart/stable/podinfo/templates/hpa.yaml b/chart/stable/podinfo/templates/hpa.yaml new file mode 100644 index 0000000..a122304 --- /dev/null +++ b/chart/stable/podinfo/templates/hpa.yaml @@ -0,0 +1,22 @@ +{{- if .Values.hpa.enabled -}} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "podinfo.fullname" . }} +spec: + scaleTargetRef: + apiVersion: apps/v1beta2 + kind: Deployment + name: {{ template "podinfo.fullname" . }} + minReplicas: {{ .Values.replicaCount }} + maxReplicas: {{ .Values.hpa.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.hpa.cpu }} + - type: Resource + resource: + name: memory + targetAverageValue: {{ .Values.hpa.memory }} +{{- end }} diff --git a/chart/stable/podinfo/values.yaml b/chart/stable/podinfo/values.yaml index 16afee9..f8a01c3 100644 --- a/chart/stable/podinfo/values.yaml +++ b/chart/stable/podinfo/values.yaml @@ -1,6 +1,4 @@ # Default values for podinfo. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. replicaCount: 1 @@ -15,6 +13,12 @@ service: containerPort: 9898 nodePort: 31198 +hpa: + enabled: false + maxReplicas: 10 + cpu: 80 + memory: 200Mi + ingress: enabled: false annotations: {}