-
Notifications
You must be signed in to change notification settings - Fork 92
helm: add global.nodeSelector propagated to all pod specs #312
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| {{- if and .Values.dbInit.enabled (not .Values.postgresql.enabled) }} | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: {{ printf "%s-db-init" (include "codex-lb.fullname" . | trunc 52 | trimSuffix "-") }} | ||
| namespace: {{ .Release.Namespace | quote }} | ||
| labels: | ||
| {{- include "codex-lb.labels" . | nindent 4 }} | ||
| annotations: | ||
| "helm.sh/hook": pre-install | ||
| "helm.sh/hook-weight": "-10" | ||
| "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
| spec: | ||
| template: | ||
| spec: | ||
| restartPolicy: OnFailure | ||
| {{- with .Values.nodeSelector }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The db-init Job still reads only Useful? React with 👍 / 👎. |
||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - name: db-init | ||
| image: {{ printf "%s/bitnami/postgresql:16" (.Values.global.imageRegistry | default "docker.io") }} | ||
| command: ["sh", "-ec"] | ||
| args: | ||
| - | | ||
| PGPASSWORD="$ADMIN_PASSWORD" psql \ | ||
| -h "$DB_HOST" -p "$DB_PORT" -U "$ADMIN_USER" -d postgres <<'SQL' | ||
| {{- range .Values.dbInit.databases }} | ||
| DO $$ BEGIN | ||
| IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '{{ .user }}') THEN | ||
| CREATE ROLE {{ .user }} WITH LOGIN PASSWORD '{{ .password }}'; | ||
| END IF; | ||
| END $$; | ||
| SELECT format('CREATE DATABASE %I OWNER %I', '{{ .name }}', '{{ .user }}') | ||
| WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '{{ .name }}')\gexec | ||
| GRANT ALL PRIVILEGES ON DATABASE {{ .name }} TO {{ .user }}; | ||
| {{- end }} | ||
| SQL | ||
| env: | ||
| - name: DB_HOST | ||
| value: {{ .Values.dbInit.host | quote }} | ||
| - name: DB_PORT | ||
| value: {{ .Values.dbInit.port | default "5432" | quote }} | ||
| - name: ADMIN_USER | ||
| value: {{ .Values.dbInit.adminUser | quote }} | ||
| - name: ADMIN_PASSWORD | ||
| {{- if .Values.dbInit.adminPasswordSecret }} | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ .Values.dbInit.adminPasswordSecret.name }} | ||
| key: {{ .Values.dbInit.adminPasswordSecret.key }} | ||
| {{- else }} | ||
| value: {{ .Values.dbInit.adminPassword | quote }} | ||
| {{- end }} | ||
| backoffLimit: 3 | ||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,8 +35,12 @@ spec: | |
| {{- range $pullSecrets }} | ||
| - name: {{ . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.postgresql.enabled }} | ||
| {{- end }} | ||
| {{- with (include "codex-lb.nodeSelector" .) }} | ||
| nodeSelector: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Useful? React with 👍 / 👎. |
||
| {{- . | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.postgresql.enabled }} | ||
| initContainers: | ||
| - name: wait-for-db | ||
| image: postgres:16-alpine | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
nodeSelectorkey indeployment.yamlis indented one space deeper than the surrounding pod-spec fields. Whenglobal.nodeSelectorornodeSelectoris set, this block is emitted and no longer aligns with sibling keys liketolerations, producing invalid manifest structure and causing Helm render/apply failures for node-pinned deployments.Useful? React with 👍 / 👎.