Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix worker HPA to target new worker groups #783

Merged
merged 6 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/posthog/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 30.37.0
version: 30.38.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
6 changes: 3 additions & 3 deletions charts/posthog/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "posthog.fullname" $ }}-{{ .name }}-worker
name: {{ template "posthog.fullname" $ }}-worker-{{ .name }}
labels: {{- include "_snippet-metadata-labels-common" $ | nindent 4 }}
annotations: {{- include "_snippet-metadata-annotations-common" $ | nindent 4 }}
spec:
selector:
matchLabels:
app: {{ template "posthog.fullname" $ }}
release: "{{ $.Release.Name }}"
role: worker
role: worker-{{ .name }}
{{- if not $.Values.worker.hpa.enabled }}
replicas: {{ $.Values.worker.replicacount }}
{{- end }}
Expand All @@ -32,7 +32,7 @@ spec:
labels:
app: {{ template "posthog.fullname" $ }}
release: "{{ $.Release.Name }}"
role: worker
role: worker-{{ .name }}
{{- if (eq (default $.Values.image.tag "none") "latest") }}
date: "{{ now | unixEpoch }}"
{{- end }}
Expand Down
16 changes: 9 additions & 7 deletions charts/posthog/templates/worker-hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{{- if and .Values.worker.enabled .Values.worker.hpa.enabled -}}
{{- range .Values.worker.consumers }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "posthog.fullname" . }}-worker
labels: {{- include "_snippet-metadata-labels-common" . | nindent 4 }}
name: {{ template "posthog.fullname" $ }}-worker-{{ .name }}
labels: {{- include "_snippet-metadata-labels-common" $ | nindent 4 }}
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "posthog.fullname" . }}-worker
minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }}
name: {{ template "posthog.fullname" $ }}-worker-{{ .name }}
minReplicas: {{ $.Values.worker.hpa.minpods }}
maxReplicas: {{ $.Values.worker.hpa.maxpods }}
metrics:
{{- with .Values.worker.hpa.cputhreshold }}
{{- with $.Values.worker.hpa.cputhreshold }}
- type: Resource
resource:
name: cpu
Expand All @@ -21,5 +22,6 @@ spec:
averageUtilization: {{ . }}
{{- end }}
behavior:
{{ toYaml .Values.worker.hpa.behavior | nindent 4 }}
{{ toYaml $.Values.worker.hpa.behavior | nindent 4 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/posthog/tests/worker-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tests:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: RELEASE-NAME-posthog-worker
name: RELEASE-NAME-posthog-worker-default
minReplicas: 2
maxReplicas: 10
metrics:
Expand Down
Loading