Skip to content

Commit fba8c9f

Browse files
fix: Add queryables file name check (#380)
1 parent f8a378e commit fba8c9f

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fixed Helm template to check queryables `file` field with schema validation [#380](https://github.com/developmentseed/eoapi-k8s/pull/380)
13+
1014
## [0.8.1]
1115

1216
### Added

charts/eoapi/templates/database/pgstacbootstrap/configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ data:
5050
{{- if .Values.pgstacBootstrap.settings.queryables }}
5151
{{- $hasFileBasedQueryables := false }}
5252
{{- range $config := .Values.pgstacBootstrap.settings.queryables }}
53-
{{- if $config.file }}
53+
{{- if and $config.file (typeIs "string" $config.file) }}
5454
{{- $hasFileBasedQueryables = true }}
5555
{{- end }}
5656
{{- end }}
@@ -65,7 +65,7 @@ metadata:
6565
helm.sh/hook-delete-policy: "before-hook-creation,hook-succeeded"
6666
data:
6767
{{- range $config := .Values.pgstacBootstrap.settings.queryables }}
68-
{{- if $config.file }}
68+
{{- if and $config.file (typeIs "string" $config.file) }}
6969
{{ $config.name }}: |
7070
{{- $.Files.Get $config.file | nindent 4 }}
7171
{{- end }}

charts/eoapi/templates/database/pgstacbootstrap/job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ spec:
221221
{{- toYaml .Values.pgstacBootstrap.settings.resources | nindent 12 }}
222222
volumeMounts:
223223
{{- range $idx, $config := .Values.pgstacBootstrap.settings.queryables }}
224-
{{- if $config.file }}
224+
{{- if and $config.file (typeIs "string" $config.file) }}
225225
- mountPath: /opt/queryables/{{ $config.name }}
226226
name: {{ $.Release.Name }}-queryables-volume
227227
subPath: {{ $config.name }}
@@ -236,7 +236,7 @@ spec:
236236
volumes:
237237
{{- $hasFileBasedQueryables := false }}
238238
{{- range $config := .Values.pgstacBootstrap.settings.queryables }}
239-
{{- if $config.file }}
239+
{{- if and $config.file (typeIs "string" $config.file) }}
240240
{{- $hasFileBasedQueryables = true }}
241241
{{- end }}
242242
{{- end }}

charts/eoapi/values.schema.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,71 @@
334334
"description": "Cron schedule for updating collection extents"
335335
}
336336
}
337+
},
338+
"queryables": {
339+
"type": "array",
340+
"description": "List of queryables configurations to load using pypgstac load-queryables",
341+
"items": {
342+
"type": "object",
343+
"required": ["name"],
344+
"properties": {
345+
"name": {
346+
"type": "string",
347+
"description": "Name of the queryables configuration file"
348+
},
349+
"file": {
350+
"type": "string",
351+
"description": "Path to the queryables file relative to the chart directory"
352+
},
353+
"configMapRef": {
354+
"type": "object",
355+
"description": "Reference to an external ConfigMap containing queryables data",
356+
"properties": {
357+
"name": {
358+
"type": "string",
359+
"description": "Name of the ConfigMap"
360+
},
361+
"key": {
362+
"type": "string",
363+
"description": "Key within the ConfigMap containing the queryables data"
364+
}
365+
},
366+
"required": ["name", "key"]
367+
},
368+
"indexFields": {
369+
"type": "array",
370+
"description": "List of fields to create database indexes for",
371+
"items": {
372+
"type": "string"
373+
}
374+
},
375+
"deleteMissing": {
376+
"type": "boolean",
377+
"description": "Whether to delete queryables not present in this configuration"
378+
},
379+
"collections": {
380+
"type": "array",
381+
"description": "List of collection IDs to apply these queryables to",
382+
"items": {
383+
"type": "string"
384+
}
385+
}
386+
},
387+
"oneOf": [
388+
{
389+
"required": ["file"],
390+
"not": {
391+
"required": ["configMapRef"]
392+
}
393+
},
394+
{
395+
"required": ["configMapRef"],
396+
"not": {
397+
"required": ["file"]
398+
}
399+
}
400+
]
401+
}
337402
}
338403
}
339404
}

0 commit comments

Comments
 (0)