Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define extravolumes and init containers in values.yaml #54

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/geoserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: geoserver
description: Helm chart for GeoServer
icon: https://geoserver.org/img/uploads/geoserver_icon.png
version: 2.1.0
appVersion: 2.24.1
version: 3.0.0
appVersion: 2.24.2
32 changes: 31 additions & 1 deletion charts/geoserver/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{{-if .Values.initData.enabled}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "geoserver.fullname" . }}
name: geoserver-init-configmap
labels:
{{ include "geoserver.labels" . | indent 4 }}

äölm,dsafölm,

TODO: allow secrets

data:
init-data.sh: |-
#!/bin/sh
Expand All @@ -27,3 +33,27 @@ data:
eval $CMD
echo "Successfully extracted geoserver_data directory to '{{ .Values.storage.dataDir }}'!"
fi
init-community-modules.sh: |-
#!/bin/sh
echo "Checking if geoserver_data is already initialized…"
FILE={{ .Values.storage.dataDir }}/.community_modules_loaded
if [ -f "$FILE" ]; then
echo "Directory geoserver_data already initialized."
else
echo "Downloading geoserver_data.tgz …"
CMD="wget -q -O /mnt/download/geoserver_data.tgz '{{ .Values.storage.initDataUrl }}'"
echo $CMD
eval $CMD
CMD="cd {{ .Values.storage.dataDir }}"
echo $CMD
eval $CMD
CMD="tar -zxf /mnt/download/geoserver_data.tgz --strip 1 -k"
echo $CMD
eval $CMD
CMD="touch $FILE"
echo $CMD
eval $CMD
echo "Successfully extracted geoserver_data directory to '{{ .Values.storage.dataDir }}'!"
fi
{{-end}}

27 changes: 8 additions & 19 deletions charts/geoserver/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
{{- if and .Values.storage.initDataUrl }}
- name: download-data
image: alpine
command: ["/bin/sh","/mnt/init-data.sh"]
volumeMounts:
- name: temp
mountPath: /mnt/download
- name: init-configmap
mountPath: /mnt/
- name: datadir
mountPath: {{ .Values.storage.dataDir }}
{{- if .Values.initContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -75,17 +66,12 @@ spec:
mountPath: {{ .Values.storage.dataDir }}
- name: additional-libs
mountPath: {{ .Values.storage.additionalLibsDir }}
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
volumes:
- name: temp
emptyDir: {}
- name: additional-libs
emptyDir: {}
- name: init-configmap
configMap:
name: {{ include "geoserver.fullname" . }}
items:
- key: init-data.sh
path: init-data.sh
{{- if and .Values.persistence.enabled (not .Values.persistence.useExisting) }}
- name: datadir
persistentVolumeClaim:
Expand All @@ -98,3 +84,6 @@ spec:
- name: datadir
emptyDir: {}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
46 changes: 43 additions & 3 deletions charts/geoserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ resources:
limits:
memory: 2500Mi
requests:
cpu: 500m
memory: 1500Mi
memory: 1250Mi

nodeSelector: {}

Expand All @@ -49,7 +48,48 @@ environment:
storage:
dataDir: /opt/geoserver_data
additionalLibsDir: /opt/additional_libs
# initDataUrl: https://files.example.com/geoserver_data.tgz

initData:
enabled: false
initDataUrl: https://files.example.com/geoserver_data.tgz
secret: my-secret

# init container config (can be used to add community modules or initial datasets)
initContainers:
- name: init-data-directory
image: docker.terrestris.de/alpine
command: [ "/bin/sh", "/mnt/init-data.sh" ]
volumeMounts:
- name: temp
mountPath: /mnt/download
- name: init-configmap
mountPath: /mnt/
- name: datadir
mountPath: /opt/geoserver_data
- name: init-community-modules
image: docker.terrestris.de/alpine
command: [ "/bin/sh","/mnt/init-community-modules.sh" ]
volumeMounts:
- name: temp
mountPath: /mnt/download
- name: init-configmap
mountPath: /mnt/
- name: additional_libs_dir
mountPath: /opt/additional_libs
extraVolumes:
- name: temp
emptyDir: {}
- name: init-configmap
configMap:
name: geoserver-init-configmap
items:
- key: init-data.sh
path: init-data.sh
- key: init-community-modules.sh
path: init-community-modules.sh
extraVolumeMounts:
- name: providers
mountPath: /opt/bitnami/keycloak/providers

# optional existing pvc for persistent geoserver data
persistence:
Expand Down
Loading