Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the _hpa.tpl so it produses a valid HorizontalPodAutoscaler #147

Merged
merged 12 commits into from
Jun 21, 2024
4 changes: 2 additions & 2 deletions dotnet/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: .NET Core Helm Chart
name: dotnet
version: 13.0.0
version: 13.0.1
dependencies:
- name: libchart
version: 4.0.0
version: 4.0.1
repository: file://../libchart
4 changes: 2 additions & 2 deletions golang/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: golan Helm Chart
name: golang
version: 17.0.0
version: 17.0.1
dependencies:
- name: libchart
version: 4.0.0
version: 4.0.1
repository: file://../libchart
4 changes: 2 additions & 2 deletions java/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Java Helm Chart
name: java
version: 10.0.0
version: 10.0.1
dependencies:
- name: libchart
version: 4.0.0
version: 4.0.1
repository: file://../libchart
3 changes: 0 additions & 3 deletions java/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,5 @@ volumes: []

deployKind: deployment

autoscaling:
enabled: false

# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
dnsConfig: {}
2 changes: 1 addition & 1 deletion libchart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.0.0
version: 4.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
36 changes: 20 additions & 16 deletions libchart/templates/_hpa.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,27 @@ metadata:
labels:
{{- include "libchart.labels" . | nindent 4 }}
spec:
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- resource:
name: cpu
target:
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
type: Utilization
type: Resource
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- resource:
name: memory
target:
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
type: Utilization
type: Resource
{{- end }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "libchart.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions nodejs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Node.js Helm Chart
name: nodejs
version: 17.0.0
version: 17.0.1
dependencies:
- name: libchart
version: 4.0.0
version: 4.0.1
repository: file://../libchart
4 changes: 2 additions & 2 deletions web/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
appVersion: "1.0"
description: Helm chart for deployment of web servers
name: web
version: 14.0.0
version: 14.0.1
dependencies:
- name: libchart
version: 4.0.0
version: 4.0.1
repository: file://../libchart
Loading