Skip to content

Commit 476ab23

Browse files
author
Jelle Dijkstra
committed
Working blobdownload + mapfilegenerator
1 parent a1c4772 commit 476ab23

File tree

11 files changed

+32
-34
lines changed

11 files changed

+32
-34
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ help: ## Display this help.
4444
.PHONY: manifests
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
4646
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
47-
go run cmd/update_openapi.go config/crd/bases
47+
go run config/crd/update_openapi.go config/crd/bases
4848
## allowDangerousTypes=true for v2beta structs
4949

5050
.PHONY: generate

api/v3/wms_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type Layer struct {
9494
Title *string `json:"title,omitempty"`
9595
Abstract *string `json:"abstract,omitempty"`
9696
Keywords []string `json:"keywords"`
97-
BoundingBoxes []WMSBoundingBox `json:"boundingBoxes"`
97+
BoundingBoxes []WMSBoundingBox `json:"boundingBoxes,omitempty"`
9898
// +kubebuilder:default:=true
9999
Visible *bool `json:"visible,omitempty"`
100100
Authority *Authority `json:"authority,omitempty"`

api/v3/wms_validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func validateWMS(wms *WMS, warnings *[]string, reasons *[]string) {
110110
}
111111

112112
if slices.Contains(names, layerName) {
113-
layerReasons = append(layerReasons, fmt.Sprintf("layer names must be unique, layer.name '%s' is duplicated", layer.Name))
113+
layerReasons = append(layerReasons, fmt.Sprintf("layer names must be unique, layer.name '%s' is duplicated", layerName))
114114
}
115115
names = append(names, layerName)
116116

@@ -204,7 +204,7 @@ func validateWMS(wms *WMS, warnings *[]string, reasons *[]string) {
204204
}
205205
}
206206
if len(layerReasons) != 0 {
207-
*reasons = append(*reasons, fmt.Sprintf("%s '%s' is invalid: ", layerType, layer.Name)+strings.Join(layerReasons, ", "))
207+
*reasons = append(*reasons, fmt.Sprintf("%s '%s' is invalid: ", layerType, layerName)+strings.Join(layerReasons, ", "))
208208
}
209209
}
210210

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,6 @@ spec:
17191719
default: true
17201720
type: boolean
17211721
required:
1722-
- boundingBoxes
17231722
- keywords
17241723
- name
17251724
type: object
@@ -1769,7 +1768,6 @@ spec:
17691768
default: true
17701769
type: boolean
17711770
required:
1772-
- boundingBoxes
17731771
- keywords
17741772
- name
17751773
type: object
@@ -1819,7 +1817,6 @@ spec:
18191817
default: true
18201818
type: boolean
18211819
required:
1822-
- boundingBoxes
18231820
- keywords
18241821
type: object
18251822
mapfile:

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: local-registry:5000/mapserver-operator
8-
newTag: v3.0.24
8+
newTag: v3.0.26

internal/controller/blobdownload/blob_download.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ func downloadLegends(sb *strings.Builder, wms *pdoknlv3.WMS) error {
197197
layers := wms.GetAllLayersWithLegend()
198198
if len(layers) > 0 {
199199
for _, layer := range layers {
200-
writeLine(sb, "mkdir -p %s/%s;", legendPath, layer.Name)
200+
writeLine(sb, "mkdir -p %s/%s;", legendPath, *layer.Name)
201201
for _, style := range layer.Styles {
202-
writeLine(sb, "rclone copyto blobs:/%s %s/%s/%s.png || exit 1;", style.Legend.BlobKey, legendPath, layer.Name, style.Name)
202+
writeLine(sb, "rclone copyto blobs:/%s %s/%s/%s.png || exit 1;", style.Legend.BlobKey, legendPath, *layer.Name, style.Name)
203203
fileName, err := getFilenameFromBlobKey(style.Legend.BlobKey)
204204
if err != nil {
205205
return err
206206
}
207-
writeLine(sb, "Copied legend %s to %s/%s/%s.png;", fileName, legendPath, layer.Name, style.Name)
207+
writeLine(sb, "Copied legend %s to %s/%s/%s.png;", fileName, legendPath, *layer.Name, style.Name)
208208
}
209209
}
210210
writeLine(sb, "chown -R 999:999 %s", legendPath)

internal/controller/mapserver/deployment.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,26 @@ func GetVolumesForDeployment[O pdoknlv3.WMSWFS](obj O, configMapNames types.Hash
103103
Name: ConfigMapFeatureinfoGeneratorVolumeName,
104104
VolumeSource: newVolumeSource(configMapNames.FeatureInfoGenerator),
105105
}
106+
107+
wms, _ := any(obj).(*pdoknlv3.WMS)
108+
stylingFilesVolumeProjections := []v1.VolumeProjection{}
109+
if wms.Spec.Service.StylingAssets != nil && wms.Spec.Service.StylingAssets.ConfigMapRefs != nil {
110+
for _, cf := range wms.Spec.Service.StylingAssets.ConfigMapRefs {
111+
stylingFilesVolumeProjections = append(stylingFilesVolumeProjections, v1.VolumeProjection{
112+
ConfigMap: &v1.ConfigMapProjection{
113+
LocalObjectReference: v1.LocalObjectReference{
114+
Name: cf.Name,
115+
},
116+
},
117+
})
118+
}
119+
}
120+
106121
stylingFilesVolume := v1.Volume{
107122
Name: ConfigMapStylingFilesVolumeName,
108123
VolumeSource: v1.VolumeSource{
109124
Projected: &v1.ProjectedVolumeSource{
110-
Sources: []v1.VolumeProjection{
111-
{
112-
ConfigMap: &v1.ConfigMapProjection{
113-
LocalObjectReference: v1.LocalObjectReference{
114-
Name: "gpkg-styling",
115-
},
116-
},
117-
},
118-
{
119-
ConfigMap: &v1.ConfigMapProjection{
120-
LocalObjectReference: v1.LocalObjectReference{
121-
Name: "tif-styling",
122-
},
123-
},
124-
},
125-
},
125+
Sources: stylingFilesVolumeProjections,
126126
},
127127
},
128128
}

internal/controller/shared_controller_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,16 @@ func getExpectedObjects[O pdoknlv3.WMSWFS](ctx context.Context, obj O, includeBl
8585
}
8686

8787
if obj.Type() == pdoknlv3.ServiceTypeWMS {
88-
cm = getBareConfigMapLegendGenerator(obj)
88+
wms, _ := any(obj).(*pdoknlv3.WMS)
89+
cm = getBareConfigMapLegendGenerator(wms)
8990
hashedName, err = getHashedConfigMapNameFromClient(ctx, obj, mapserver.ConfigMapLegendGeneratorVolumeName)
9091
if err != nil {
9192
return objects, err
9293
}
9394
cm.Name = hashedName
9495
objects = append(objects, cm)
9596

96-
cm = getBareConfigMapFeatureinfoGenerator(obj)
97+
cm = getBareConfigMapFeatureinfoGenerator(wms)
9798
hashedName, err = getHashedConfigMapNameFromClient(ctx, obj, mapserver.ConfigMapFeatureinfoGeneratorVolumeName)
9899
if err != nil {
99100
return objects, err
@@ -102,7 +103,7 @@ func getExpectedObjects[O pdoknlv3.WMSWFS](ctx context.Context, obj O, includeBl
102103
objects = append(objects, cm)
103104

104105
if obj.Options().UseWebserviceProxy() {
105-
cm = getBareConfigMapOgcWebserviceProxy(obj)
106+
cm = getBareConfigMapOgcWebserviceProxy(wms)
106107
hashedName, err = getHashedConfigMapNameFromClient(ctx, obj, mapserver.ConfigMapOgcWebserviceProxyVolumeName)
107108
if err != nil {
108109
return objects, err

internal/controller/wms_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ var _ = Describe("WMS Controller", func() {
641641
return Expect(err).NotTo(HaveOccurred())
642642
}, "10s", "1s").Should(BeTrue())
643643

644-
Expect(configMap.GetName()).To(HavePrefix(wms.GetName() + "-legend-generator-"))
644+
Expect(configMap.GetName()).To(HavePrefix(wms.GetName() + "-wms-legend-generator-"))
645645
Expect(configMap.GetNamespace()).To(Equal(namespace))
646646
Expect(configMap.Immutable).To(Equal(smoothoperatorutils.Pointer(true)))
647647
checkWMSLabels(configMap.GetLabels())
@@ -681,7 +681,7 @@ var _ = Describe("WMS Controller", func() {
681681
return Expect(err).NotTo(HaveOccurred())
682682
}, "10s", "1s").Should(BeTrue())
683683

684-
Expect(configMap.GetName()).To(HavePrefix(wms.GetName() + "-featureinfo-generator"))
684+
Expect(configMap.GetName()).To(HavePrefix(wms.GetName() + "-wms-featureinfo-generator"))
685685
Expect(configMap.GetNamespace()).To(Equal(namespace))
686686
Expect(configMap.Immutable).To(Equal(smoothoperatorutils.Pointer(true)))
687687
checkWMSLabels(configMap.GetLabels())

0 commit comments

Comments
 (0)