@@ -156,3 +156,81 @@ spec:
156156 {{- end }}
157157 backoffLimit : 3
158158{{- end }}
159+
160+ {{- if and .Values.pgstacBootstrap.enabled .Values.pgstacBootstrap.settings.queryables }}
161+ ---
162+ apiVersion : batch/v1
163+ kind : Job
164+ metadata :
165+ name : {{ .Release.Name }}-pgstac-load-queryables
166+ labels :
167+ app : {{ .Release.Name }}-pgstac-load-queryables
168+ annotations :
169+ helm.sh/hook : " post-install,post-upgrade"
170+ helm.sh/hook-weight : " -3"
171+ helm.sh/hook-delete-policy : " before-hook-creation"
172+ spec :
173+ template :
174+ metadata :
175+ labels :
176+ app : {{ .Release.Name }}-pgstac-load-queryables
177+ spec :
178+ restartPolicy : Never
179+ containers :
180+ - name : pgstac-load-queryables
181+ image : {{ .Values.pgstacBootstrap.image.name }}:{{ .Values.pgstacBootstrap.image.tag }}
182+ command :
183+ - " /bin/sh"
184+ - " -c"
185+ args :
186+ - |
187+ # Exit immediately if a command exits with a non-zero status
188+ set -e
189+
190+ # Database connection configured through standard PG* environment variables
191+ # Environment variables are already set by the container
192+
193+ # Wait for the database to be ready
194+ echo "Waiting for database to be ready..."
195+ pypgstac pgready
196+
197+ # Load queryables configurations
198+ echo "Loading queryables configurations..."
199+ {{- range $idx, $config := .Values.pgstacBootstrap.settings.queryables }}
200+ {{- $filename := splitList "/" $config.file | last }}
201+ echo "Processing queryables file: {{ $filename }}"
202+ pypgstac load-queryables \
203+ {{- if $config.deleteMissing }}
204+ --delete-missing \
205+ {{- end }}
206+ {{- if $config.collections }}
207+ --collection-ids "[\\\"{{ join "\\\",\\\"" $config.collections }}\\\"]" \
208+ {{- end }}
209+ {{- if $config.indexFields }}
210+ --index-fields {{ join "," $config.indexFields }} \
211+ {{- end }}
212+ "/opt/queryables/{{ $filename }}"
213+ {{- end }}
214+
215+ echo "Queryables loading complete"
216+ resources :
217+ {{- toYaml .Values.pgstacBootstrap.settings.resources | nindent 12 }}
218+ volumeMounts :
219+ - mountPath : /opt/queryables
220+ name : {{ .Release.Name }}-queryables-volume
221+ env :
222+ {{- include "eoapi.postgresqlEnv" . | nindent 12 }}
223+ volumes :
224+ - name : {{ .Release.Name }}-queryables-volume
225+ configMap :
226+ name : {{ .Release.Name }}-pgstac-queryables-config
227+ {{- with .Values.pgstacBootstrap.settings.affinity }}
228+ affinity :
229+ {{- toYaml . | nindent 8 }}
230+ {{- end }}
231+ {{- with .Values.pgstacBootstrap.settings.tolerations }}
232+ tolerations :
233+ {{- toYaml . | nindent 8 }}
234+ {{- end }}
235+ backoffLimit : 3
236+ {{- end }}
0 commit comments