default-hpa
Generates an HorizontalPodAutoscaler manifest.
type: horizontal-pod-autoscaler
supported_params:
- maxReplicas
- minReplicas
- targetCPUUtilizationPercentage10-hpa.provisioners.yaml
(view on GitHub)
:
- uri: template://community-provisioners/default-hpa
type: horizontal-pod-autoscaler
description: Generates an HorizontalPodAutoscaler manifest.
supported_params:
- maxReplicas
- minReplicas
- targetCPUUtilizationPercentage
init: |
defaultMaxReplicas: 3
defaultMinReplicas: 2
absoluteMaxReplicas : 10
defaultTargetCPUUtilizationPercentage: 80
manifests: |
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .SourceWorkload }}
{{ if ne .Namespace "" }}
namespace: {{ .Namespace }}
{{ end }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .SourceWorkload }}
minReplicas: {{ .Params.minReplicas | default .Init.defaultMinReplicas }}
maxReplicas: {{ .Params.maxReplicas | default .Init.defaultMaxReplicas | min .Init.absoluteMaxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Params.targetCPUUtilizationPercentage | default .Init.defaultTargetCPUUtilizationPercentage }}