Skip to content

Commit

Permalink
Fix worker HPA to target new worker groups
Browse files Browse the repository at this point in the history
Also fix matchLabel clash between different worker deployments
  • Loading branch information
frankh committed Jan 17, 2024
1 parent 1a65077 commit e9ba29a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charts/posthog/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
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
6 changes: 4 additions & 2 deletions charts/posthog/templates/worker-hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{{- if and .Values.worker.enabled .Values.worker.hpa.enabled -}}
{{- range .Values.worker.consumers }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "posthog.fullname" . }}-worker
name: {{ template "posthog.fullname" . }}-{{ .name }}-worker
labels: {{- include "_snippet-metadata-labels-common" . | nindent 4 }}
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "posthog.fullname" . }}-worker
name: {{ template "posthog.fullname" . }}-{{ .name }}-worker
minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }}
metrics:
Expand All @@ -23,3 +24,4 @@ spec:
behavior:
{{ toYaml .Values.worker.hpa.behavior | nindent 4 }}
{{- end }}
{{- end }}

0 comments on commit e9ba29a

Please sign in to comment.