Skip to content

Commit

Permalink
Merge pull request #39 from JacekZubielik/esphome
Browse files Browse the repository at this point in the history
build(hpa): add HorizontalPodAutoscaler
  • Loading branch information
JacekZubielik authored Jun 4, 2024
2 parents 7f80afe + 5033455 commit 9b9512e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/esphome/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
appVersion: 2024.5.4
description: ESPHome
name: esphome
version: 0.0.4
version: 0.0.5
keywords:
- esphome
type: application
Expand Down
2 changes: 1 addition & 1 deletion charts/esphome/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ spec:
{{- if .Values.persistence.enabled }}
{{- if .Values.persistence.hostPath }}
hostPath:
path: {{.Values.persistence.hostPath}}
path: {{.Values.persistence.hostPath}}
type: Directory
{{- else }}
persistentVolumeClaim:
Expand Down
34 changes: 34 additions & 0 deletions charts/esphome/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "app.fullname" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "app.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.averageCPUUtilizationPercentage }}
- type: ContainerResource
containerResource:
name: cpu
container: {{ include "app.fullname" . }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.averageCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.averageMemoryUtilizationPercentage }}
- type: ContainerResource
containerResource:
name: memory
container: {{ include "app.fullname" . }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.averageMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
4 changes: 0 additions & 4 deletions charts/esphome/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ metadata:
annotations:
{{ toYaml . | indent 4 }}
{{- end }}




spec:
type: {{ .Values.service.type }}
{{- if .Values.service.externalIPs }}
Expand Down
7 changes: 7 additions & 0 deletions charts/esphome/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,10 @@ persistence:
hostMounts: []
# - name: zha
# hostPath: /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_6120245D-if01-port0

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
averageCPUUtilizationPercentage: 50
averageMemoryUtilizationPercentage: 50

0 comments on commit 9b9512e

Please sign in to comment.