Skip to content

Commit

Permalink
Apply wms config mount pattern (#138)
Browse files Browse the repository at this point in the history
* #137 Copy-paste pattern from OWS to datacube-data

Signed-off-by: Tisham Dhar <[email protected]>

* #137 Copy-paste pattern from OWS to datacube-index

* #137 Bump index Chart version
  • Loading branch information
whatnick authored Mar 4, 2020
1 parent 7c9bac2 commit 74c6a6b
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stable/datacube-data/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.0"
description: A Helm chart for running datacube data management
name: datacube-data
version: 0.2.3
version: 0.2.4
40 changes: 39 additions & 1 deletion stable/datacube-data/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ spec:
dnsConfig:
options:
- name: single-request-reopen
# Copy over WMS config from container image during init
initContainers:
{{- if .Values.wmsConfig.image }}
- name: wms-config
image: "{{ $.Values.wmsConfig.image.repository }}:{{ $.Values.wmsConfig.image.tag }}"
imagePullPolicy: {{ $.Values.wmsConfig.image.pullPolicy }}
args: [ "cp", "-f", "{{ .Values.wmsConfig.image.src }}", "{{ .Values.wmsConfig.path }}/{{ .Values.wmsConfig.filename }}" ]
volumeMounts:
- mountPath: {{ .Values.wmsConfig.path }}
name: wms-config-volume
{{- if .Values.wmsConfig.subpath }}
subPath: {{ .Values.wmsConfig.subpath }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand All @@ -39,8 +53,15 @@ spec:
value: {{ .Values.aws_region }}
- name: SQS_QUEUE_NAME
value: {{ .Values.sqs_queue_name }}
# Merge config URL for download or local file mounted via volume
{{- if .Values.wmsConfig.url }}
- name: WMS_CONFIG_URL
value: {{ $dc.wmsConfigURL | quote }}
value: {{ .Values.wmsConfig.url | quote }}
{{- end }}
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- value: "{{ .Values.wmsConfig.path }}/{{ .Values.wmsConfig.filename }}"
name: WMS_CONFIG_PATH
{{- end }}
- name: DB_HOSTNAME
value: {{ .Values.database.host | quote }}
- name: DB_PORT
Expand All @@ -65,6 +86,12 @@ spec:
value: {{ $value | quote }}
{{- end }}
{{- end }}
# Mount the config volume
volumeMounts:
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- mountPath: {{ .Values.wmsConfig.path }}
name: wms-config-volume
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
Expand All @@ -75,6 +102,17 @@ spec:
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
# Define the config volume
volumes:
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- name: wms-config-volume
{{- if .Values.wmsConfig.configMap }}
configMap:
name: {{ .Values.wmsConfig.configMap }}
{{- else if .Values.wmsConfig.image }}
emptyDir: {}
{{- end }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
Expand Down
6 changes: 5 additions & 1 deletion stable/datacube-data/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ tolerations: []
affinity: {}

global:
externalDatabase: {}
externalDatabase: {}

# Image to pull WMS Config from
wmsConfig:
image: { }
2 changes: 1 addition & 1 deletion stable/datacube-index/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Datacube OGC Web Services Indexing
name: datacube-index
version: 0.4.1
version: 0.4.2
keywords:
- datacube
- http
Expand Down
33 changes: 33 additions & 0 deletions stable/datacube-index/templates/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ spec:
- name: postgres-listener
image: alpine
command: ["sh", "-c", "for i in $(seq 1 200); do nc -z -w3 {{ .Values.database.host }} {{ .Values.database.port }} && exit 0 || sleep 3; done; exit 1"]
{{- if .Values.wmsConfig.image }}
- name: wms-config
image: "{{ $.Values.wmsConfig.image.repository }}:{{ $.Values.wmsConfig.image.tag }}"
imagePullPolicy: {{ $.Values.wmsConfig.image.pullPolicy }}
args: [ "cp", "-f", "{{ .Values.wmsConfig.image.src }}", "{{ .Values.wmsConfig.path }}/{{ .Values.wmsConfig.filename }}" ]
volumeMounts:
- mountPath: {{ .Values.wmsConfig.path }}
name: wms-config-volume
{{- if .Values.wmsConfig.subpath }}
subPath: {{ .Values.wmsConfig.subpath }}
{{- end }}
{{- end }}
containers:
- name: datacube-index
image: "{{ $image.repository }}:{{ $image.tag }}"
Expand All @@ -44,6 +56,10 @@ spec:
{{- else }}
value: {{ $dc.wmsConfigURL | quote }}
{{- end }}
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- value: "{{ .Values.wmsConfig.path }}/{{ .Values.wmsConfig.filename }}"
name: WMS_CONFIG_PATH
{{- end }}
{{- if $index.products }}
- name: PRODUCT_URLS
value: {{ template "helm-toolkit.utils.joinListWithSpace" $index.products }}
Expand Down Expand Up @@ -103,4 +119,21 @@ spec:
value: {{ $value | quote }}
{{- end }}
{{- end }}
# Mount the config volume
volumeMounts:
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- mountPath: {{ .Values.wmsConfig.path }}
name: wms-config-volume
{{- end }}
restartPolicy: Never
# Define the config volume
volumes:
{{- if or .Values.wmsConfig.configMap .Values.wmsConfig.image }}
- name: wms-config-volume
{{- if .Values.wmsConfig.configMap }}
configMap:
name: {{ .Values.wmsConfig.configMap }}
{{- else if .Values.wmsConfig.image }}
emptyDir: {}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions stable/datacube-index/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ database:
host: localhost
port: 5432
existingSecret: datacube

# Image to pull WMS Config from
wmsConfig:
image: { }

0 comments on commit 74c6a6b

Please sign in to comment.