Skip to content

Commit 6bebd12

Browse files
Merge branch 'master' into admission-test
2 parents 51ac757 + dbf24c1 commit 6bebd12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4075
-2136
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Kubebuilder DevContainer",
3-
"image": "docker.io/golang:1.23",
3+
"image": "docker.io/golang:1.24",
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
66
"ghcr.io/devcontainers/features/git:1": {}

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM docker.io/golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

6+
#COPY --from=repos ./smooth-operator /smooth-operator
7+
#COPY --from=repos ./ogc-specifications /ogc-specifications
8+
69
WORKDIR /workspace
710
# Copy the Go Modules manifests
811
COPY go.mod go.mod

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +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 config/crd/update_openapi.go config/crd/bases
4748
## allowDangerousTypes=true for v2beta structs
4849

4950
.PHONY: generate

api/v2beta1/wms_conversion.go

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ package v2beta1
2626

2727
import (
2828
"errors"
29+
smoothoperatorutils "github.com/pdok/smooth-operator/pkg/util"
2930
"log"
30-
"strconv"
31-
32-
sharedModel "github.com/pdok/smooth-operator/model"
33-
3431
"sigs.k8s.io/controller-runtime/pkg/conversion"
32+
"strconv"
33+
"strings"
3534

3635
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
36+
sharedModel "github.com/pdok/smooth-operator/model"
3737
)
3838

39-
const SERVICE_METADATA_IDENTIFIER_ANNOTATION = "pdok.nl/wms-service-metadata-uuid"
39+
const ServiceMetatdataIdentifierAnnotation = "pdok.nl/wms-service-metadata-uuid"
4040

4141
// ConvertTo converts this WMS (v2beta1) to the Hub version (v3).
4242
func (src *WMS) ConvertTo(dstRaw conversion.Hub) error {
@@ -56,7 +56,7 @@ func V3WMSHubFromV2(src *WMS, target *pdoknlv3.WMS) {
5656
dst.Annotations = make(map[string]string)
5757
}
5858

59-
dst.Annotations[SERVICE_METADATA_IDENTIFIER_ANNOTATION] = src.Spec.Service.MetadataIdentifier
59+
dst.Annotations[ServiceMetatdataIdentifierAnnotation] = src.Spec.Service.MetadataIdentifier
6060

6161
// Set LifeCycle if defined
6262
if src.Spec.Kubernetes.Lifecycle != nil && src.Spec.Kubernetes.Lifecycle.TTLInDays != nil {
@@ -180,7 +180,7 @@ func (dst *WMS) ConvertFrom(srcRaw conversion.Hub) error {
180180
// TODO unable to fill in MetadataIdentifier here until we know how to handle non inspire services
181181
}
182182

183-
uuid, ok := src.Annotations[SERVICE_METADATA_IDENTIFIER_ANNOTATION]
183+
uuid, ok := src.Annotations[ServiceMetatdataIdentifierAnnotation]
184184
if service.MetadataIdentifier == "00000000-0000-0000-0000-000000000000" && ok {
185185
service.MetadataIdentifier = uuid
186186
}
@@ -300,11 +300,28 @@ func (v2Service WMSService) MapLayersToV3() pdoknlv3.Layer {
300300
// it needs to be created with defaults from the service
301301
// and in this case the middleLayers are all layers without a group
302302
if topLayer == nil {
303+
boundingBoxes := make([]pdoknlv3.WMSBoundingBox, 0)
304+
if v2Service.Extent != nil {
305+
bboxStringList := strings.Split(*v2Service.Extent, " ")
306+
bbox := pdoknlv3.WMSBoundingBox{
307+
CRS: v2Service.DataEPSG,
308+
BBox: sharedModel.BBox{
309+
MinX: bboxStringList[0],
310+
MaxX: bboxStringList[2],
311+
MinY: bboxStringList[1],
312+
MaxY: bboxStringList[3],
313+
},
314+
}
315+
boundingBoxes = append(boundingBoxes, bbox)
316+
}
317+
303318
topLayer = &pdoknlv3.Layer{
304-
Title: &v2Service.Title,
305-
Abstract: &v2Service.Abstract,
306-
Keywords: v2Service.Keywords,
307-
Layers: &[]pdoknlv3.Layer{},
319+
Title: &v2Service.Title,
320+
Abstract: &v2Service.Abstract,
321+
Keywords: v2Service.Keywords,
322+
Layers: &[]pdoknlv3.Layer{},
323+
BoundingBoxes: boundingBoxes,
324+
Visible: smoothoperatorutils.Pointer(true),
308325
}
309326

310327
if v2Service.DataEPSG != "EPSG:28992" && v2Service.Extent != nil {
@@ -416,7 +433,7 @@ func (v2Layer WMSLayer) MapToV3(v2Service WMSService) pdoknlv3.Layer {
416433
func mapV3LayerToV2Layers(v3Layer pdoknlv3.Layer, parent *pdoknlv3.Layer, serviceEPSG string) []WMSLayer {
417434
var layers []WMSLayer
418435

419-
if parent == nil && *v3Layer.Name == "wms" {
436+
if parent == nil && v3Layer.Name == nil {
420437
// Default top layer, do not include in v2 layers
421438
if v3Layer.Layers != nil {
422439
for _, childLayer := range *v3Layer.Layers {
@@ -433,7 +450,7 @@ func mapV3LayerToV2Layers(v3Layer pdoknlv3.Layer, parent *pdoknlv3.Layer, servic
433450
Styles: []Style{},
434451
}
435452

436-
v2Layer.Visible = PointerVal(v3Layer.Visible, true)
453+
v2Layer.Visible = *v3Layer.Visible
437454

438455
if parent != nil {
439456
v2Layer.Group = parent.Name

api/v2beta1/wms_conversion_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
func TestV2ToV3(t *testing.T) {
11+
//nolint:misspell
1112
input := "apiVersion: pdok.nl/v2beta1\nkind: WMS\nmetadata:\n name: rws-nwbwegen-v1-0\n labels:\n dataset-owner: rws\n dataset: nwbwegen\n service-version: v1_0\n service-type: wms\n annotations:\n lifecycle-phase: prod\n service-bundle-id: b39c152b-393b-52f5-a50c-e1ffe904b6fb\nspec:\n general:\n datasetOwner: rws\n dataset: nwbwegen\n serviceVersion: v1_0\n kubernetes:\n healthCheck:\n boundingbox: 135134.89,457152.55,135416.03,457187.82\n resources:\n limits:\n ephemeralStorage: 1535Mi\n memory: 4G\n requests:\n cpu: 2000m\n ephemeralStorage: 1535Mi\n memory: 4G\n options:\n automaticCasing: true\n disableWebserviceProxy: false\n includeIngress: true\n validateRequests: true\n service:\n title: NWB - Wegen WMS\n abstract:\n Dit is de web map service van het Nationaal Wegen Bestand (NWB) - wegen.\n Deze dataset bevat alleen de wegvakken en hectometerpunten. Het Nationaal Wegen\n Bestand - Wegen is een digitaal geografisch bestand van alle wegen in Nederland.\n Opgenomen zijn alle wegen die worden beheerd door wegbeheerders als het Rijk,\n provincies, gemeenten en waterschappen, echter alleen voor zover deze zijn voorzien\n van een straatnaam of nummer.\n authority:\n name: rws\n url: https://www.rijkswaterstaat.nl\n dataEPSG: EPSG:28992\n extent: -59188.44333693248 304984.64144318487 308126.88473339565 858328.516489961\n inspire: true\n keywords:\n - Vervoersnetwerken\n - Menselijke gezondheid en veiligheid\n - Geluidsbelasting hoofdwegen (Richtlijn Omgevingslawaai)\n - Nationaal\n - Voertuigen\n - Verkeer\n - Wegvakken\n - Hectometerpunten\n - HVD\n - Mobiliteit\n stylingAssets:\n configMapRefs:\n - name: includes\n keys:\n - nwb_wegen_hectopunten.symbol\n - hectopunten.style\n - wegvakken.style\n blobKeys:\n - resources/fonts/liberation-sans.ttf\n layers:\n - abstract:\n Deze laag bevat de wegvakken uit het Nationaal Wegen bestand (NWB)\n en geeft gedetailleerde informatie per wegvak zoals straatnaam, wegnummer,\n routenummer, wegbeheerder, huisnummers, enz. weer.\n data:\n gpkg:\n columns:\n - objectid\n - wvk_id\n - wvk_begdat\n - jte_id_beg\n - jte_id_end\n - wegbehsrt\n - wegnummer\n - wegdeelltr\n - hecto_lttr\n - bst_code\n - rpe_code\n - admrichtng\n - rijrichtng\n - stt_naam\n - stt_bron\n - wpsnaam\n - gme_id\n - gme_naam\n - hnrstrlnks\n - hnrstrrhts\n - e_hnr_lnks\n - e_hnr_rhts\n - l_hnr_lnks\n - l_hnr_rhts\n - begafstand\n - endafstand\n - beginkm\n - eindkm\n - pos_tv_wol\n - wegbehcode\n - wegbehnaam\n - distrcode\n - distrnaam\n - dienstcode\n - dienstnaam\n - wegtype\n - wgtype_oms\n - routeltr\n - routenr\n - routeltr2\n - routenr2\n - routeltr3\n - routenr3\n - routeltr4\n - routenr4\n - wegnr_aw\n - wegnr_hmp\n - geobron_id\n - geobron_nm\n - bronjaar\n - openlr\n - bag_orl\n - frc\n - fow\n - alt_naam\n - alt_nr\n - rel_hoogte\n - st_lengthshape\n geometryType: MultiLineString\n blobKey: geopackages/rws/nwbwegen/410a6d1e-e767-41b4-ba8d-9e1e955dd013/1/nwb_wegen.gpkg\n table: wegvakken\n datasetMetadataIdentifier: a9b7026e-0a81-4813-93bd-ba49e6f28502\n keywords:\n - Vervoersnetwerken\n - Menselijke gezondheid en veiligheid\n - Geluidsbelasting hoofdwegen (Richtlijn Omgevingslawaai)\n - Nationaal\n - Voertuigen\n - Verkeer\n - Wegvakken\n maxScale: 50000.0\n minScale: 1.0\n name: wegvakken\n sourceMetadataIdentifier: 8f0497f0-dbd7-4bee-b85a-5fdec484a7ff\n styles:\n - name: wegvakken\n title: NWB - Wegvakken\n visualization: wegvakken.style\n title: Wegvakken\n visible: true\n - abstract:\n Deze laag bevat de hectopunten uit het Nationaal Wegen Bestand (NWB)\n en geeft gedetailleerde informatie per hectopunt zoals hectometrering, afstand,\n zijde en hectoletter weer.\n data:\n gpkg:\n columns:\n - objectid\n - hectomtrng\n - afstand\n - wvk_id\n - wvk_begdat\n - zijde\n - hecto_lttr\n geometryType: MultiPoint\n blobKey: geopackages/rws/nwbwegen/410a6d1e-e767-41b4-ba8d-9e1e955dd013/1/nwb_wegen.gpkg\n table: hectopunten\n datasetMetadataIdentifier: a9b7026e-0a81-4813-93bd-ba49e6f28502\n keywords:\n - Vervoersnetwerken\n - Menselijke gezondheid en veiligheid\n - Geluidsbelasting hoofdwegen (Richtlijn Omgevingslawaai)\n - Nationaal\n - Voertuigen\n - Verkeer\n - Hectometerpunten\n maxScale: 50000.0\n minScale: 1.0\n name: hectopunten\n sourceMetadataIdentifier: 8f0497f0-dbd7-4bee-b85a-5fdec484a7ff\n styles:\n - name: hectopunten\n title: NWB - Hectopunten\n visualization: hectopunten.style\n title: Hectopunten\n visible: true\n metadataIdentifier: f2437a92-ddd3-4777-a1bc-fdf4b4a7fcb8\n"
1213
var v2wms WMS
1314
err := yaml.Unmarshal([]byte(input), &v2wms)

api/v2beta1/wms_types.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,23 @@ type WMSSpec struct {
5454

5555
// WMSService is the struct for all service level fields
5656
type WMSService struct {
57-
Inspire bool `json:"inspire"`
58-
Title string `json:"title"`
59-
Abstract string `json:"abstract"`
60-
AccessConstraints string `json:"accessConstraints"`
61-
Keywords []string `json:"keywords"`
62-
MetadataIdentifier string `json:"metadataIdentifier"`
63-
Authority Authority `json:"authority"`
64-
Layers []WMSLayer `json:"layers"`
65-
DataEPSG string `json:"dataEPSG"`
66-
Extent *string `json:"extent,omitempty"`
67-
Maxsize *float64 `json:"maxSize,omitempty"`
68-
Resolution *int `json:"resolution,omitempty"`
69-
DefResolution *int `json:"defResolution,omitempty"`
70-
StylingAssets *StylingAssets `json:"stylingAssets,omitempty"`
71-
Mapfile *Mapfile `json:"mapfile,omitempty"`
57+
Inspire bool `json:"inspire"`
58+
Title string `json:"title"`
59+
Abstract string `json:"abstract"`
60+
// +kubebuilder:default="https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
61+
AccessConstraints string `json:"accessConstraints"`
62+
Keywords []string `json:"keywords"`
63+
MetadataIdentifier string `json:"metadataIdentifier"`
64+
Authority Authority `json:"authority"`
65+
Layers []WMSLayer `json:"layers"`
66+
//nolint:tagliatelle
67+
DataEPSG string `json:"dataEPSG"`
68+
Extent *string `json:"extent,omitempty"`
69+
Maxsize *float64 `json:"maxSize,omitempty"`
70+
Resolution *int `json:"resolution,omitempty"`
71+
DefResolution *int `json:"defResolution,omitempty"`
72+
StylingAssets *StylingAssets `json:"stylingAssets,omitempty"`
73+
Mapfile *Mapfile `json:"mapfile,omitempty"`
7274
}
7375

7476
// WMSLayer is the struct for all layer level fields
@@ -85,7 +87,7 @@ type WMSLayer struct {
8587
Extent *string `json:"extent,omitempty"`
8688
MinScale *float64 `json:"minScale,omitempty"`
8789
MaxScale *float64 `json:"maxScale,omitempty"`
88-
LabelNoClip bool `json:"labelNoClip"`
90+
LabelNoClip bool `json:"labelNoClip,omitempty"`
8991
Data *Data `json:"data,omitempty"`
9092
}
9193

0 commit comments

Comments
 (0)