From 6882c22cc7e2831fd9a0c2adb412ecb5ade160bb Mon Sep 17 00:00:00 2001
From: Ann Moon <32624965+amoon78@users.noreply.github.com>
Date: Wed, 18 Sep 2024 01:02:45 -0700
Subject: [PATCH] [bitnami/apache] Update templates to have conditionals for
HPA (#29489)
---
bitnami/apache/CHANGELOG.md | 8 ++++++--
bitnami/apache/Chart.yaml | 2 +-
bitnami/apache/README.md | 2 +-
bitnami/apache/templates/deployment.yaml | 3 +++
bitnami/apache/templates/hpa.yaml | 16 ++++++++--------
5 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/bitnami/apache/CHANGELOG.md b/bitnami/apache/CHANGELOG.md
index f03d0c07031717..7b6afa5fc277b6 100644
--- a/bitnami/apache/CHANGELOG.md
+++ b/bitnami/apache/CHANGELOG.md
@@ -1,8 +1,12 @@
# Changelog
-## 11.2.18 (2024-09-15)
+## 11.2.19 (2024-09-18)
-* [bitnami/apache] Release 11.2.18 ([#29418](https://github.com/bitnami/charts/pull/29418))
+* [bitnami/apache] Update templates to have conditionals for HPA ([#29489](https://github.com/bitnami/charts/pull/29489))
+
+## 11.2.18 (2024-09-15)
+
+* [bitnami/apache] Release 11.2.18 (#29418) ([665ff2b](https://github.com/bitnami/charts/commit/665ff2be8f372b4cf2a75c4d4c7e7c8bcd647310)), closes [#29418](https://github.com/bitnami/charts/issues/29418)
## 11.2.17 (2024-09-03)
diff --git a/bitnami/apache/Chart.yaml b/bitnami/apache/Chart.yaml
index ee00e3a00f660f..e00134243de7db 100644
--- a/bitnami/apache/Chart.yaml
+++ b/bitnami/apache/Chart.yaml
@@ -35,4 +35,4 @@ maintainers:
name: apache
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/apache
-version: 11.2.18
+version: 11.2.19
diff --git a/bitnami/apache/README.md b/bitnami/apache/README.md
index 1c90583601f986..e2fed872afea6c 100644
--- a/bitnami/apache/README.md
+++ b/bitnami/apache/README.md
@@ -123,7 +123,7 @@ As an alternative, you can use the preset configurations for pod affinity, pod
| `git.digest` | Git image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `git.pullPolicy` | Git image pull policy | `IfNotPresent` |
| `git.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
-| `replicaCount` | Number of replicas of the Apache deployment | `1` |
+| `replicaCount` | Number of replicas of the Apache deployment, Ignored if `autoscaling.enabled` set to `true` | `1` |
| `revisionHistoryLimit` | The number of old history to retain to allow rollback | `10` |
| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` |
diff --git a/bitnami/apache/templates/deployment.yaml b/bitnami/apache/templates/deployment.yaml
index 644c9f0612e42f..aff59f68ccb774 100644
--- a/bitnami/apache/templates/deployment.yaml
+++ b/bitnami/apache/templates/deployment.yaml
@@ -16,7 +16,10 @@ spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
+ # Have replicas Only if autoscaling is disabled
+ {{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
+ {{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- if .Values.updateStrategy }}
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
diff --git a/bitnami/apache/templates/hpa.yaml b/bitnami/apache/templates/hpa.yaml
index 6e52ee6ccd80ba..91f080aa61ba6c 100644
--- a/bitnami/apache/templates/hpa.yaml
+++ b/bitnami/apache/templates/hpa.yaml
@@ -21,28 +21,28 @@ spec:
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- {{- if .Values.autoscaling.targetCPU }}
+ {{- if .Values.autoscaling.targetMemory }}
- type: Resource
resource:
- name: cpu
+ name: memory
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
- targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
+ targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
{{- else }}
target:
type: Utilization
- averageUtilization: {{ .Values.autoscaling.targetCPU }}
+ averageUtilization: {{ .Values.autoscaling.targetMemory }}
{{- end }}
{{- end }}
- {{- if .Values.autoscaling.targetMemory }}
+ {{- if .Values.autoscaling.targetCPU }}
- type: Resource
resource:
- name: memory
+ name: cpu
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
- targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
+ targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
{{- else }}
target:
type: Utilization
- averageUtilization: {{ .Values.autoscaling.targetMemory }}
+ averageUtilization: {{ .Values.autoscaling.targetCPU }}
{{- end }}
{{- end }}
{{- end }}