Initial Version of Helm Chart for OpenDaylight
[integration/packaging.git] / helm / opendaylight / templates / hpa.yaml
1 {{/*
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2021 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 */}}
12 {{- if .Values.autoscaling.enabled }}
13 apiVersion: autoscaling/v2beta1
14 kind: HorizontalPodAutoscaler
15 metadata:
16   name: {{ include "opendaylight.fullname" . }}
17   labels:
18     {{- include "opendaylight.labels" . | nindent 4 }}
19 spec:
20   scaleTargetRef:
21     apiVersion: apps/v1
22     kind: Deployment
23     name: {{ include "opendaylight.fullname" . }}
24   minReplicas: {{ .Values.autoscaling.minReplicas }}
25   maxReplicas: {{ .Values.autoscaling.maxReplicas }}
26   metrics:
27     {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
28     - type: Resource
29       resource:
30         name: cpu
31         targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
32     {{- end }}
33     {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
34     - type: Resource
35       resource:
36         name: memory
37         targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
38     {{- end }}
39 {{- end }}