Skip to content

Commit

Permalink
Merge ce76fb9 into 0272d61
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh authored Jan 17, 2024
2 parents 0272d61 + ce76fb9 commit f2af0d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 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
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" $ }}-{{ .name }}-worker
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" $ }}-{{ .name }}-worker
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-default-worker
minReplicas: 2
maxReplicas: 10
metrics:
Expand Down

0 comments on commit f2af0d7

Please sign in to comment.