Skip to content

Commit

Permalink
firezone-gateway: support autoscaling (#28)
Browse files Browse the repository at this point in the history
* firezone-gateway: support autoscaling

* firezone-gateway: bump version
  • Loading branch information
Intuinewin authored Jul 20, 2024
1 parent 02f5c69 commit 21f2edb
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firezone-gateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: firezone-gateway
version: 0.10.0
appVersion: "1.1.1"
version: 0.11.0
appVersion: "1.1.2"
type: application
description: A Helm chart for deploying a firezone gateway
icon: https://raw.githubusercontent.com/firezone/firezone/main/website/public/images/logo-main.svg
2 changes: 2 additions & 0 deletions firezone-gateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ metadata:
labels:
{{- include "firezone-gateway.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicas }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
32 changes: 32 additions & 0 deletions firezone-gateway/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "firezone-gateway.fullname" . }}
labels:
{{- include "firezone-gateway.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "firezone-gateway.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions firezone-gateway/templates/pdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.pdb.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "firezone-gateway.fullname" . }}
labels:
{{- include "firezone-gateway.labels" . | nindent 4 }}
{{- with .Values.pdb.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{ with .Values.pdb.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.pdb.maxUnavailable }}
maxUnavailable: {{ . }}
{{- else }}
minAvailable: {{ .Values.pdb.minAvailable | default 0 }}
{{- end }}
selector:
matchLabels:
{{- include "firezone-gateway.selectorLabels" . | nindent 6 }}
{{- end }}
14 changes: 14 additions & 0 deletions firezone-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ serviceAccount:
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

pdb:
enabled: false
labels: {}
annotations: {}
minAvailable: ""
maxUnavailable: ""

0 comments on commit 21f2edb

Please sign in to comment.