Skip to content

Instantly share code, notes, and snippets.

@mdesanti
Created January 7, 2019 13:59
Show Gist options
  • Save mdesanti/7c61a350d0c40fa8a8c55e534adb2813 to your computer and use it in GitHub Desktop.
Save mdesanti/7c61a350d0c40fa8a8c55e534adb2813 to your computer and use it in GitHub Desktop.
{{- if .Values.hpa.enabled -}}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}
labels:
app: {{ template "podinfo.name" . }}
spec:
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: {{ .Release.Name }}
minReplicas: {{ .Values.replicaCount }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
{{- if .Values.hpa.cpu }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.hpa.cpu }}
{{- end }}
{{- if .Values.hpa.memory }}
- type: Resource
resource:
name: memory
targetAverageValue: {{ .Values.hpa.memory }}
{{- end }}
{{- if .Values.hpa.requests }}
- type: Pod
pods:
metricName: http_requests
targetAverageValue: {{ .Values.hpa.requests }}
{{- end }}
{{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment