Skip to content

Commit 4801c8e

Browse files
committed
wip
1 parent a81ded8 commit 4801c8e

File tree

14 files changed

+982
-107
lines changed

14 files changed

+982
-107
lines changed

api/v2beta1/shared_conversion.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func ConvertAutoscaling(src Autoscaling) *pdoknlv3.HorizontalPodAutoscalerPatch
7575

7676
return &pdoknlv3.HorizontalPodAutoscalerPatch{
7777
MinReplicas: minReplicas,
78-
MaxReplicas: maxReplicas,
78+
MaxReplicas: &maxReplicas,
7979
Metrics: metrics,
8080
}
8181
}
@@ -221,8 +221,10 @@ func NewV2KubernetesObject(lifecycle *smoothoperatormodel.Lifecycle, podSpecPatc
221221
kub.Resources = &podSpecPatch.Containers[0].Resources
222222

223223
if scalingSpec != nil {
224-
kub.Autoscaling = &Autoscaling{
225-
MaxReplicas: smoothoperatorutils.Pointer(int(scalingSpec.MaxReplicas)),
224+
kub.Autoscaling = &Autoscaling{}
225+
226+
if scalingSpec.MaxReplicas != nil {
227+
kub.Autoscaling.MaxReplicas = smoothoperatorutils.Pointer(int(*scalingSpec.MaxReplicas))
226228
}
227229

228230
if scalingSpec.MinReplicas != nil {

api/v2beta1/wfs_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func convertV2FeatureTypeToV3(src FeatureType) pdoknlv3.FeatureType {
148148
Title: src.Title,
149149
Abstract: src.Abstract,
150150
Keywords: src.Keywords,
151-
DatasetMetadataURL: pdoknlv3.MetadataURL{
151+
DatasetMetadataURL: &pdoknlv3.MetadataURL{
152152
CSW: &pdoknlv3.Metadata{
153153
MetadataIdentifier: src.DatasetMetadataIdentifier,
154154
},

api/v3/shared_types.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ const (
2323

2424
// HorizontalPodAutoscalerPatch - copy of autoscalingv2.HorizontalPodAutoscalerSpec without ScaleTargetRef
2525
// This way we don't have to specify the scaleTargetRef field in the CRD.
26+
// +kubebuilder:validation:XValidation:rule="self.maxReplicas >= self.minReplicas", message="metadataUrl should have csw or custom, not both"
2627
type HorizontalPodAutoscalerPatch struct {
27-
MinReplicas *int32 `json:"minReplicas,omitempty"`
28-
MaxReplicas int32 `json:"maxReplicas"`
28+
// +kubebuilder:default:=2
29+
MinReplicas int32 `json:"minReplicas,omitempty"`
30+
// +kubebuilder:default:=30
31+
MaxReplicas int32 `json:"maxReplicas,omitempty"`
2932
Metrics []autoscalingv2.MetricSpec `json:"metrics,omitempty"`
3033
Behavior *autoscalingv2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty"`
3134
}
@@ -167,7 +170,7 @@ type Data struct {
167170
// +kubebuilder:validation:Type=object
168171
type Gpkg struct {
169172
// Blobkey identifies the location/bucket of the .gpkg file
170-
// +kubebuilder:validation:Pattern=`\.gpkg$`
173+
// +kubebuilder:validation:Pattern:=^.+\/.+\/.+\.gpkg$
171174
// +kubebuilder:validation:MinLength:=1
172175
BlobKey string `json:"blobKey"`
173176

api/v3/wfs_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ type WFSService struct {
118118

119119
// Keywords for capabilities
120120
// +kubebuilder:validation:MinItems:=1
121+
// +kubebuilder:validation:items:MinLength:=1
121122
Keywords []string `json:"keywords"`
122123

123124
// Optional Fees
@@ -164,6 +165,8 @@ func (s WFSService) KeywordsIncludingInspireKeyword() []string {
164165
// HealthCheck is the struct with all fields to configure custom healthchecks
165166
type HealthCheckWFS struct {
166167
// +kubebuilder:validation:MinLength:=1
168+
// +kubebuilder:validation:XValidation:rule="self.contains('Service=WFS')",message="a valid healthcheck contains 'Service=WFS'"
169+
// +kubebuilder:validation:XValidation:rule="self.contains('Request=')",message="a valid healthcheck contains 'Request='"
167170
Querystring string `json:"querystring"`
168171
// +kubebuilder:validation:Pattern=(image/png|text/xml|text/html)
169172
Mimetype string `json:"mimetype"`
@@ -192,11 +195,12 @@ type FeatureType struct {
192195

193196
// Keywords of the feature
194197
// +kubebuilder:validation:MinItems:=1
198+
// +kubebuilder:validation:items:MinLength:=1
195199
Keywords []string `json:"keywords"`
196200

197201
// Metadata URL
198202
// +kubebuilder:validation:Type=object
199-
DatasetMetadataURL MetadataURL `json:"datasetMetadataUrl"`
203+
DatasetMetadataURL *MetadataURL `json:"datasetMetadataUrl,omitempty"`
200204

201205
// Optional feature bbox
202206
// +kubebuilder:validation:Optional

api/v3/wms_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type WMSService struct {
9090

9191
// Keywords of the service
9292
// +kubebuilder:validation:MinItems:=1
93+
// +kubebuilder:validation:items:MinLength:=1
9394
Keywords []string `json:"keywords"`
9495

9596
// Reference to a CR of Kind OwnerInfo

api/v3/zz_generated.deepcopy.go

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

config/crd/bases/pdok.nl_wfs.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,11 @@ spec:
466466
querystring:
467467
minLength: 1
468468
type: string
469+
x-kubernetes-validations:
470+
- message: a valid healthcheck contains 'Service=WFS'
471+
rule: self.contains('Service=WFS')
472+
- message: a valid healthcheck contains 'Request='
473+
rule: self.contains('Request=')
469474
required:
470475
- mimetype
471476
- querystring
@@ -1058,8 +1063,6 @@ spec:
10581063
minReplicas:
10591064
format: int32
10601065
type: integer
1061-
required:
1062-
- maxReplicas
10631066
type: object
10641067
lifecycle:
10651068
description: Optional lifecycle settings
@@ -1252,7 +1255,7 @@ spec:
12521255
description: Blobkey identifies the location/bucket
12531256
of the .gpkg file
12541257
minLength: 1
1255-
pattern: \.gpkg$
1258+
pattern: ^.+\/.+\/.+\.gpkg$
12561259
type: string
12571260
columns:
12581261
description: Columns to visualize for this table
@@ -1405,6 +1408,7 @@ spec:
14051408
keywords:
14061409
description: Keywords of the feature
14071410
items:
1411+
minLength: 1
14081412
type: string
14091413
minItems: 1
14101414
type: array
@@ -1419,7 +1423,6 @@ spec:
14191423
required:
14201424
- abstract
14211425
- data
1422-
- datasetMetadataUrl
14231426
- keywords
14241427
- name
14251428
- title
@@ -1487,6 +1490,7 @@ spec:
14871490
keywords:
14881491
description: Keywords for capabilities
14891492
items:
1493+
minLength: 1
14901494
type: string
14911495
minItems: 1
14921496
type: array

0 commit comments

Comments
 (0)