From c019735184a3e9c8c353f510653ee206c85a99c7 Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Tue, 30 Jul 2024 14:10:23 +0900 Subject: [PATCH 1/4] add rollout --- php/templates/rollout.yaml | 28 ++++++++++++++++++++++++++++ php/values.yaml | 11 +++++++++++ 2 files changed, 39 insertions(+) create mode 100644 php/templates/rollout.yaml diff --git a/php/templates/rollout.yaml b/php/templates/rollout.yaml new file mode 100644 index 00000000..116327f1 --- /dev/null +++ b/php/templates/rollout.yaml @@ -0,0 +1,28 @@ +{{- $root := . -}} +{{- if .Values.rollout.enabled -}} +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + name: "{{ include "akka.containerName" . }}" + labels: + {{- include "php.labels" . | nindent 4 }} + {{- range $k, $v := .Values.labels }} + {{ $k }}: {{ $v | quote }} + {{- end }} +spec: + {{- if .Values.rollout.workloadRef.enabled }} + workloadRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "php.fullname" . }} + {{- else }} + 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 }} +{{- end }} \ No newline at end of file diff --git a/php/values.yaml b/php/values.yaml index 88884cfc..036bb047 100644 --- a/php/values.yaml +++ b/php/values.yaml @@ -464,3 +464,14 @@ fpm: # TEST test: enabled: true + +# Rollout configurations +rollout: + enabled: false + workloadRef: + enabled: false + template: {} + # If you want fix replicaCount, disable autoscalingRollout.enabled and uncomment the following line + #replicaCount: 3 + revisionHistoryLimit: 10 + strategy: {} From 3c5cd51c05870b07df85010340fd2183f5eb46eb Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Wed, 21 Aug 2024 17:57:38 +0900 Subject: [PATCH 2/4] add rollout hpa --- php/templates/autoscaling.yaml | 32 ++++++++++++++++++++++++++++++++ php/templates/rollout.yaml | 2 +- php/values.yaml | 12 ++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/php/templates/autoscaling.yaml b/php/templates/autoscaling.yaml index f5e656ed..b3ac3269 100644 --- a/php/templates/autoscaling.yaml +++ b/php/templates/autoscaling.yaml @@ -31,3 +31,35 @@ spec: {{- toYaml .Values.autoscaling.behavior | nindent 4 }} {{- end }} {{- 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 "php.labels" . | nindent 4 }} + {{- with .Values.autoscalingRollout.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + name: "{{ template "php.fullname" . }}-rollout" +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 "php.fullname" . }}" +{{- end }} diff --git a/php/templates/rollout.yaml b/php/templates/rollout.yaml index 116327f1..37a87ac1 100644 --- a/php/templates/rollout.yaml +++ b/php/templates/rollout.yaml @@ -3,7 +3,7 @@ apiVersion: argoproj.io/v1alpha1 kind: Rollout metadata: - name: "{{ include "akka.containerName" . }}" + name: {{ include "php.fullname" . }} labels: {{- include "php.labels" . | nindent 4 }} {{- range $k, $v := .Values.labels }} diff --git a/php/values.yaml b/php/values.yaml index 036bb047..6c672c51 100644 --- a/php/values.yaml +++ b/php/values.yaml @@ -475,3 +475,15 @@ rollout: #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 3290544704996c575a8d1df8cc66b629204ac9f5 Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Wed, 21 Aug 2024 17:59:38 +0900 Subject: [PATCH 3/4] bump --- php/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/Chart.yaml b/php/Chart.yaml index d4c17fd6..f51fdb24 100644 --- a/php/Chart.yaml +++ b/php/Chart.yaml @@ -15,7 +15,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: 1.4.0 +version: 1.4.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. From ae52472bf7834e70af88c7287f4b469ef0ac1588 Mon Sep 17 00:00:00 2001 From: hanayo04 Date: Wed, 21 Aug 2024 18:03:34 +0900 Subject: [PATCH 4/4] fmt --- php/templates/rollout.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/templates/rollout.yaml b/php/templates/rollout.yaml index 37a87ac1..31e4dd60 100644 --- a/php/templates/rollout.yaml +++ b/php/templates/rollout.yaml @@ -25,4 +25,4 @@ spec: revisionHistoryLimit: {{ .Values.rollout.revisionHistoryLimit }} strategy: {{- toYaml .Values.rollout.strategy | nindent 4 }} -{{- end }} \ No newline at end of file +{{- end }}