-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigmap.yaml
39 lines (39 loc) · 1.25 KB
/
configmap.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{{- if .Values.db.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: initdb-sql-config-{{ $.Release.Name }}
data:
initdb.sql: |
{{- range $path, $bytes := $.Files.Glob "initdb-data/*.sql" -}}
{{ $.Files.Get $path | nindent 4 }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: initdb-json-config-{{ $.Release.Name }}
data:
{{- range $path, $bytes := $.Files.Glob "initdb-data/*.json" -}}
{{- base $path | nindent 2 -}}: | {{- $.Files.Get $path | nindent 4 -}}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: initdb-sh-config-{{ $.Release.Name }}
data:
load.sh: |
#!/bin/bash
apt update -y && apt install python3 python3-pip -y
pip install pypgstac[psycopg]=={{ .Values.db.image.tag | trimPrefix "v" }}
DSN="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB"
pypgstac pgready --dsn $DSN
pypgstac load collections /opt/initdb/json-data/noaa-emergency-response.json --dsn $DSN --method insert_ignore
pypgstac load items /opt/initdb/json-data/noaa-eri-nashville2020.json --dsn $DSN --method insert_ignore
psql $DSN -f /opt/initdb/sql-data/initdb.sql
echo "DONE LOADING!!!!!!"
# run it forever like a docker process should
tail -f /dev/null
{{- end }}