From 72057e11f07f4707761aa0c5efd22b62c91ef895 Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Thu, 13 Jun 2024 14:51:36 +0900 Subject: [PATCH 1/5] revert #300 --- akka/templates/autoscaling.yaml | 4 ++-- akka/templates/rollout.yaml | 2 +- akka/values.yaml | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/akka/templates/autoscaling.yaml b/akka/templates/autoscaling.yaml index ae2aadf9..d347b554 100644 --- a/akka/templates/autoscaling.yaml +++ b/akka/templates/autoscaling.yaml @@ -25,7 +25,7 @@ spec: {{- toYaml .Values.autoscaling.metrics | nindent 4 }} minReplicas: {{ .Values.autoscaling.minReplicas }} scaleTargetRef: - kind: {{ .Values.autoscaling.scaleTargetRef.kind }} - apiVersion: {{ .Values.autoscaling.scaleTargetRef.apiVersion }} + kind: Deployment + apiVersion: apps/v1 name: "{{ template "akka.fullname" . }}" {{- end }} diff --git a/akka/templates/rollout.yaml b/akka/templates/rollout.yaml index 42e2be64..ab858ac1 100644 --- a/akka/templates/rollout.yaml +++ b/akka/templates/rollout.yaml @@ -21,6 +21,6 @@ spec: {{- end }} replicas: {{ .Values.rollout.replicaCount }} revisionHistoryLimit: {{ .Values.rollout.revisionHistoryLimit }} - strategy: + strategy: {{- toYaml .Values.rollout.strategy | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/akka/values.yaml b/akka/values.yaml index 409fa79c..ce27100d 100644 --- a/akka/values.yaml +++ b/akka/values.yaml @@ -290,9 +290,6 @@ autoscaling: metrics: [] # This feature is available since 1.18 behavior: {} - scaleTargetRef: - kind: Deployment - apiVersion: apps/v1 # Metrics Configuration. metrics: From a50fa1d9d7154b1a54c0d6f496a11fc8b080ec9c Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Thu, 13 Jun 2024 15:17:39 +0900 Subject: [PATCH 2/5] add HPA for Rollout --- akka/templates/autoscaling.yaml | 31 +++++++++++++++++++++++++++++++ akka/templates/deployment.yaml | 2 +- akka/templates/rollout.yaml | 2 ++ akka/values.yaml | 15 ++++++++++++++- 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/akka/templates/autoscaling.yaml b/akka/templates/autoscaling.yaml index d347b554..46f457c9 100644 --- a/akka/templates/autoscaling.yaml +++ b/akka/templates/autoscaling.yaml @@ -29,3 +29,34 @@ spec: apiVersion: apps/v1 name: "{{ template "akka.fullname" . }}" {{- end }} + +{{- if .Values.autoscalingRollout.enabled -}} +{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: autoscaling/v2 +{{- else }} +apiVersion: autoscaling/v2beta2 +{{- end }} +kind: HorizontalPodAutoscaler +metadata: + annotations: + {{- toYaml .Values.autoscalingRollout.annotations | nindent 4}} + labels: + {{- include "akka.labels" . | nindent 4 }} + {{- with .Values.autoscalingRollout.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + name: "{{ template "akka.fullname" . }}" +spec: + {{- with .Values.autoscalingRollout.behavior }} + behavior: + {{- toYaml . | nindent 4 }} + {{- end }} + maxReplicas: {{ .Values.autoscalingRollout.maxReplicas }} + metrics: + {{- toYaml .Values.autoscalingRollout.metrics | nindent 4 }} + minReplicas: {{ .Values.autoscalingRollout.minReplicas }} + scaleTargetRef: + kind: Rollout + apiVersion: argoproj.io/v1alpha1 + name: "{{ template "akka.fullname" . }}" +{{- end }} \ No newline at end of file diff --git a/akka/templates/deployment.yaml b/akka/templates/deployment.yaml index d8a621fe..3024ef72 100644 --- a/akka/templates/deployment.yaml +++ b/akka/templates/deployment.yaml @@ -13,7 +13,7 @@ metadata: {{- end }} name: "{{ include "akka.fullname" . }}" spec: - {{- if and (not .Values.autoscaling.enabled) .Values.replicaCount }} + {{- if and (not .Values.autoscaling.enabled) (ne .Values.replicaCount nil) }} replicas: {{ .Values.replicaCount }} {{- end }} selector: diff --git a/akka/templates/rollout.yaml b/akka/templates/rollout.yaml index ab858ac1..9375d87d 100644 --- a/akka/templates/rollout.yaml +++ b/akka/templates/rollout.yaml @@ -19,7 +19,9 @@ spec: template: {{- toYaml .Values.rollout.template | nindent 4 }} {{- end }} + {{- if and (not .Values.autoscalingRollout.enabled) (ne .Values.rollout.replicaCount nil) }} replicas: {{ .Values.rollout.replicaCount }} + {{- end }} revisionHistoryLimit: {{ .Values.rollout.revisionHistoryLimit }} strategy: {{- toYaml .Values.rollout.strategy | nindent 4 }} diff --git a/akka/values.yaml b/akka/values.yaml index ce27100d..f56f28aa 100644 --- a/akka/values.yaml +++ b/akka/values.yaml @@ -412,6 +412,19 @@ rollout: workloadRef: enabled: false template: {} - replicaCount: 3 + # If you want fix replicaCount, disable autoscalingRollout.enabled and uncomment the following line + #replicaCount: 3 revisionHistoryLimit: 10 strategy: {} + +# HPA Configurattion for Rollout +autoscalingRollout: + # If true, enable HPA. + enabled: false + annotations: {} + labels: {} + minReplicas: + maxReplicas: + metrics: [] + # This feature is available since 1.18 + behavior: {} From 34b30406ff5aff100ca4c3f55fd04e526e5b669b Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Thu, 13 Jun 2024 15:18:16 +0900 Subject: [PATCH 3/5] bump --- akka/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/akka/Chart.yaml b/akka/Chart.yaml index 5ce7dd0c..c9fce21e 100644 --- a/akka/Chart.yaml +++ b/akka/Chart.yaml @@ -14,7 +14,7 @@ type: application # 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. -version: 0.2.17 +version: 0.2.18 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. From 785acce3346521b2f6433f2c39c820b4228950ee Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Thu, 13 Jun 2024 16:20:55 +0900 Subject: [PATCH 4/5] add --- --- akka/templates/autoscaling.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/akka/templates/autoscaling.yaml b/akka/templates/autoscaling.yaml index 46f457c9..870d2b3c 100644 --- a/akka/templates/autoscaling.yaml +++ b/akka/templates/autoscaling.yaml @@ -29,7 +29,7 @@ spec: apiVersion: apps/v1 name: "{{ template "akka.fullname" . }}" {{- end }} - +--- {{- if .Values.autoscalingRollout.enabled -}} {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} apiVersion: autoscaling/v2 From d38c184ded29b15e01fcab8476d352e32ccf99d3 Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Thu, 13 Jun 2024 16:24:26 +0900 Subject: [PATCH 5/5] fix --- akka/templates/autoscaling.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/akka/templates/autoscaling.yaml b/akka/templates/autoscaling.yaml index 870d2b3c..f4117686 100644 --- a/akka/templates/autoscaling.yaml +++ b/akka/templates/autoscaling.yaml @@ -29,8 +29,9 @@ spec: apiVersion: apps/v1 name: "{{ template "akka.fullname" . }}" {{- end }} ---- + {{- if .Values.autoscalingRollout.enabled -}} +--- {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} apiVersion: autoscaling/v2 {{- else }}