{{- if .Values.envoy.autoscaling.keda.enabled }} apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: envoy {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }} {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} pollingInterval: {{ .Values.envoy.autoscaling.keda.pollingInterval }} minReplicaCount: {{ .Values.envoy.autoscaling.minReplicas }} maxReplicaCount: {{ .Values.envoy.autoscaling.maxReplicas }} advanced: horizontalPodAutoscalerConfig: behavior: scaleDown: stabilizationWindowSeconds: {{ .Values.envoy.autoscaling.keda.stabilizationWindowSeconds | default "300" }} policies: {{- range .Values.envoy.autoscaling.keda.scaledown.policies }} - type: {{ .type }} value: {{ .value }} periodSeconds: {{ .periodseconds }} {{- end }} selectPolicy: {{ .Values.envoy.autoscaling.keda.scaledown.selectpolicy }} scaleUp: stabilizationWindowSeconds: {{ .Values.envoy.autoscaling.keda.scaleup.stabilizationWindowSeconds }} policies: {{- range .Values.envoy.autoscaling.keda.scaleup.policies }} - type: {{ .type }} value: {{ .value }} periodSeconds: {{ .periodseconds }} {{- end }} selectPolicy: {{ .Values.envoy.autoscaling.keda.scaleup.selectpolicy }} triggers: - metadata: value: {{ .Values.envoy.autoscaling.targetCPU | quote }} metricType: Utilization type: cpu - metadata: value: {{ .Values.envoy.autoscaling.targetMemory | quote }} metricType: Utilization type: memory {{- if .Values.envoy.autoscaling.keda.triggers }} {{- toYaml .Values.envoy.autoscaling.keda.triggers | nindent 2 }} {{ end }} {{- end }}