Hyunsun Moon | 97e111d | 2022-05-13 17:56:56 -0700 | [diff] [blame^] | 1 | {{/* |
| 2 | # Copyright 2022-present Open Networking Foundation |
| 3 | |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | */}} |
Shad Ansari | 0a4637a | 2022-05-11 12:20:59 -0700 | [diff] [blame] | 6 | |
| 7 | {{- if .Values.autoscaling.enabled }} |
| 8 | apiVersion: autoscaling/v2beta1 |
| 9 | kind: HorizontalPodAutoscaler |
| 10 | metadata: |
| 11 | name: {{ include "person-detection-app.fullname" . }} |
| 12 | labels: |
| 13 | {{- include "person-detection-app.labels" . | nindent 4 }} |
| 14 | spec: |
| 15 | scaleTargetRef: |
| 16 | apiVersion: apps/v1 |
| 17 | kind: Deployment |
| 18 | name: {{ include "person-detection-app.fullname" . }} |
| 19 | minReplicas: {{ .Values.autoscaling.minReplicas }} |
| 20 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} |
| 21 | metrics: |
| 22 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 23 | - type: Resource |
| 24 | resource: |
| 25 | name: cpu |
| 26 | targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 27 | {{- end }} |
| 28 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 29 | - type: Resource |
| 30 | resource: |
| 31 | name: memory |
| 32 | targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 33 | {{- end }} |
| 34 | {{- end }} |