Skip to content
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
24 changes: 24 additions & 0 deletions template/k8s/base/celery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ spec:
app: celery
spec:
priorityClassName: app-medium-priority
initContainers:
- name: check-db-ready
image: postgres:17
command: [
"sh",
"-c",
"until pg_isready -h $(POSTGRES_HOST);
do echo waiting for postgres; sleep 2; done;",
]
- name: wait-for-migrations
image: backend:latest
command:
- sh
- -c
- |
until python manage.py migrate --check; do
echo "waiting for migrations to be applied";
sleep 5;
done
envFrom:
- configMapRef:
name: app-config
- secretRef:
name: secrets-config
containers:
- name: celeryworker
image: backend:latest
Expand Down
11 changes: 11 additions & 0 deletions template/k8s/local/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,14 @@ patches:
target:
kind: Deployment
name: backend
{%- if copier__use_celery %}
- patch: |-
- op: add
path: /spec/template/spec/initContainers/0/env
value:
- name: POSTGRES_HOST
value: postgres
target:
kind: Deployment
name: celery
{%- endif %}
24 changes: 24 additions & 0 deletions template/k8s/sandbox/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ patches:
name: backend
{%- if copier__use_celery %}
- patch: |-
- op: add
path: /spec/template/spec/initContainers/0/env
value:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-app
key: host
- op: replace
path: /spec/template/spec/initContainers/0/command
value: ["sh", "-c", "until pg_isready -h $(POSTGRES_HOST); do echo waiting for postgres; sleep 2; done;"]
- op: add
path: /spec/template/spec/initContainers/1/env
value:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-app
key: host
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: postgres-app
key: uri
- op: add
path: /spec/template/spec/containers/0/env
value:
Expand Down
Loading