Skip to content

Commit 3691cd4

Browse files
authored
Merge pull request docker-mailserver#183 from younsl/feat/support-resize-policy
feat: Add support containers.resizePolicy in deployments
2 parents ee1b095 + ed29ba0 commit 3691cd4

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

charts/docker-mailserver/templates/deployment.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ spec:
128128

129129
resources:
130130
{{ toYaml .Values.deployment.resources | indent 12 }}
131+
{{- if and .Values.deployment.resizePolicy (semverCompare ">=1.33-0" .Capabilities.KubeVersion.Version) }}
132+
resizePolicy:
133+
{{ toYaml .Values.deployment.resizePolicy | indent 12 }}
134+
{{- end }}
131135
securityContext:
132136
{{- if eq .Values.deployment.env.ENABLE_FAIL2BAN 1.0 }}
133137
capabilities:
@@ -271,7 +275,11 @@ spec:
271275
name: http
272276
protocol: TCP
273277
resources:
274-
{{ toYaml .Values.metrics.resources | indent 12 }}
278+
{{ toYaml .Values.metrics.resources | indent 12 }}
279+
{{- if and .Values.metrics.resizePolicy (semverCompare ">=1.33-0" .Capabilities.KubeVersion.Version) }}
280+
resizePolicy:
281+
{{ toYaml .Values.metrics.resizePolicy | indent 12 }}
282+
{{- end }}
275283
securityContext:
276284
{{ toYaml .Values.deployment.containerSecurityContext | indent 12 }}
277285

charts/docker-mailserver/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ deployment:
262262
memory: "2048Mi"
263263
ephemeral-storage: "500Mi"
264264

265+
## Container resource resize policy for the docker-mailserver container
266+
## Allows dynamic adjustment of CPU and memory resources without pod restart
267+
## Useful for handling load spikes or optimizing resource utilization in production
268+
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/
269+
resizePolicy: []
270+
# - resourceName: memory
271+
# restartPolicy: NotRequired
272+
# - resourceName: cpu
273+
# restartPolicy: RestartContainer
274+
265275
## Optionally specify tolerations for the deployment
266276
tolerations: []
267277

@@ -464,6 +474,16 @@ metrics:
464474
# memory: "256Mi"
465475
# cpu: "500M"
466476

477+
## Container resource resize policy for the metrics-exporter container
478+
## Allows dynamic adjustment of CPU and memory resources without pod restart
479+
## Useful for handling load spikes or optimizing resource utilization in production
480+
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/
481+
resizePolicy: []
482+
# - resourceName: memory
483+
# restartPolicy: NotRequired
484+
# - resourceName: cpu
485+
# restartPolicy: RestartContainer
486+
467487
serviceMonitor:
468488
enabled: false
469489
scrapeInterval: 15s

0 commit comments

Comments
 (0)