Skip to content

Commit

Permalink
feature: added templates for horizontal pod autoscaling (#43)
Browse files Browse the repository at this point in the history
* updated configmap name in all files

* feature: updated postgres name

* feature: updated server name, debugged changes

* feature: updated ui name and debugged

* feature: fixed worker name

* feature: fixed temporal naming

* feature: removed unnecessary acme challenge resources

* revert namespace back to just multiwoven

* change env name from suffix to prefix: configmap

* change env name from suffix to prefix: ingress

* change env name from suffix to prefix: postgresql deployment/service

* change env name from suffix to prefix: postgresql pvc

* change env name from suffix to prefix: server

* change env name from suffix to prefix: ui

* change env name from suffix to prefix: worker

* change env name from suffix to prefix: temporal

* change env name from suffix to prefix: temporal in ingress template

* feature: added templates for horizontal pod autoscaling

* feature: parameterize hpa values

* fix: make hpa optional and better organized hpa values in values.yaml

* feature: add hpa scaling behavior controls

* feature: add labels for better management and organization

* fix: decreased memory threshold for worker and server hpa

* feature: parameterized temporalHost and postgresql default values

* fix: added app env to workflow deployment names

* feature: added hpa flags to helm upgrade command in workflow

* fix: added tab for set flags to workflow

* fix: fixed newline flag

* fix: fixed hpa conditional statement and added app env prefix to target ref

* fix: fixed value reference in server and ui templates

* fix: fixed worker hpa target ref name

* fix: removed hpa set flags from workflow

* fix: remove appEnv prefix

* fix: remove appEnv from workflow file

* fix: add forward slack to  workflow file

* fix: remove appEnv from values file

* fix: removed community from temporal hostname

* fix: removed unused hpa values from values file

* fix: update chart version

* fix: upgraded default memory limits based on hpa output

* fix: adjusting baseline values for efficient hpa
  • Loading branch information
AngeloB-AIS authored Sep 27, 2024
1 parent f2e517d commit 1ef4460
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 11 deletions.
4 changes: 2 additions & 2 deletions charts/multiwoven/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: multiwoven
description: Open-source reverse ETL, an alternative to Hightouch, Census etc. 🔥
type: application
version: 0.26.0
appVersion: "0.26.0"
version: 0.27.0
appVersion: "0.27.0"
maintainers:
- name: subintp
- name: RafaelOAiSquared
Expand Down
47 changes: 47 additions & 0 deletions charts/multiwoven/templates/multiwoven-server-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{ if .Values.hpa.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "chart.fullname" . }}-server-hpa
namespace: {{ .Values.kubernetesNamespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
app.kubernetes.io/component: server-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "chart.fullname" . }}-server
minReplicas: {{ .Values.hpa.multiwovenServer.minReplicas }}
maxReplicas: {{ .Values.hpa.multiwovenServer.maxReplicas }}
behavior:
scaleDown:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenServer.behavior.scaleDown.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenServer.behavior.scaleDown.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenServer.behavior.scaleDown.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenServer.behavior.scaleDown.policies.percentPolicy.periodSeconds }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.percentPolicy.periodSeconds }}
- type: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.podPolicy.type }}
value: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.podPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.podPolicy.periodSeconds }}
selectPolicy: {{ .Values.hpa.multiwovenServer.behavior.scaleUp.policies.selectPolicy }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenServer.cpuAverageUtilizationPercentageThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenServer.memoryAverageUtilizationPercentageThreshold }}
{{ end }}
47 changes: 47 additions & 0 deletions charts/multiwoven/templates/multiwoven-ui-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{ if .Values.hpa.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "chart.fullname" . }}-ui-hpa
namespace: {{ .Values.kubernetesNamespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
app.kubernetes.io/component: ui-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "chart.fullname" . }}-ui
minReplicas: {{ .Values.hpa.multiwovenUI.minReplicas }}
maxReplicas: {{ .Values.hpa.multiwovenUI.maxReplicas }}
behavior:
scaleDown:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenUI.behavior.scaleDown.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenUI.behavior.scaleDown.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenUI.behavior.scaleDown.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenUI.behavior.scaleDown.policies.percentPolicy.periodSeconds }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.percentPolicy.periodSeconds }}
- type: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.podPolicy.type }}
value: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.podPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.podPolicy.periodSeconds }}
selectPolicy: {{ .Values.hpa.multiwovenUI.behavior.scaleUp.policies.selectPolicy }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenUI.cpuAverageUtilizationPercentageThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenUI.memoryAverageUtilizationPercentageThreshold }}
{{ end }}
47 changes: 47 additions & 0 deletions charts/multiwoven/templates/multiwoven-worker-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{ if .Values.hpa.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "chart.fullname" . }}-worker-hpa
namespace: {{ .Values.kubernetesNamespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
app.kubernetes.io/component: worker-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "chart.fullname" . }}-worker
minReplicas: {{ .Values.hpa.multiwovenWorker.minReplicas }}
maxReplicas: {{ .Values.hpa.multiwovenWorker.maxReplicas }}
behavior:
scaleDown:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenWorker.behavior.scaleDown.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenWorker.behavior.scaleDown.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenWorker.behavior.scaleDown.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenWorker.behavior.scaleDown.policies.percentPolicy.periodSeconds }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.stabilizationWindowSeconds }}
policies:
- type: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.percentPolicy.type }}
value: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.percentPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.percentPolicy.periodSeconds }}
- type: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.podPolicy.type }}
value: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.podPolicy.value }}
periodSeconds: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.podPolicy.periodSeconds }}
selectPolicy: {{ .Values.hpa.multiwovenWorker.behavior.scaleUp.policies.selectPolicy }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenWorker.cpuAverageUtilizationPercentageThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.hpa.multiwovenWorker.memoryAverageUtilizationPercentageThreshold }}
{{ end }}
112 changes: 103 additions & 9 deletions charts/multiwoven/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,100 @@ multiwovenConfig:
viteBrandColor: ""
viteBrandHoverColor: ""
viteFavIconUrl: ""

hpa:
enabled: true
multiwovenUI:
minReplicas: 1
maxReplicas: 10
cpuAverageUtilizationPercentageThreshold: 80
memoryAverageUtilizationPercentageThreshold: 75
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Percent
value: 100
periodSeconds: 15
selectPolicy: Max
scaleUp:
stabilizationWindowSeconds: 45
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
multiwovenServer:
minReplicas: 1
maxReplicas: 10
cpuAverageUtilizationPercentageThreshold: 80
memoryAverageUtilizationPercentageThreshold: 60
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Percent
value: 100
periodSeconds: 15
selectPolicy: Max
scaleUp:
stabilizationWindowSeconds: 45
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
multiwovenWorker:
minReplicas: 1
maxReplicas: 10
cpuAverageUtilizationPercentageThreshold: 80
memoryAverageUtilizationPercentageThreshold: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Percent
value: 100
periodSeconds: 15
selectPolicy: Max
scaleUp:
stabilizationWindowSeconds: 45
policies:
percentPolicy:
type: Percent
value: 100
periodSeconds: 15
podPolicy:
type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max

multiwovenPostgresql:
enabled: true
multiwovenPostgresql:
Expand Down Expand Up @@ -88,10 +182,10 @@ multiwovenServer:
resources:
limits:
cpu: "2"
memory: 2Gi
memory: "3Gi"
requests:
cpu: "1"
memory: 1Gi
memory: "1Gi"
ports:
- name: "3000"
port: 3000
Expand All @@ -105,11 +199,11 @@ multiwovenUI:
tag: latest
resources:
limits:
cpu: "2"
memory: 2Gi
cpu: "200m"
memory: "512Mi"
requests:
cpu: "1"
memory: 1Gi
cpu: "100m"
memory: "256Mi"
ports:
- name: "8000"
port: 8000
Expand All @@ -130,10 +224,10 @@ multiwovenWorker:
resources:
limits:
cpu: "1"
memory: 1Gi
memory: 2Gi
requests:
cpu: 500m
memory: 512Mi
cpu: "500m"
memory: 1Gi
replicas: 1
pvc:
pvc:
Expand Down

0 comments on commit 1ef4460

Please sign in to comment.