Skip to content

Commit

Permalink
Merge pull request #31 from cloudkite-io/allow-metrics-selection-hpa
Browse files Browse the repository at this point in the history
allow metrics selection for HPA
  • Loading branch information
kirill-cloudkite authored May 2, 2024
2 parents db10e5b + cc3a306 commit ea814f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions standard-app/example.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ apps:
image: us-central1-docker.pkg.dev/cloudkite-infra-ops/cloudkite-docker-images/app-1
tag: tag-1
imagePullPolicy: None
hpa:
maxReplicas: 3
minReplicas: 2
cpuTarget: 50
memoryTarget: 95
# mpa:
# mode: noset
# maxReplicas: 12
Expand Down Expand Up @@ -88,6 +83,11 @@ apps:
env:
CONTAINER_ENV1: asd
CONTAINER_ENV2: qwe
hpa:
maxReplicas: 3
minReplicas: 2
cpuTarget: 50
# memoryTarget: 95
env:
APP_ENV1: foo
APP_ENV2: bar
Expand Down
8 changes: 6 additions & 2 deletions standard-app/templates/autoscaling/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ spec:
kind: {{ if $appConfig.rollout }}Rollout{{ else }}Deployment{{ end }}
name: {{ if $.Values.pr }}{{ $.Release.Name }}-{{ $appName | trimPrefix $.Release.Name | trimPrefix "-" }}{{ else }}{{ $appName }}{{ end }}
metrics:
{{- with $appConfig.hpa.memoryTarget }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ $appConfig.hpa.memoryTarget }}
averageUtilization: {{ . }}
{{- end }}
{{- with $appConfig.hpa.cpuTarget }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ $appConfig.hpa.cpuTarget }}
averageUtilization: {{ . }}
{{- end }}
---
{{- end }}
{{- end }}

0 comments on commit ea814f1

Please sign in to comment.