From 246f4fc15a31c51ce07652319d2b9a7bead3f545 Mon Sep 17 00:00:00 2001 From: andytson-inviqa Date: Mon, 17 Jan 2022 17:17:29 +0000 Subject: [PATCH 1/5] Fix formatting of pod disruption budget template --- src/_base/helm/app/templates/pod-disruption-budgets.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_base/helm/app/templates/pod-disruption-budgets.yaml b/src/_base/helm/app/templates/pod-disruption-budgets.yaml index 95a22c67c..cbf6a5995 100644 --- a/src/_base/helm/app/templates/pod-disruption-budgets.yaml +++ b/src/_base/helm/app/templates/pod-disruption-budgets.yaml @@ -15,7 +15,7 @@ metadata: annotations: argocd.argoproj.io/sync-wave: "15" spec: - minAvailable: {{- .minAvailable | default 1 }} + minAvailable: {{ .minAvailable | default 1 }} selector: matchLabels: app.service: {{ print $.Values.resourcePrefix $serviceName }} From a0f8e25b6d5cc0f8b6b65449d28d8ecad13c3255 Mon Sep 17 00:00:00 2001 From: andytson-inviqa Date: Mon, 17 Jan 2022 17:29:12 +0000 Subject: [PATCH 2/5] Use legacy resourcePrefix for hpa --- src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml index 4643f30b2..f8931117e 100644 --- a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml +++ b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml @@ -6,11 +6,11 @@ apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: - name: {{ print $.Release.Name "-" $serviceName }} + name: {{ print $.Values.resourcePrefix $serviceName }} labels: {{- include "chart.labels" $ | nindent 4 }} app.kubernetes.io/component: {{ $serviceName }} - app.service: {{ print $.Release.Name "-" $serviceName }} + app.service: {{ print $.Values.resourcePrefix $serviceName }} annotations: argocd.argoproj.io/sync-wave: "15" spec: @@ -38,7 +38,7 @@ spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ print $.Release.Name "-" $serviceName }} + name: {{ print $.Values.resourcePrefix $serviceName }} {{- end }} {{- end }} {{- end }} From 1f79fdd3fe39b9c2ac7eb527173647aa8a98306a Mon Sep 17 00:00:00 2001 From: andytson-inviqa Date: Mon, 17 Jan 2022 17:40:30 +0000 Subject: [PATCH 3/5] Avoid adding target*UtilizationPercentage to hpa spec directly --- src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml index f8931117e..caf2d0534 100644 --- a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml +++ b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml @@ -14,7 +14,7 @@ metadata: annotations: argocd.argoproj.io/sync-wave: "15" spec: - {{- with (omit $autoscaling "enabled" "metrics") }} + {{- with (pick $autoscaling "minReplicas" "maxReplicas") }} {{- . | toYaml | nindent 2 }} {{- end }} metrics: From c513a3d6d2e1c0ed5b038174ba3bf4641a4c1f70 Mon Sep 17 00:00:00 2001 From: andytson-inviqa Date: Mon, 17 Jan 2022 17:43:50 +0000 Subject: [PATCH 4/5] Add behavior to hpa --- src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml index caf2d0534..56ff9c6c5 100644 --- a/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml +++ b/src/_base/helm/app/templates/horizontal-pod-autoscaler.yaml @@ -14,7 +14,7 @@ metadata: annotations: argocd.argoproj.io/sync-wave: "15" spec: - {{- with (pick $autoscaling "minReplicas" "maxReplicas") }} + {{- with (pick $autoscaling "behavior" "minReplicas" "maxReplicas") }} {{- . | toYaml | nindent 2 }} {{- end }} metrics: From 00a6c20719e8395085f375a9abaff951615ee82d Mon Sep 17 00:00:00 2001 From: andytson-inviqa Date: Mon, 17 Jan 2022 18:26:01 +0000 Subject: [PATCH 5/5] Convert lost int type back to int --- src/_base/helm/app/templates/pod-disruption-budgets.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_base/helm/app/templates/pod-disruption-budgets.yaml b/src/_base/helm/app/templates/pod-disruption-budgets.yaml index cbf6a5995..902b307a8 100644 --- a/src/_base/helm/app/templates/pod-disruption-budgets.yaml +++ b/src/_base/helm/app/templates/pod-disruption-budgets.yaml @@ -2,7 +2,7 @@ {{- with $service }} {{- if and (not (hasPrefix "." $serviceName)) .enabled }} {{- $autoscaling := .autoscaling | default (dict "minReplicas" 0) -}} -{{- if or (gt (.replicas | default 1) 1) (and $autoscaling.enabled (gt $autoscaling.minReplicas 1)) }} +{{- if or (gt (.replicas | default 1 | int) 1) (and $autoscaling.enabled (gt ($autoscaling.minReplicas | int) 1)) }} --- apiVersion: policy/v1beta1 kind: PodDisruptionBudget