Skip to content

Commit

Permalink
🧑‍💻 Add some Init Containers (#1319)
Browse files Browse the repository at this point in the history
* Add some Init Containers to make sure Postgres is up
  * Governance/Multitenant Agent
  * Mediator
  * Trust Registry
* Point Trust Registry at PGProxy
* NATS does not depend on Istio
* Bump DD Python Lib `2.20.0` -> `2.20.1`
  • Loading branch information
rblaine95 authored Feb 10, 2025
1 parent 549838e commit 1fe8f3a
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 4 deletions.
1 change: 1 addition & 0 deletions helm/acapy-cloud.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ releases:
podLabels:
admission.datadoghq.com/enabled: "false"
tags.datadoghq.com/env: {{ .Environment.Name }}
sidecar.istio.io/inject: "false"
- nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
tolerations: {{ toYaml .Values.tolerations | nindent 10 }}
set:
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/dev/governance-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ initContainers:
value: "{{ .Values.env.NATS_SERVER }}"
- name: NATS_STREAM
value: "{{ .Values.env.NATS_STREAM }}"
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT

persistence:
enabled: false
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/dev/mediator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ readinessProbe:
# memory: 384Mi

initContainers:
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT
- name: wait-governance-agent
image: curlimages/curl
command:
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/dev/multitenant-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ initContainers:
value: "{{ .Values.env.NATS_SERVER }}"
- name: NATS_STREAM
value: "{{ .Values.env.NATS_STREAM }}"
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT

persistence:
enabled: true
Expand Down
7 changes: 6 additions & 1 deletion helm/acapy-cloud/conf/dev/trust-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ readinessProbe:
autoscaling:
enabled: false

initContainers:
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z cloudapi-pgpool 5432; do echo waiting for pgproxy; sleep 2; done;']

secretData:
POSTGRES_DATABASE_URL: postgresql://trust-registry:trust-registry@cloudapi-postgresql:5432/trust-registry?sslmode=prefer
POSTGRES_DATABASE_URL: postgresql://trust-registry:trust-registry@cloudapi-pgpool:5432/trust-registry?sslmode=prefer

env:
LOG_LEVEL: warning
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/local/governance-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ initContainers:
value: "{{ .Values.env.NATS_SERVER }}"
- name: NATS_STREAM
value: "{{ .Values.env.NATS_STREAM }}"
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT

persistence:
enabled: false
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/local/mediator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ readinessProbe:
# memory: 384Mi

initContainers:
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT
- name: wait-governance-agent
image: curlimages/curl
command:
Expand Down
14 changes: 14 additions & 0 deletions helm/acapy-cloud/conf/local/multitenant-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ initContainers:
value: "{{ .Values.env.NATS_SERVER }}"
- name: NATS_STREAM
value: "{{ .Values.env.NATS_STREAM }}"
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z $(PG_HOST) $(PG_PORT); do echo waiting for postgres; sleep 2; done;']
env:
- name: PG_HOST
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_HOST
- name: PG_PORT
valueFrom:
secretKeyRef:
name: '{{ include "acapy-cloud.fullname" . }}-env'
key: WALLET_DB_PORT

persistence:
enabled: true
Expand Down
7 changes: 6 additions & 1 deletion helm/acapy-cloud/conf/local/trust-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ readinessProbe:
autoscaling:
enabled: false

initContainers:
- name: nc-postgres
image: busybox
command: ['sh', '-c', 'until nc -z cloudapi-pgpool 5432; do echo waiting for pgproxy; sleep 2; done;']

secretData:
POSTGRES_DATABASE_URL: postgresql://trust-registry:trust-registry@cloudapi-postgresql:5432/trust-registry?sslmode=prefer
POSTGRES_DATABASE_URL: postgresql://trust-registry:trust-registry@cloudapi-pgpool:5432/trust-registry?sslmode=prefer

env:
LOG_LEVEL: warning
Expand Down
2 changes: 1 addition & 1 deletion helm/acapy-cloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ podLabels:
admission.datadoghq.com/enabled: "false" # disabled by default (for now)
podAnnotations:
# gcr.io/datadoghq/dd-lib-python-init
admission.datadoghq.com/python-lib.version: v2.20.0
admission.datadoghq.com/python-lib.version: v2.20.1
ad.datadoghq.com/istio-proxy.logs: '[{ "source": "envoy", "service": "{{ include "acapy-cloud.fullname" . }}" }]'
ad.datadoghq.com/istio-init.logs: '[{ "source": "envoy", "service": "{{ include "acapy-cloud.fullname" . }}" }]'

Expand Down
1 change: 0 additions & 1 deletion tilt/acapy-cloud/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def setup_nats(namespace):
resource_deps=[
"cloudapi-ns",
"build-nats",
"istio",
],
port_forwards=[
port_forward(8222, name="monitoring"),
Expand Down

0 comments on commit 1fe8f3a

Please sign in to comment.