diff --git a/charts/geoserver/Chart.yaml b/charts/geoserver/Chart.yaml index aa1f3a8..293231b 100644 --- a/charts/geoserver/Chart.yaml +++ b/charts/geoserver/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: geoserver description: Helm chart for GeoServer icon: https://geoserver.org/img/uploads/geoserver_icon.png -version: 4.1.0 +version: 4.2.0 appVersion: 2.25.2 diff --git a/charts/geoserver/README.md b/charts/geoserver/README.md index c24564a..4bff1c6 100644 --- a/charts/geoserver/README.md +++ b/charts/geoserver/README.md @@ -17,4 +17,7 @@ The following parameters can be configured in (a custom) `values.yaml`: * `persistence.existingPvcName`: The name of an existing pvc (persistent volume claim) that should be used to store geoserver data * `geofence.enableInitScript`: A flag to control whether a init script for geofence should run or not. default: `false`. * `geofence.dataSourceUrl`: This will only be used if `geofence.enableInitScript` is `true`. Have a look at the `values.yaml` for an example value. -* `geofence.env`: This will only be used if `geofence.enableInitScript` is `true`. Have a look at the `values.yaml` for an example value. \ No newline at end of file +* `geofence.env`: This will only be used if `geofence.enableInitScript` is `true`. Have a look at the `values.yaml` for an example value. +* `monitoring.enableInitScript`: A flag to control whether a init script for the gs monitoring extension should run or not. default: `false`. +* `monitoring.filterProperties`: The file content of the [filter.properties](https://docs.geoserver.org/stable/en/user/extensions/monitoring/configuration.html) used by the monitoring extension. This will only be used if `monitoring.enableInitScript` is `true`. default: see `values.yaml` +* `monitoring.monitorProperties`: The file content of the [monitor.properties](https://docs.geoserver.org/stable/en/user/extensions/monitoring/configuration.html) used by the monitoring extension. This will only be used if `monitoring.enableInitScript` is `true`. default: see `values.yaml` diff --git a/charts/geoserver/templates/configmap.yaml b/charts/geoserver/templates/configmap.yaml index b3308a1..f2ea4a6 100644 --- a/charts/geoserver/templates/configmap.yaml +++ b/charts/geoserver/templates/configmap.yaml @@ -67,9 +67,9 @@ data: {{- if .Values.geofence.enableInitScript }} init-geofence.sh: |- #!/bin/sh - echo "Initialising geofence config in /opt/geoserver_data/geofence/geofence-datasource-ovr.properties" - mkdir -p /opt/geoserver_data/geofence - cat > /opt/geoserver_data/geofence/geofence-datasource-ovr.properties << EOL + echo "Initializing geofence config in {{ .Values.storage.dataDir }}/geofence/geofence-datasource-ovr.properties" + mkdir -p {{ .Values.storage.dataDir }}/geofence + cat > {{ .Values.storage.dataDir }}/geofence/geofence-datasource-ovr.properties << EOL geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect geofenceDataSource.driverClassName=org.postgresql.Driver geofenceDataSource.url={{ .Values.geofence.dataSourceUrl }} @@ -79,5 +79,13 @@ data: geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=update EOL {{- end}} + {{- if .Values.monitoring.enableInitScript }} + init-monitoring.sh: |- + #!/bin/sh + echo "Initializing monitoring config by copying properties files to {{ .Values.storage.dataDir }}/monitoring" + mkdir -p {{ .Values.storage.dataDir }}/monitoring && cp /mnt/{filter,monitor}.properties {{ .Values.storage.dataDir }}/monitoring/ + filter.properties: {{ .Values.monitoring.filterProperties | toYaml | indent 2 }} + monitor.properties: {{ .Values.monitoring.monitorProperties | toYaml | indent 2 }} + {{- end}} {{- end}} diff --git a/charts/geoserver/templates/statefulset.yaml b/charts/geoserver/templates/statefulset.yaml index 2448a09..1370bd1 100644 --- a/charts/geoserver/templates/statefulset.yaml +++ b/charts/geoserver/templates/statefulset.yaml @@ -25,10 +25,11 @@ spec: initContainers: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.geofence.enableInitScript }} - {{- if not .Values.initContainers }} + {{- if and (not .Values.initContainers) (or (.Values.geofence.enableInitScript) (.Values.monitoring.enableInitScript)) }} + # only add this if we do not have initContainers, but at least one extension init script initContainers: {{- end }} + {{- if .Values.geofence.enableInitScript }} - name: init-geofence image: docker.terrestris.de/alpine command: [ "/bin/sh","/mnt/init-geofence.sh" ] @@ -36,12 +37,22 @@ spec: - name: init-geofence-volume mountPath: /mnt/ - name: datadir - mountPath: /opt/geoserver_data + mountPath: {{ .Values.storage.dataDir }} env: {{- with .Values.geofence.env }} {{- tpl . $ | nindent 12 }} {{- end }} {{- end }} + {{- if .Values.monitoring.enableInitScript }} + - name: init-monitoring + image: docker.terrestris.de/alpine + command: [ "/bin/sh","/mnt/init-monitoring.sh" ] + volumeMounts: + - name: init-monitoring-volume + mountPath: /mnt/ + - name: datadir + mountPath: {{ .Values.storage.dataDir }} + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -131,3 +142,15 @@ spec: - key: init-geofence.sh path: init-geofence.sh {{- end }} + {{- if .Values.monitoring.enableInitScript }} + - name: init-monitoring-volume + configMap: + name: geoserver-init-configmap + items: + - key: init-monitoring.sh + path: init-monitoring.sh + - key: filter.properties + path: filter.properties + - key: monitor.properties + path: monitor.properties + {{- end }} diff --git a/charts/geoserver/values.yaml b/charts/geoserver/values.yaml index b91a646..9c33ca1 100644 --- a/charts/geoserver/values.yaml +++ b/charts/geoserver/values.yaml @@ -137,6 +137,21 @@ geofence: name: shogun-postgis-shogun-credentials key: shogun-password +monitoring: + enableInitScript: false + filterProperties: |- + /rest/monitor/** + /web + /web/** + /pdf/** + monitorProperties: |- + storage=memory + mode=history + sync=async + maxBodySize=1024 + bboxLogCrs=EPSG:4326 + bboxLogLevel=no_wfs + # extraEnv: | # - name: QUERY_LAYER_MAX_FEATURES # value: 100000