From 6992b2d9a9ea5f569cc7c8b39a31a9920bad2041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20van=20der=20Kaap?= Date: Wed, 18 Feb 2026 11:57:49 +0100 Subject: [PATCH 1/3] Started on SLD-support --- internal/controller/legendgenerator/legend_generator.go | 2 ++ internal/controller/mapserver/deployment.go | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/controller/legendgenerator/legend_generator.go b/internal/controller/legendgenerator/legend_generator.go index 22935d8..3cf32ef 100644 --- a/internal/controller/legendgenerator/legend_generator.go +++ b/internal/controller/legendgenerator/legend_generator.go @@ -52,6 +52,8 @@ exit $exit_code; // Adding config volumemount here to get the same order as in the old ansible operator initContainer.VolumeMounts = append(initContainer.VolumeMounts, utils.GetConfigVolumeMount(constants.ConfigMapLegendGeneratorVolumeName)) + // For mounting the possible stylingfiles that are included + initContainer.VolumeMounts = append(initContainer.VolumeMounts, corev1.VolumeMount{Name: constants.ConfigMapStylingFilesVolumeName, MountPath: "/srv/data/config/styles"}) return &initContainer, nil } diff --git a/internal/controller/mapserver/deployment.go b/internal/controller/mapserver/deployment.go index b8f4d30..3dc956f 100644 --- a/internal/controller/mapserver/deployment.go +++ b/internal/controller/mapserver/deployment.go @@ -39,7 +39,7 @@ func GetMapserverContainer[O pdoknlv3.WMSWFS](obj O, images types.Images) (*core }, GetMapfileEnvVar(obj), }, - VolumeMounts: getVolumeMounts(obj.Mapfile() != nil), + VolumeMounts: getVolumeMounts(obj.Mapfile() != nil, obj.Type() == pdoknlv3.ServiceTypeWMS), Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceMemory: resource.MustParse("800M"), @@ -61,7 +61,7 @@ func GetMapserverContainer[O pdoknlv3.WMSWFS](obj O, images types.Images) (*core return &container, nil } -func getVolumeMounts(customMapfile bool) []corev1.VolumeMount { +func getVolumeMounts(customMapfile bool, wms bool) []corev1.VolumeMount { volumeMounts := []corev1.VolumeMount{ utils.GetBaseVolumeMount(), utils.GetDataVolumeMount(), @@ -79,6 +79,11 @@ func getVolumeMounts(customMapfile bool) []corev1.VolumeMount { volumeMounts = append(volumeMounts, utils.GetMapfileVolumeMount()) } + // maps all the found style files for generic SLD inclusion + if wms { + volumeMounts = append(volumeMounts, corev1.VolumeMount{Name: constants.ConfigMapStylingFilesVolumeName, MountPath: "/srv/data/config/styles"}) + } + return volumeMounts } From 6a7c174151c1ca75a515f2b029a3551f499141be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20van=20der=20Kaap?= Date: Wed, 18 Feb 2026 12:07:09 +0100 Subject: [PATCH 2/3] Lintered --- internal/controller/mapserver/deployment_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/controller/mapserver/deployment_test.go b/internal/controller/mapserver/deployment_test.go index 7467e8f..98e45d5 100644 --- a/internal/controller/mapserver/deployment_test.go +++ b/internal/controller/mapserver/deployment_test.go @@ -17,7 +17,7 @@ var expectedVolumeMountsYaml []byte func TestGetVolumeMounts(t *testing.T) { pdoknlv3.SetHost("https://service.pdok.nl") - result := getVolumeMounts(false) + result := getVolumeMounts(false, false) var expectedVolumeMounts struct{ VolumeMounts []corev1.VolumeMount } err := yaml.Unmarshal(expectedVolumeMountsYaml, &expectedVolumeMounts) From fdcc1a0b89d37da3dab6c082289458064794222a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20van=20der=20Kaap?= Date: Wed, 18 Feb 2026 14:28:10 +0100 Subject: [PATCH 3/3] Fixed tests --- .../test_data/wms/complete/expected/deployment.yaml | 4 ++++ .../test_data/wms/custom-mapfile/expected/deployment.yaml | 4 ++++ .../controller/test_data/wms/minimal/expected/deployment.yaml | 4 ++++ .../test_data/wms/noprefetch/expected/deployment.yaml | 4 ++++ .../controller/test_data/wms/patches/expected/deployment.yaml | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/internal/controller/test_data/wms/complete/expected/deployment.yaml b/internal/controller/test_data/wms/complete/expected/deployment.yaml index f2cbbdc..bbdb514 100644 --- a/internal/controller/test_data/wms/complete/expected/deployment.yaml +++ b/internal/controller/test_data/wms/complete/expected/deployment.yaml @@ -144,6 +144,8 @@ spec: - mountPath: /srv/mapserver/config/scraping-error.xml name: mapserver subPath: scraping-error.xml + - mountPath: /srv/data/config/styles + name: styling-files - args: - --scrape_uri=http://localhost/server-status?auto image: test.test/image:test7 @@ -336,6 +338,8 @@ spec: - mountPath: /input name: legend-generator-config readOnly: true + - mountPath: /srv/data/config/styles + name: styling-files - command: - /bin/bash - /input/legend-fixer.sh diff --git a/internal/controller/test_data/wms/custom-mapfile/expected/deployment.yaml b/internal/controller/test_data/wms/custom-mapfile/expected/deployment.yaml index 70a103e..80ffd97 100644 --- a/internal/controller/test_data/wms/custom-mapfile/expected/deployment.yaml +++ b/internal/controller/test_data/wms/custom-mapfile/expected/deployment.yaml @@ -149,6 +149,8 @@ spec: subPath: scraping-error.xml - name: mapfile mountPath: /srv/data/config/mapfile + - mountPath: /srv/data/config/styles + name: styling-files - args: - --scrape_uri=http://localhost/server-status?auto image: test.test/image:test7 @@ -305,6 +307,8 @@ spec: - mountPath: /input name: legend-generator-config readOnly: true + - mountPath: /srv/data/config/styles + name: styling-files terminationGracePeriodSeconds: 60 volumes: - emptyDir: {} diff --git a/internal/controller/test_data/wms/minimal/expected/deployment.yaml b/internal/controller/test_data/wms/minimal/expected/deployment.yaml index 37bfbd2..23517e0 100644 --- a/internal/controller/test_data/wms/minimal/expected/deployment.yaml +++ b/internal/controller/test_data/wms/minimal/expected/deployment.yaml @@ -147,6 +147,8 @@ spec: - mountPath: /srv/mapserver/config/scraping-error.xml name: mapserver subPath: scraping-error.xml + - mountPath: /srv/data/config/styles + name: styling-files - args: - --scrape_uri=http://localhost/server-status?auto image: test.test/image:test7 @@ -323,6 +325,8 @@ spec: - mountPath: /input name: legend-generator-config readOnly: true + - mountPath: /srv/data/config/styles + name: styling-files terminationGracePeriodSeconds: 60 volumes: - emptyDir: {} diff --git a/internal/controller/test_data/wms/noprefetch/expected/deployment.yaml b/internal/controller/test_data/wms/noprefetch/expected/deployment.yaml index b3f1718..e907ae9 100644 --- a/internal/controller/test_data/wms/noprefetch/expected/deployment.yaml +++ b/internal/controller/test_data/wms/noprefetch/expected/deployment.yaml @@ -147,6 +147,8 @@ spec: - mountPath: /srv/mapserver/config/scraping-error.xml name: mapserver subPath: scraping-error.xml + - mountPath: /srv/data/config/styles + name: styling-files - args: - --scrape_uri=http://localhost/server-status?auto image: test.test/image:test7 @@ -319,6 +321,8 @@ spec: - mountPath: /input name: legend-generator-config readOnly: true + - mountPath: /srv/data/config/styles + name: styling-files terminationGracePeriodSeconds: 60 volumes: - emptyDir: {} diff --git a/internal/controller/test_data/wms/patches/expected/deployment.yaml b/internal/controller/test_data/wms/patches/expected/deployment.yaml index 2ecdf4e..d7afdd2 100644 --- a/internal/controller/test_data/wms/patches/expected/deployment.yaml +++ b/internal/controller/test_data/wms/patches/expected/deployment.yaml @@ -159,6 +159,8 @@ spec: - mountPath: /srv/mapserver/config/scraping-error.xml name: mapserver subPath: scraping-error.xml + - mountPath: /srv/data/config/styles + name: styling-files - args: - "patch" image: patch.patch/image:patch @@ -328,6 +330,8 @@ spec: - mountPath: /input name: legend-generator-config readOnly: true + - mountPath: /srv/data/config/styles + name: styling-files terminationGracePeriodSeconds: 600 volumes: - emptyDir: {}