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

Add Rollout at PHP #321

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion php/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 32 additions & 0 deletions php/templates/autoscaling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
28 changes: 28 additions & 0 deletions php/templates/rollout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- $root := . -}}
{{- if .Values.rollout.enabled -}}
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: {{ include "php.fullname" . }}
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 }}
23 changes: 23 additions & 0 deletions php/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,26 @@ 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: {}

# HPA Configurattion for Rollout
autoscalingRollout:
# If true, enable HPA.
enabled: false
annotations: {}
labels: {}
minReplicas:
maxReplicas:
metrics: []
# This feature is available since 1.18
behavior: {}