Skip to content

Commit

Permalink
Use resources and image definition of postgres for initdb container (#29
Browse files Browse the repository at this point in the history
)

* Use resources and image definition of postgres for initdb container

* Improve templating of cluster domain

* Bump version to 2.1.0

Allow customizing resources for initDb container of seeder db
  • Loading branch information
oliverguenther authored Oct 26, 2023
1 parent a4770ca commit d5292d6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/openproject/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "A Helm chart for running OpenProject via Kubernetes"
home: "https://www.openproject.org/"
icon: "https://www.openproject.org/assets/images/press/openproject-icon-original-color-41055eb6.png"
type: "application"
version: "2.0.4"
version: "2.1.0"
appVersion: "12"
maintainers:
- name: OpenProject
Expand Down
2 changes: 1 addition & 1 deletion charts/openproject/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
{{- include "common.labels.standard" . | nindent 4 }}
stringData:
{{- if .Values.postgresql.bundled }}
DATABASE_HOST: {{ printf "%s-postgresql.%s.svc.cluster.local" .Release.Name .Release.Namespace | quote }}
DATABASE_HOST: {{ printf "%s-postgresql.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain | quote }}
DATABASE_PORT: "{{ .Values.postgresql.primary.service.ports.postgresql }}"
DATABASE_URL: "postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) }}:{{ .Values.postgresql.primary.service.ports.postgresql }}/{{ .Values.postgresql.auth.database }}"
{{- else }}
Expand Down
5 changes: 4 additions & 1 deletion charts/openproject/templates/seeder-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ spec:
{{- end }}
initContainers:
- name: check-db-ready
image: postgres:13
image: "{{ .Values.initdb.image.registry }}/{{ .Values.initdb.image.repository }}:{{ .Values.initdb.image.tag }}"
imagePullPolicy: {{ .Values.initdb.image.imagePullPolicy }}
command: [
'sh',
'-c',
Expand All @@ -25,6 +26,8 @@ spec:
envFrom:
- secretRef:
name: {{ include "common.names.fullname" . }}
resources:
{{- toYaml .Values.initdb.resources | nindent 12 }}
containers:
- name: seeder
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}{{ if .Values.image.sha256 }}@sha256:{{ .Values.image.sha256 }}{{ else }}:{{ .Values.image.tag }}{{ end }}"
Expand Down
39 changes: 39 additions & 0 deletions charts/openproject/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,45 @@ environment: {}
#
fullnameOverride: ""

##
# Override the cluster domain name used in templating
clusterDomain: "cluster.local"

## Define settings for wait-for-db init-container
#
initdb:
image:
## Define docker registry address.
#
registry: "docker.io"

## Define repository string.
#
repository: "postgres"

# Postgres version to use
tag: 13

## Define a imagePullPolicy.
##
## Ref.: https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
##
## "IfNotPresent" => The image is pulled only if it is not already present locally.
## "Always" => Every time the kubelet launches a container, the kubelet queries the container image registry to
## resolve the name to an image digest. If the kubelet has a container image with that exact digest cached
## locally, the kubelet uses its cached image; otherwise, the kubelet pulls the image with the resolved
## digest, and uses that image to launch the container.
## "Never" => The kubelet does not try fetching the image. If the image is somehow already present locally, the
## kubelet attempts to start the container; otherwise, startup fails
#
imagePullPolicy: "Always"

resources:
limits:
memory: "200Mi"
requests:
memory: "200Mi"

## Define and create Kubernetes Service.
##
## Ref.: https://kubernetes.io/docs/concepts/services-networking/ingress/
Expand Down

0 comments on commit d5292d6

Please sign in to comment.