Skip to content

Commit 31e5ae9

Browse files
committed
Merge branch 'master' into PDOK-17796-WMS-reconcile
# Conflicts: # cmd/main.go # config/rbac/role.yaml # internal/controller/wfs_controller.go
2 parents 3ebc401 + 144b56a commit 31e5ae9

32 files changed

+1172
-148
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
## Description
55
// TODO(user): An in-depth paragraph about your project and overview of use
66

7+
## Local testing
8+
9+
- Start an empty cluster using `k8s-clusters/local-test/empty-cluster.sh`
10+
- Build and push the controller to the cluster using `build-and-push-locally.sh <controller-version>`
11+
- Deploy a service to the cluster, for example (running from `k8s-clusters/local-test`): `OWNER=kadaster TECHNICAL_NAME=ad docker-compose -f ./docker-compose.yaml -f ./bundle-pollers/docker-compose.services.yaml up kustomize-init`
12+
713
## Getting Started
814

915
### Prerequisites

api/v2beta1/shared_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func ConvertResources(src corev1.ResourceRequirements) *corev1.PodSpec {
8282
return &corev1.PodSpec{
8383
Containers: []corev1.Container{
8484
{
85+
Name: "mapserver",
8586
Resources: src,
8687
},
8788
},

api/v2beta1/wfs_conversion.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ func (src *WFS) ConvertTo(dstRaw conversion.Hub) error {
5858
dst.Spec.PodSpecPatch = ConvertResources(*src.Spec.Kubernetes.Resources)
5959
}
6060

61-
dst.Spec.Options = ConvertOptionsV2ToV3(src.Spec.Options)
61+
dst.Spec.Options = *ConvertOptionsV2ToV3(src.Spec.Options)
6262

6363
service := pdoknlv3.WFSService{
64-
Prefix: "",
64+
// TODO what is prefix, Geonovum subdomain?
65+
Prefix: "prefix",
6566
URL: CreateBaseURL("https://service.pdok.nl", "wfs", src.Spec.General),
6667
OwnerInfoRef: "pdok",
6768
Title: src.Spec.Service.Title,
@@ -105,7 +106,7 @@ func (src *WFS) ConvertTo(dstRaw conversion.Hub) error {
105106
},
106107
},
107108
SpatialDatasetIdentifier: src.Spec.Service.FeatureTypes[0].SourceMetadataIdentifier,
108-
Language: "nl",
109+
Language: "dut",
109110
}
110111
}
111112

@@ -157,9 +158,7 @@ func (dst *WFS) ConvertFrom(srcRaw conversion.Hub) error {
157158

158159
dst.Spec.Kubernetes = NewV2KubernetesObject(src.Spec.Lifecycle, src.Spec.PodSpecPatch, src.Spec.HorizontalPodAutoscalerPatch)
159160

160-
if src.Spec.Options != nil {
161-
dst.Spec.Options = ConvertOptionsV3ToV2(src.Spec.Options)
162-
}
161+
dst.Spec.Options = ConvertOptionsV3ToV2(&src.Spec.Options)
163162

164163
service := WFSService{
165164
Title: src.Spec.Service.Title,

api/v2beta1/wfs_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ type WFSSpec struct {
5757
General General `json:"general"`
5858
Service WFSService `json:"service"`
5959
Kubernetes Kubernetes `json:"kubernetes"`
60-
Options WMSWFSOptions `json:"options"`
60+
Options WMSWFSOptions `json:"options,omitempty"`
6161
}
6262

6363
// WFSService is the struct with all service specific options
6464
type WFSService struct {
65-
Title string `json:"title"`
66-
Inspire bool `json:"inspire"`
67-
Abstract string `json:"abstract"`
65+
Title string `json:"title"`
66+
Inspire bool `json:"inspire"`
67+
Abstract string `json:"abstract"`
68+
// +kubebuilder:default="https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
6869
AccessConstraints string `json:"accessConstraints"`
6970
Keywords []string `json:"keywords"`
7071
MetadataIdentifier string `json:"metadataIdentifier"`

api/v2beta1/wms_conversion.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func V3HubFromV2(src *WMS, target *pdoknlv3.WMS) {
7474
dst.Spec.PodSpecPatch = ConvertResources(*src.Spec.Kubernetes.Resources)
7575
}
7676

77-
dst.Spec.Options = ConvertOptionsV2ToV3(src.Spec.Options)
77+
dst.Spec.Options = *ConvertOptionsV2ToV3(src.Spec.Options)
7878

7979
service := pdoknlv3.WMSService{
8080
URL: CreateBaseURL("https://service.pdok.nl", "wms", src.Spec.General),
@@ -118,7 +118,7 @@ func V3HubFromV2(src *WMS, target *pdoknlv3.WMS) {
118118
},
119119
},
120120
SpatialDatasetIdentifier: *src.Spec.Service.Layers[0].SourceMetadataIdentifier,
121-
Language: "nl",
121+
Language: "dut",
122122
}
123123
}
124124

@@ -153,9 +153,7 @@ func (dst *WMS) ConvertFrom(srcRaw conversion.Hub) error {
153153

154154
dst.Spec.Kubernetes = NewV2KubernetesObject(src.Spec.Lifecycle, src.Spec.PodSpecPatch, src.Spec.HorizontalPodAutoscalerPatch)
155155

156-
if src.Spec.Options != nil {
157-
dst.Spec.Options = ConvertOptionsV3ToV2(src.Spec.Options)
158-
}
156+
dst.Spec.Options = ConvertOptionsV3ToV2(&src.Spec.Options)
159157

160158
service := WMSService{
161159
Title: src.Spec.Service.Title,

api/v3/wfs_types.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,28 @@ func init() {
6666

6767
// WFSSpec vertegenwoordigt de hoofdstruct voor de YAML-configuratie
6868
type WFSSpec struct {
69-
Lifecycle *shared_model.Lifecycle `json:"lifecycle"`
69+
Lifecycle *shared_model.Lifecycle `json:"lifecycle,omitempty"`
7070
// +kubebuilder:validation:Type=object
7171
// +kubebuilder:validation:Schemaless
7272
// +kubebuilder:pruning:PreserveUnknownFields
7373
// Optional strategic merge patch for the pod in the deployment. E.g. to patch the resources or add extra env vars.
7474
PodSpecPatch *corev1.PodSpec `json:"podSpecPatch,omitempty"`
75-
HorizontalPodAutoscalerPatch *autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch"`
76-
Options *Options `json:"options"`
75+
HorizontalPodAutoscalerPatch *autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch,omitempty"`
76+
Options Options `json:"options,omitempty"`
7777
Service WFSService `json:"service"`
7878
}
7979

8080
type WFSService struct {
81-
Prefix string `json:"prefix"`
82-
URL string `json:"url"`
83-
Inspire *Inspire `json:"inspire,omitempty"`
84-
Mapfile *Mapfile `json:"mapfile,omitempty"`
85-
OwnerInfoRef string `json:"ownerInfoRef"`
86-
Title string `json:"title"`
87-
Abstract string `json:"abstract"`
88-
Keywords []string `json:"keywords"`
89-
Fees *string `json:"fees,omitempty"`
81+
Prefix string `json:"prefix"`
82+
URL string `json:"url"`
83+
Inspire *Inspire `json:"inspire,omitempty"`
84+
Mapfile *Mapfile `json:"mapfile,omitempty"`
85+
OwnerInfoRef string `json:"ownerInfoRef"`
86+
Title string `json:"title"`
87+
Abstract string `json:"abstract"`
88+
Keywords []string `json:"keywords"`
89+
Fees *string `json:"fees,omitempty"`
90+
// +kubebuilder:default="https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
9091
AccessConstraints string `json:"accessConstraints"`
9192
DefaultCrs string `json:"defaultCrs"`
9293
OtherCrs []string `json:"otherCrs,omitempty"`
@@ -144,7 +145,7 @@ func (wfs *WFS) HorizontalPodAutoscalerPatch() *autoscalingv2.HorizontalPodAutos
144145
}
145146

146147
func (wfs *WFS) Options() *Options {
147-
return wfs.Spec.Options
148+
return &wfs.Spec.Options
148149
}
149150

150151
func (wfs *WFS) ID() string {

api/v3/wms_types.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ type WMSSpec struct {
5454
// Optional strategic merge patch for the pod in the deployment. E.g. to patch the resources or add extra env vars.
5555
PodSpecPatch *corev1.PodSpec `json:"podSpecPatch,omitempty"`
5656
HorizontalPodAutoscalerPatch *autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch"`
57-
Options *Options `json:"options"`
57+
Options Options `json:"options,omitempty"`
5858
Service WMSService `json:"service"`
5959
}
6060

6161
type WMSService struct {
62-
URL string `json:"url"`
63-
Title string `json:"title"`
64-
Abstract string `json:"abstract"`
65-
Keywords []string `json:"keywords"`
66-
OwnerInfoRef string `json:"ownerInfoRef"`
67-
Fees *string `json:"fees,omitempty"`
62+
URL string `json:"url"`
63+
Title string `json:"title"`
64+
Abstract string `json:"abstract"`
65+
Keywords []string `json:"keywords"`
66+
OwnerInfoRef string `json:"ownerInfoRef"`
67+
Fees *string `json:"fees,omitempty"`
68+
// +kubebuilder:default="https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
6869
AccessConstraints string `json:"accessConstraints"`
6970
MaxSize *int32 `json:"maxSize,omitempty"`
7071
Inspire *Inspire `json:"inspire,omitempty"`
@@ -332,7 +333,7 @@ func (wms *WMS) HorizontalPodAutoscalerPatch() *autoscalingv2.HorizontalPodAutos
332333
}
333334

334335
func (wms *WMS) Options() *Options {
335-
return wms.Spec.Options
336+
return &wms.Spec.Options
336337
}
337338

338339
func (wms *WMS) ID() string {

api/v3/zz_generated.deepcopy.go

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"crypto/tls"
2121
"errors"
2222
"flag"
23+
smoothoperator "github.com/pdok/smooth-operator/api/v1"
24+
traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
2325
"os"
2426
"path/filepath"
2527

@@ -61,7 +63,8 @@ var (
6163

6264
func init() {
6365
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
64-
66+
utilruntime.Must(traefikiov1alpha1.AddToScheme(scheme))
67+
utilruntime.Must(smoothoperator.AddToScheme(scheme))
6568
utilruntime.Must(pdoknlv3.AddToScheme(scheme))
6669
utilruntime.Must(pdoknlv2beta1.AddToScheme(scheme))
6770
// +kubebuilder:scaffold:scheme

config/crd/bases/pdok.nl_wfs.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ spec:
179179
abstract:
180180
type: string
181181
accessConstraints:
182+
default: https://creativecommons.org/publicdomain/zero/1.0/deed.nl
182183
type: string
183184
authority:
184185
description: Authority is a struct for the authority fields in
@@ -353,7 +354,6 @@ spec:
353354
required:
354355
- general
355356
- kubernetes
356-
- options
357357
- service
358358
type: object
359359
status:
@@ -1123,6 +1123,7 @@ spec:
11231123
abstract:
11241124
type: string
11251125
accessConstraints:
1126+
default: https://creativecommons.org/publicdomain/zero/1.0/deed.nl
11261127
type: string
11271128
bbox:
11281129
properties:
@@ -1414,9 +1415,6 @@ spec:
14141415
- url
14151416
type: object
14161417
required:
1417-
- horizontalPodAutoscalerPatch
1418-
- lifecycle
1419-
- options
14201418
- service
14211419
type: object
14221420
status:

0 commit comments

Comments
 (0)