Skip to content

Commit

Permalink
unnested autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Pycnomerus committed Dec 5, 2024
1 parent f642860 commit d03b436
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
12 changes: 6 additions & 6 deletions charts/aspnetcore/templates/deployment-hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- if (((.Values.deployment).autoscaling).enabled) }}
{{- if ((.Values.autoscaling).enabled) }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-hpa
annotations:
name: {{ default (printf "%s-deployment" .Release.Name) .Values.autoscaling.name }}
labels:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand All @@ -12,11 +12,11 @@ spec:
- resource:
name: cpu
target:
averageUtilization: {{ .Values.deployment.autoscaling.targetCPUUtilizationPercentage }}
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
type: Utilization
type: Resource
minReplicas: {{ max (add ((.Values.podDisruptionBudget).minAvailable) 1) (.Values.deployment.autoscaling.minReplicas) }}
maxReplicas: {{ max (add ((.Values.podDisruptionBudget).minAvailable) 1) (.Values.deployment.autoscaling.minReplicas) (.Values.deployment.autoscaling.maxReplicas) }}
minReplicas: {{ max (add ((.Values.podDisruptionBudget).minAvailable) 1) (.Values.autoscaling.minReplicas) }}
maxReplicas: {{ max (add ((.Values.podDisruptionBudget).minAvailable) 1) (.Values.autoscaling.minReplicas) (.Values.autoscaling.maxReplicas) }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
Expand Down
23 changes: 13 additions & 10 deletions charts/aspnetcore/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,9 @@ ingress:

## ASP.NET Core deployment parameters
## @param deployment.name Name of the deployment, automatically generated from the release name if not specified
## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
## @param deployment.autoscaling.enabled Default to false. Enable autoscaling
## @param deployment.autoscaling.minReplicas Optional if PodDistributionBudget is set. Minimum number of ASP.NET Core replicas minimum is PodDisruptionBudget.minAvailable + 1
## @param deployment.autoscaling.maxReplicas Optional if PodDistributionBudget is set or minReplicas is set. Maximum number of ASP.NET Core replicas minimum is minReplicas value.
## @param deployment.autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage for autoscaling
##
deployment:
name: ""
autoscaling:
enabled: false
#minReplicas: 2
#maxReplicas: 3
targetCPUUtilizationPercentage: 80

## ASP.NET Core containers' resource requests and limits defined in YAML
## ref: https://kubernetes.io/docs/user-guide/compute-resources/
Expand Down Expand Up @@ -180,6 +170,19 @@ azureWorkloadIdentity:
podDisruptionBudget:
minAvailable: 1

## Autoscaling deployment settings
## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
## @param autoscaling.enabled Default to false. Enable autoscaling
## @param autoscaling.minReplicas Optional if PodDistributionBudget is set. Minimum number of ASP.NET Core replicas minimum is PodDisruptionBudget.minAvailable + 1
## @param autoscaling.maxReplicas Optional if PodDistributionBudget is set or minReplicas is set. Maximum number of ASP.NET Core replicas minimum is minReplicas value.
## @param autoscaling.targetCPUUtilizationPercentage Target CPU utilization percentage for autoscaling
autoscaling:
enabled: false
name: ""
minReplicas: 2
maxReplicas: 3
targetCPUUtilizationPercentage: 80

## @param extraVolumes Optionally specify extra list of additional volumes, e.g:
## extraVolumes:
## - name: config-vol
Expand Down

0 comments on commit d03b436

Please sign in to comment.