Skip to content

Commit fb967b9

Browse files
author
Jelle Dijkstra
committed
Merge branch 'master' of github.com:PDOK/mapserver-operator
2 parents bc0b4c3 + 7407f7d commit fb967b9

File tree

26 files changed

+236
-136
lines changed

26 files changed

+236
-136
lines changed

cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const (
5656
defaultMultitoolImage = "acrpdokprodman.azurecr.io/pdok/docker-multitool:0.9.4"
5757
defaultMapfileGeneratorImage = "acrpdokprodman.azurecr.io/pdok/mapfile-generator:1.9.5"
5858
defaultMapserverImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/mapserver:8.4.0-4-nl"
59-
defaultCapabilitiesGeneratorImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/ogc-capabilities-generator:1.0.0-beta9"
60-
defaultFeatureinfoGeneratorImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/featureinfo-generator:1.4.0-beta1"
59+
defaultCapabilitiesGeneratorImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/ogc-capabilities-generator:1.0.1"
60+
defaultFeatureinfoGeneratorImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/featureinfo-generator:1.4.0"
6161
defaultOgcWebserviceProxyImage = "acrpdokprodman.azurecr.io/pdok/ogc-webservice-proxy:0.1.8"
6262
defaultApacheExporterImage = "acrpdokprodman.azurecr.io/mirror/docker.io/lusotycoon/apache-exporter:v0.7.0"
6363

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ require (
1010
github.com/cbroglie/mustache v1.4.0
1111
github.com/onsi/ginkgo/v2 v2.23.4
1212
github.com/onsi/gomega v1.37.0
13-
github.com/pdok/featureinfo-generator v1.4.0-beta1
14-
github.com/pdok/ogc-capabilities-generator v1.0.0-beta9
15-
github.com/pdok/ogc-specifications v1.0.0-beta10
16-
github.com/pdok/smooth-operator v0.1.3
13+
github.com/pdok/featureinfo-generator v1.4.0
14+
github.com/pdok/ogc-capabilities-generator v1.0.1
15+
github.com/pdok/ogc-specifications v1.0.0
16+
github.com/pdok/smooth-operator v1.0.0
1717
github.com/peterbourgon/ff v1.7.1
1818
github.com/stretchr/testify v1.10.0
1919
github.com/traefik/traefik/v3 v3.4.1

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
146146
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
147147
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
148148
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
149-
github.com/pdok/featureinfo-generator v1.4.0-beta1 h1:ZZO5OtK7yW5ozXFrl1OaxKl0MK3XF5YGFh2692JZVN8=
150-
github.com/pdok/featureinfo-generator v1.4.0-beta1/go.mod h1:02Ryu7ZRkeha8SCfS6VYWCdKYZh0llskrfFgp6xRCjk=
151-
github.com/pdok/ogc-capabilities-generator v1.0.0-beta9 h1:CxAV4jFCsitczuQlX4MNRL5K6ZCFOm9li+gbOnYNLuA=
152-
github.com/pdok/ogc-capabilities-generator v1.0.0-beta9/go.mod h1:4lKxsIm9QSOYOsRuh0f1zJhUPpsEZCuDIs2S8hORtA8=
153-
github.com/pdok/ogc-specifications v1.0.0-beta10 h1:VGZ4k4h8blyuRMNAvKSyxEDKVfQBSpDBAo0YRjNstPY=
154-
github.com/pdok/ogc-specifications v1.0.0-beta10/go.mod h1:YDngwkwrWOfc5MYnEYseiv97K1Y9bZXlVzwi/8EaIl8=
155-
github.com/pdok/smooth-operator v0.1.3 h1:Y+JvbFLlyb6pMNFVgAd8G6QsXL0Y6F0srTaROabRnm0=
156-
github.com/pdok/smooth-operator v0.1.3/go.mod h1:przwM7mBGmNPqabyhImKVZ15WL4zbqLqH4ExbuWKhWE=
149+
github.com/pdok/featureinfo-generator v1.4.0 h1:AqtLxdLj3nnBxjsnPCRKyddOyhq52h40OEjAbNJgIYE=
150+
github.com/pdok/featureinfo-generator v1.4.0/go.mod h1:02Ryu7ZRkeha8SCfS6VYWCdKYZh0llskrfFgp6xRCjk=
151+
github.com/pdok/ogc-capabilities-generator v1.0.1 h1:7cKgdcWO4y+M9a2hW8ONhmBxGERdva/WB4JBaB9+91s=
152+
github.com/pdok/ogc-capabilities-generator v1.0.1/go.mod h1:Fnq2i1X3Aufjx/ptQ34c9knw1mDMUAQt0MTBscqX0/M=
153+
github.com/pdok/ogc-specifications v1.0.0 h1:YqVqKwgOrPprTuRcNrFJeUuxSHOIeOSQStBcYJZUGcA=
154+
github.com/pdok/ogc-specifications v1.0.0/go.mod h1:YDngwkwrWOfc5MYnEYseiv97K1Y9bZXlVzwi/8EaIl8=
155+
github.com/pdok/smooth-operator v1.0.0 h1:Gp5DG2FQ3uujxWQX/647ZcyVk2EhNZPBD+lMxpLHotI=
156+
github.com/pdok/smooth-operator v1.0.0/go.mod h1:przwM7mBGmNPqabyhImKVZ15WL4zbqLqH4ExbuWKhWE=
157157
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
158158
github.com/peterbourgon/ff v1.7.1 h1:xt1lxTG+Nr2+tFtysY7abFgPoH3Lug8CwYJMOmJRXhk=
159159
github.com/peterbourgon/ff v1.7.1/go.mod h1:fYI5YA+3RDqQRExmFbHnBjEeWzh9TrS8rnRpEq7XIg0=

internal/controller/capabilitiesgenerator/capabilities_generator_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ func TestInputForWMS(t *testing.T) {
181181
HrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id={{identifier}}",
182182
},
183183
},
184+
ProviderSite: &smoothoperatorv1.ProviderSite{
185+
Type: "simple",
186+
Href: "https://www.pdok.nl",
187+
},
184188
WMS: &smoothoperatorv1.WMS{
185189
ContactInformation: smoothoperatorv1.ContactInformation{
186190
ContactPersonPrimary: &contactPersonPrimary,

internal/controller/capabilitiesgenerator/mapper.go

Lines changed: 84 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func MapWFSToCapabilitiesGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoper
4747
Filename: wfsCapabilitiesFilename,
4848
Wfs200: wfs200.GetCapabilitiesResponse{
4949

50-
ServiceProvider: mapServiceProvider(&ownerInfo.Spec.WFS.ServiceProvider),
50+
ServiceProvider: mapServiceProvider(&ownerInfo.Spec.WFS.ServiceProvider, ownerInfo.Spec.ProviderSite),
5151
ServiceIdentification: wfs200.ServiceIdentification{
5252
Title: wfs.Spec.Service.Title,
5353
Abstract: wfs.Spec.Service.Abstract,
@@ -103,16 +103,90 @@ func MapWFSToCapabilitiesGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoper
103103
if operationsMetadata == nil {
104104
operationsMetadata = &wfs200.OperationsMetadata{}
105105
}
106-
operationsMetadata.Constraint = append(operationsMetadata.Constraint, wfs200.Constraint{
107-
Name: "CountDefault",
108-
DefaultValue: smoothoperatorutils.Pointer(strconv.Itoa(*wfs.Spec.Service.CountDefault)),
109-
})
106+
operationsMetadata.Constraint = getConstraints(strconv.Itoa(*wfs.Spec.Service.CountDefault))
110107
config.Services.WFS200Config.Wfs200.Capabilities.OperationsMetadata = operationsMetadata
111108
}
112109

113110
return &config, nil
114111
}
115112

113+
func getConstraints(countDefault string) []wfs200.Constraint {
114+
return []wfs200.Constraint{
115+
{
116+
Name: "ImplementsBasicWFS",
117+
DefaultValue: ptr.To("TRUE"),
118+
},
119+
{
120+
Name: "ImplementsTransactionalWFS",
121+
DefaultValue: ptr.To("FALSE"),
122+
},
123+
{
124+
Name: "ImplementsLockingWFS",
125+
DefaultValue: ptr.To("FALSE"),
126+
},
127+
{
128+
Name: "KVPEncoding",
129+
DefaultValue: ptr.To("TRUE"),
130+
},
131+
{
132+
Name: "XMLEncoding",
133+
DefaultValue: ptr.To("TRUE"),
134+
},
135+
{
136+
Name: "SOAPEncoding",
137+
DefaultValue: ptr.To("FALSE"),
138+
},
139+
{
140+
Name: "ImplementsInheritance",
141+
DefaultValue: ptr.To("FALSE"),
142+
},
143+
{
144+
Name: "ImplementsRemoteResolve",
145+
DefaultValue: ptr.To("FALSE"),
146+
},
147+
{
148+
Name: "ImplementsResultPaging",
149+
DefaultValue: ptr.To("TRUE"),
150+
},
151+
{
152+
Name: "ImplementsStandardJoins",
153+
DefaultValue: ptr.To("FALSE"),
154+
},
155+
{
156+
Name: "ImplementsSpatialJoins",
157+
DefaultValue: ptr.To("FALSE"),
158+
},
159+
{
160+
Name: "ImplementsTemporalJoins",
161+
DefaultValue: ptr.To("FALSE"),
162+
},
163+
{
164+
Name: "ImplementsFeatureVersioning",
165+
DefaultValue: ptr.To("FALSE"),
166+
},
167+
{
168+
Name: "ManageStoredQueries",
169+
DefaultValue: ptr.To("FALSE"),
170+
},
171+
{
172+
Name: "PagingIsTransactionSafe",
173+
DefaultValue: ptr.To("FALSE"),
174+
},
175+
{
176+
Name: "CountDefault",
177+
DefaultValue: &countDefault,
178+
},
179+
{
180+
Name: "QueryExpressions",
181+
AllowedValues: &wfs200.AllowedValues{Value: []string{
182+
"wfs:Query",
183+
"wfs:StoredQuery",
184+
},
185+
},
186+
},
187+
}
188+
}
189+
116190
func getFeatureTypeList(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv1.OwnerInfo) (*wfs200.FeatureTypeList, error) {
117191
typeList := wfs200.FeatureTypeList{}
118192

@@ -207,15 +281,15 @@ func replaceMustacheTemplate(hrefTemplate string, identifier string) (string, er
207281
return mustache.Render(hrefTemplate, templateVariable)
208282
}
209283

210-
func mapServiceProvider(provider *smoothoperatorv1.ServiceProvider) (serviceProvider wfs200.ServiceProvider) {
284+
func mapServiceProvider(provider *smoothoperatorv1.ServiceProvider, providerSite *smoothoperatorv1.ProviderSite) (serviceProvider wfs200.ServiceProvider) {
211285
if provider.ProviderName != nil {
212286
serviceProvider.ProviderName = provider.ProviderName
213287
}
214288

215-
if provider.ProviderSite != nil {
289+
if providerSite != nil {
216290
serviceProvider.ProviderSite = &wfs200.ProviderSite{
217-
Type: provider.ProviderSite.Type,
218-
Href: provider.ProviderSite.Href,
291+
Type: providerSite.Type,
292+
Href: providerSite.Href,
219293
}
220294
}
221295

@@ -289,7 +363,7 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
289363
Title: wms.Spec.Service.Title,
290364
Abstract: &wms.Spec.Service.Abstract,
291365
KeywordList: &wms130.Keywords{Keyword: wms.Spec.Service.KeywordsIncludingInspireKeyword()},
292-
OnlineResource: wms130.OnlineResource{Href: smoothoperatorutils.Pointer(wms.URL().Scheme + "://" + wms.URL().Host + "/")},
366+
OnlineResource: wms130.OnlineResource{Href: &ownerInfo.Spec.ProviderSite.Href},
293367
ContactInformation: getContactInformation(ownerInfo),
294368
Fees: wms.Spec.Service.Fees,
295369
AccessConstraints: ptr.To(wms.Spec.Service.AccessConstraints.String()),

internal/controller/capabilitiesgenerator/test_data/wms_input.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
onlineResource:
3232
xlink: null
3333
type: null
34-
href: http://localhost/
34+
href: https://www.pdok.nl
3535
contactInformation:
3636
contactPersonPrimary:
3737
contactPerson: KlantContactCenter PDOK

internal/controller/shared_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func createControllerManager(mgr ctrl.Manager, obj client.Object) *builder.Typed
4444
controllerMgr := ctrl.NewControllerManagedBy(mgr).For(obj).Named(strings.ToLower(kind))
4545
controllerMgr.Owns(&corev1.ConfigMap{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
4646
Owns(&appsv1.Deployment{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
47+
WithEventFilter(predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{})).
4748
Owns(&corev1.Service{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
4849
Owns(&traefikiov1alpha1.Middleware{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
4950
Owns(&traefikiov1alpha1.IngressRoute{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
@@ -117,7 +118,7 @@ func createOrUpdateAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Con
117118
operationResults[smoothoperatorutils.GetObjectFullName(reconcilerClient, deployment)], err = controllerutil.CreateOrUpdate(ctx, reconcilerClient, deployment, func() error {
118119
return mutateDeployment(r, obj, deployment, hashedConfigMapNames)
119120
})
120-
if err != nil {
121+
if err != nil && !strings.Contains(err.Error(), "the object has been modified; please apply your changes to the latest version and try again") {
121122
return operationResults, fmt.Errorf("unable to create/update resource %s: %w", smoothoperatorutils.GetObjectFullName(reconcilerClient, deployment), err)
122123
}
123124
}

internal/controller/test_data/wfs/complete/input/ownerinfo.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ spec:
88
csw:
99
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id={{identifier}}"
1010
type: alternate
11-
opensearch:
11+
openSearch:
1212
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/opensearch/dut/{{identifier}}/OpenSearchDescription.xml"
1313
type: alternate
1414
html:
1515
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/{{identifier}}"
1616
type: alternate
1717
namespaceTemplate: "http://{{prefix}}.geonovum.nl"
18+
providerSite:
19+
type: simple
20+
href: https://pdok.nl
1821
wfs:
19-
serviceprovider:
20-
providername: PDOK
21-
providersite:
22-
type: simple
23-
href: https://pdok.nl
22+
serviceProvider:
23+
providerName: PDOK

internal/controller/test_data/wfs/minimal/input/ownerinfo.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ spec:
88
csw:
99
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id={{identifier}}"
1010
type: alternate
11-
opensearch:
11+
openSearch:
1212
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/opensearch/dut/{{identifier}}/OpenSearchDescription.xml"
1313
type: alternate
1414
html:
1515
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/{{identifier}}"
1616
type: alternate
1717
namespaceTemplate: "http://{{prefix}}.geonovum.nl"
18+
providerSite:
19+
type: simple
20+
href: https://pdok.nl
1821
wfs:
19-
serviceprovider:
20-
providername: PDOK
21-
providersite:
22-
type: simple
23-
href: https://pdok.nl
22+
serviceProvider:
23+
providerName: PDOK

internal/controller/test_data/wfs/noprefetch/input/ownerinfo.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ spec:
88
csw:
99
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id={{identifier}}"
1010
type: alternate
11-
opensearch:
11+
openSearch:
1212
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/opensearch/dut/{{identifier}}/OpenSearchDescription.xml"
1313
type: alternate
1414
html:
1515
hrefTemplate: "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/{{identifier}}"
1616
type: alternate
1717
namespaceTemplate: "http://{{prefix}}.geonovum.nl"
18+
providerSite:
19+
type: simple
20+
href: https://pdok.nl
1821
wfs:
19-
serviceprovider:
20-
providername: PDOK
21-
providersite:
22-
type: simple
23-
href: https://pdok.nl
22+
serviceProvider:
23+
providerName: PDOK

0 commit comments

Comments
 (0)