Skip to content

Commit cc466a4

Browse files
authored
feat: remove wait-for-postgres init container from deployment (#583)
1 parent af9bd7e commit cc466a4

7 files changed

Lines changed: 13 additions & 114 deletions

File tree

charts/zitadel/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: zitadel
33
description: A Helm chart for ZITADEL
44
type: application
55
appVersion: v4.13.0
6-
version: 9.29.0
6+
version: 9.30.0
77
kubeVersion: '>= 1.30.0-0'
88
home: https://zitadel.com
99
sources:

charts/zitadel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Zitadel
44

5-
![Version: 9.29.0](https://img.shields.io/badge/Version-9.29.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.13.0](https://img.shields.io/badge/AppVersion-v4.13.0-informational?style=flat-square)
5+
![Version: 9.30.0](https://img.shields.io/badge/Version-9.30.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.13.0](https://img.shields.io/badge/AppVersion-v4.13.0-informational?style=flat-square)
66

77
## A Better Identity and Access Management Solution
88

@@ -391,7 +391,7 @@ Kubernetes: `>= 1.30.0-0`
391391
| tools.wait4x.image.pullPolicy | string | `""` | The pull policy for the wait4x image. If left empty, the chart defaults to the Kubernetes default pull policy for the given tag. |
392392
| tools.wait4x.image.repository | string | `"wait4x/wait4x"` | The name of the image repository that contains the wait4x image. The chart automatically prepends the registry (docker.io by default) for compatibility with CRI-O v1.34+ which enforces fully qualified names. |
393393
| tools.wait4x.image.tag | string | `"3.6"` | The image tag to use for the wait4x image. Leave empty to require the user to set a specific version explicitly. |
394-
| tools.wait4x.resources | ResourceRequirements | `{}` | CPU and memory resource requests and limits for wait4x init containers. These resources apply to all init containers using the wait4x tool, including wait-for-zitadel and wait-for-postgres. Setting equal requests and limits enables the "Guaranteed" QoS class when combined with resource settings on the main container. Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
394+
| tools.wait4x.resources | ResourceRequirements | `{}` | CPU and memory resource requests and limits for wait4x init containers. These resources apply to all init containers using the wait4x tool, such as wait-for-zitadel. Setting equal requests and limits enables the "Guaranteed" QoS class when combined with resource settings on the main container. Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
395395
| topologySpreadConstraints | []TopologySpreadConstraint | `[]` | Topology spread constraints control how pods are distributed across topology domains (e.g., zones, nodes, regions) for high availability. Unlike affinity, these constraints provide more granular control over pod distribution. Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ |
396396
| zitadel.autoscaling.annotations | map[string]string | `{}` | Annotations applied to the HPA object. |
397397
| zitadel.autoscaling.behavior | HorizontalPodAutoscalerBehavior | `{}` | Configures the scaling behavior for scaling up and down. See: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior |

charts/zitadel/templates/_helpers.tpl

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -352,26 +352,6 @@ http://{{ include "zitadel.fullname" . }}:{{ .Values.service.port }}/debug/ready
352352
{{- end -}}
353353

354354

355-
{{/*
356-
Returns the PostgreSQL TCP endpoint for wait4x health checks.
357-
Extracts the database host and port from ZITADEL configuration.
358-
Format: tcp://<host>:<port>
359-
Example: tcp://db-postgresql:5432
360-
*/}}
361-
{{- define "zitadel.postgresEndpoint" -}}
362-
{{- if .Values.zitadel -}}
363-
{{- if .Values.zitadel.configmapConfig -}}
364-
{{- if .Values.zitadel.configmapConfig.Database -}}
365-
{{- with .Values.zitadel.configmapConfig.Database.Postgres -}}
366-
{{- if .Host }}
367-
{{- .Host }}:{{ .Port | default 5432 }}
368-
{{- end -}}
369-
{{- end -}}
370-
{{- end -}}
371-
{{- end -}}
372-
{{- end -}}
373-
{{- end -}}
374-
375355
{{/*
376356
This helper template takes the Kubernetes cluster's version string, which
377357
can be complex (e.g., "v1.28.5+k3s1"), and returns a sanitized, clean

charts/zitadel/templates/deployment_zitadel.yaml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ spec:
9494
- name: ZITADEL_DATABASE_{{ $dbEnv }}_USER_SSL_KEY
9595
value: /db-ssl-user-crt/tls.key
9696
{{- end }}
97+
- name: ZITADEL_DATABASE_{{ $dbEnv }}_AWAITINITIALCONN
98+
value: "5m"
9799
{{- if .Values.zitadel.serverSslCrtSecret }}
98100
- name: ZITADEL_TLS_CERTPATH
99101
value: /server-ssl-crt/tls.crt
@@ -213,38 +215,8 @@ spec:
213215
{{- end }}
214216
resources:
215217
{{- toYaml .Values.resources | nindent 14 }}
216-
initContainers:
217-
# The following initContainer is conditional. It is only added if the
218-
# PostgreSQL endpoint can be fully determined from the Helm values. This is
219-
# necessary to gracefully handle configurations where database credentials are
220-
# provided via external secrets (instead of the values file), which would
221-
# otherwise cause a template rendering error during `helm install`.
222-
{{- $pgEndpoint := include "zitadel.postgresEndpoint" . }}
223-
{{- if $pgEndpoint }}
224-
# This initContainer acts as a dependency check before the main application
225-
# starts. It uses the `wait4x` tool to pause the pod's startup sequence
226-
# until the PostgreSQL database is accepting TCP connections. This prevents
227-
# the main ZITADEL container from starting and potentially crashing before its
228-
# database is available, thus improving deployment reliability.
229-
- name: wait-for-postgres
230-
image: {{ include "wait4x.image" . }}
231-
imagePullPolicy: '{{ default "IfNotPresent" .Values.tools.wait4x.image.pullPolicy }}'
232-
command:
233-
- wait4x
234-
- tcp
235-
- {{ $pgEndpoint }}
236-
- --timeout
237-
- "5m"
238-
- --interval
239-
- "5s"
240-
securityContext:
241-
{{- include "zitadel.securityContext" . | nindent 12 }}
242-
{{- with .Values.tools.wait4x.resources }}
243-
resources:
244-
{{- toYaml . | nindent 12 }}
245-
{{- end }}
246-
{{- end }}
247218
{{- with .Values.zitadel.initContainers }}
219+
initContainers:
248220
{{- toYaml . | nindent 8 }}
249221
{{- end }}
250222
volumes:

charts/zitadel/values.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@
14991499
}
15001500
},
15011501
"resources": {
1502-
"description": "CPU and memory resource requests and limits for wait4x init containers. These resources apply to all init containers using the wait4x tool, including wait-for-zitadel and wait-for-postgres. Setting equal requests and limits enables the \"Guaranteed\" QoS class when combined with resource settings on the main container. Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
1502+
"description": "CPU and memory resource requests and limits for wait4x init containers. These resources apply to all init containers using the wait4x tool, such as wait-for-zitadel. Setting equal requests and limits enables the \"Guaranteed\" QoS class when combined with resource settings on the main container. Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
15031503
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.30.0/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements",
15041504
"type": "object"
15051505
}

charts/zitadel/values.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,9 @@ extraManifests: []
13601360
# - Ingress
13611361

13621362
# Configuration for helper tools used by init containers and jobs. These images
1363-
# are used by components such as wait-for-zitadel, wait-for-postgres, and the
1364-
# setup and cleanup jobs. Each tool follows the standard image configuration
1365-
# pattern with registry, repository, tag, pull policy, and pull secrets.
1363+
# are used by components such as wait-for-zitadel and the setup and cleanup
1364+
# jobs. Each tool follows the standard image configuration pattern with
1365+
# registry, repository, tag, pull policy, and pull secrets.
13661366
tools:
13671367
# Configuration for the wait4x image used for readiness and dependency checks
13681368
# in init containers. Values are intentionally left empty and should be set by
@@ -1382,9 +1382,9 @@ tools:
13821382
# @schema $ref: $k8s/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements
13831383
# -- (ResourceRequirements) CPU and memory resource requests and limits for wait4x init containers.
13841384
# These resources apply to all init containers using the wait4x tool,
1385-
# including wait-for-zitadel and wait-for-postgres. Setting equal requests
1386-
# and limits enables the "Guaranteed" QoS class when combined with resource
1387-
# settings on the main container.
1385+
# such as wait-for-zitadel. Setting equal requests and limits enables the
1386+
# "Guaranteed" QoS class when combined with resource settings on the main
1387+
# container.
13881388
# Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
13891389
resources: {}
13901390
# Example for Guaranteed QoS class:

test/smoke/deployment_test.go

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,6 @@ func TestDeploymentMatrix(t *testing.T) {
6060
RunAsUser: assert.SomePtr(int64(1000)),
6161
FSGroup: assert.SomePtr(int64(1000)),
6262
},
63-
InitContainers: assert.Some([]assert.ContainerAssertion{
64-
{
65-
Name: assert.Some("wait-for-postgres"),
66-
Resources: assert.ResourceRequirementsAssertion{
67-
Requests: assert.Some(corev1.ResourceList{}),
68-
Limits: assert.Some(corev1.ResourceList{}),
69-
},
70-
SecurityContext: assert.SecurityContextAssertion{
71-
RunAsNonRoot: assert.SomePtr(true),
72-
RunAsUser: assert.SomePtr(int64(1000)),
73-
ReadOnlyRootFilesystem: assert.SomePtr(true),
74-
Privileged: assert.SomePtr(false),
75-
},
76-
},
77-
}),
7863
Containers: assert.Some([]assert.ContainerAssertion{
7964
{
8065
Name: assert.Some("zitadel"),
@@ -161,29 +146,6 @@ func TestDeploymentMatrix(t *testing.T) {
161146
"tools.wait4x.resources.limits.cpu": "100m",
162147
"tools.wait4x.resources.limits.memory": "64Mi",
163148
},
164-
zitadel: &assert.DeploymentAssertion{
165-
Spec: assert.DeploymentSpecAssertion{
166-
Template: assert.PodTemplateSpecAssertion{
167-
Spec: assert.PodSpecAssertion{
168-
InitContainers: assert.Some([]assert.ContainerAssertion{
169-
{
170-
Name: assert.Some("wait-for-postgres"),
171-
Resources: assert.ResourceRequirementsAssertion{
172-
Requests: assert.Some(corev1.ResourceList{
173-
corev1.ResourceCPU: resource.MustParse("50m"),
174-
corev1.ResourceMemory: resource.MustParse("32Mi"),
175-
}),
176-
Limits: assert.Some(corev1.ResourceList{
177-
corev1.ResourceCPU: resource.MustParse("100m"),
178-
corev1.ResourceMemory: resource.MustParse("64Mi"),
179-
}),
180-
},
181-
},
182-
}),
183-
},
184-
},
185-
},
186-
},
187149
login: &assert.DeploymentAssertion{
188150
Spec: assert.DeploymentSpecAssertion{
189151
Template: assert.PodTemplateSpecAssertion{
@@ -286,21 +248,6 @@ func TestDeploymentMatrix(t *testing.T) {
286248
Type: assert.Some(corev1.SeccompProfileTypeRuntimeDefault),
287249
},
288250
},
289-
InitContainers: assert.Some([]assert.ContainerAssertion{
290-
{
291-
Name: assert.Some("wait-for-postgres"),
292-
SecurityContext: assert.SecurityContextAssertion{
293-
RunAsNonRoot: assert.SomePtr(true),
294-
RunAsUser: assert.SomePtr(int64(2000)),
295-
ReadOnlyRootFilesystem: assert.SomePtr(true),
296-
Privileged: assert.SomePtr(false),
297-
AllowPrivilegeEscalation: assert.SomePtr(false),
298-
Capabilities: assert.CapabilitiesAssertion{
299-
Drop: assert.Some([]corev1.Capability{"ALL"}),
300-
},
301-
},
302-
},
303-
}),
304251
Containers: assert.Some([]assert.ContainerAssertion{
305252
{
306253
Name: assert.Some("zitadel"),

0 commit comments

Comments
 (0)