@@ -45,65 +45,148 @@ const (
4545
4646// WMSSpec defines the desired state of WMS.
4747type WMSSpec struct {
48- Lifecycle * shared_model.Lifecycle `json:"lifecycle"`
48+ // Optional lifecycle settings
49+ Lifecycle * shared_model.Lifecycle `json:"lifecycle,omitempty"`
4950
5051 // +kubebuilder:validation:Type=object
5152 // +kubebuilder:validation:Schemaless
5253 // +kubebuilder:pruning:PreserveUnknownFields
5354 // Optional strategic merge patch for the pod in the deployment. E.g. to patch the resources or add extra env vars.
54- PodSpecPatch * corev1.PodSpec `json:"podSpecPatch,omitempty"`
55- HorizontalPodAutoscalerPatch * autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch"`
56- Options Options `json:"options,omitempty"`
57- Service WMSService `json:"service"`
55+ PodSpecPatch * corev1.PodSpec `json:"podSpecPatch,omitempty"`
56+
57+ // Optional specification for the HorizontalAutoscaler
58+ HorizontalPodAutoscalerPatch * autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch,omitempty"`
59+
60+ // Optional options for the configuration of the service.
61+ Options Options `json:"options,omitempty"`
62+
63+ // Service specification
64+ Service WMSService `json:"service"`
5865}
5966
6067type WMSService struct {
61- URL string `json:"url"`
62- Title string `json:"title"`
63- Abstract string `json:"abstract"`
64- Keywords []string `json:"keywords"`
65- OwnerInfoRef string `json:"ownerInfoRef"`
66- Fees * string `json:"fees,omitempty"`
68+ // URL of the service
69+ // +kubebuilder:validation:Format:=uri
70+ URL string `json:"url"`
71+
72+ // Title of the service
73+ // +kubebuilder:validation:MinLength:=1
74+ Title string `json:"title"`
75+
76+ // Abstract (short description) of the service
77+ // +kubebuilder:validation:MinLength:=1
78+ Abstract string `json:"abstract"`
79+
80+ // Keywords of the service
81+ // +kubebuilder:validation:MinItems:=1
82+ Keywords []string `json:"keywords"`
83+
84+ // Reference to a CR of Kind OwnerInfo
85+ // +kubebuilder:validation:MinLength:=1
86+ OwnerInfoRef string `json:"ownerInfoRef"`
87+
88+ // TODO ??
89+ // +kubebuilder:validation:MinLength:=1
90+ Fees * string `json:"fees,omitempty"`
91+
92+ // AccessConstraints (licence) that are applicable to the service
6793 // +kubebuilder:default="https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
68- AccessConstraints string `json:"accessConstraints"`
69- MaxSize * int32 `json:"maxSize,omitempty"`
70- Inspire * Inspire `json:"inspire,omitempty"`
94+ AccessConstraints string `json:"accessConstraints"`
95+
96+ // TODO??
97+ MaxSize * int32 `json:"maxSize,omitempty"`
98+
99+ // Optional specification Inspire themes and ids
100+ Inspire * Inspire `json:"inspire,omitempty"`
101+
102+ // CRS of the data
103+ // +kubebuilder:validation:Pattern:=`(EPSG|CRS):\d+`
71104 //nolint:tagliatelle
72- DataEPSG string `json:"dataEPSG"`
73- Resolution * int32 `json:"resolution,omitempty"`
74- DefResolution * int32 `json:"defResolution,omitempty"`
105+ DataEPSG string `json:"dataEPSG"`
106+
107+ // TODO ??
108+ Resolution * int32 `json:"resolution,omitempty"`
109+
110+ // TODO ??
111+ DefResolution * int32 `json:"defResolution,omitempty"`
112+
113+ // Optional. Required files for the styling of the service
75114 StylingAssets * StylingAssets `json:"stylingAssets,omitempty"`
76- Mapfile * Mapfile `json:"mapfile,omitempty"`
77- Layer Layer `json:"layer"`
115+
116+ // Custom mapfile
117+ Mapfile * Mapfile `json:"mapfile,omitempty"`
118+
119+ // Toplayer
120+ Layer Layer `json:"layer"`
78121}
79122
123+ // +kubebuilder:validation:XValidation:message="Either blobKeys or configMapRefs is required",rule="has(self.blobKeys) || has(self.configMapRefs)"
80124type StylingAssets struct {
81- BlobKeys []string `json:"blobKeys"`
82- ConfigMapRefs []ConfigMapRef `json:"configMapRefs"`
125+ // +kubebuilder:validations:MinItems:=1
126+ BlobKeys []string `json:"blobKeys,omitempty"`
127+
128+ // +kubebuilder:validations:MinItems:=1
129+ ConfigMapRefs []ConfigMapRef `json:"configMapRefs,omitempty"`
83130}
84131
85132type ConfigMapRef struct {
86- Name string `json:"name"`
133+ // +kubebuilder:validations:MinLength:=1
134+ Name string `json:"name"`
135+
136+ // +kubebuilder:validations:MinItems:=1
87137 Keys []string `json:"keys,omitempty"`
88138}
89139
140+ // +kubebuilder:validation:XValidation:message="A layer can only have data or layers, not both.", rule="has(self.data) || has(self.layers)"
90141type Layer struct {
91- Name * string `json:"name"`
92- Title * string `json:"title,omitempty"`
93- Abstract * string `json:"abstract,omitempty"`
94- Keywords []string `json:"keywords"`
95- BoundingBoxes []WMSBoundingBox `json:"boundingBoxes"`
96- Visible * bool `json:"visible,omitempty"`
97- Authority * Authority `json:"authority,omitempty"`
98- DatasetMetadataURL * MetadataURL `json:"datasetMetadataUrl,omitempty"`
99- MinScaleDenominator * string `json:"minscaledenominator,omitempty"`
100- MaxScaleDenominator * string `json:"maxscaledenominator,omitempty"`
101- Styles []Style `json:"styles"`
102- LabelNoClip bool `json:"labelNoClip"`
103- Data * Data `json:"data,omitempty"`
104- // Nested structs do not work in crd generation
105- // +kubebuilder:pruning:PreserveUnknownFields
106- // +kubebuilder:validation:Schemaless
142+ // Name of the layer, required for layers on the 2nd or 3rd level
143+ // +kubebuilder:validations:MinLength:=1
144+ Name * string `json:"name,omitempty"`
145+
146+ // Title of the layer
147+ // +kubebuilder:validations:MinLength:=1
148+ Title * string `json:"title,omitempty"`
149+
150+ // Abstract of the layer
151+ // +kubebuilder:validations:MinLength:=1
152+ Abstract * string `json:"abstract,omitempty"`
153+
154+ // Keywords of the layer
155+ // +kubebuilder:validations:MinItems:=1
156+ Keywords []string `json:"keywords"`
157+
158+ // BoundingBoxes of the layer. If omitted the boundingboxes of the parent layer of the service is used.
159+ BoundingBoxes []WMSBoundingBox `json:"boundingBoxes,omitempty"`
160+
161+ // Whether or not the layer is visible. At least one of the layers must be visible.
162+ // +kubebuilder:default:=true
163+ Visible * bool `json:"visible,omitempty"`
164+
165+ // TODO ??
166+ Authority * Authority `json:"authority,omitempty"`
167+
168+ // Links to metadata
169+ DatasetMetadataURL * MetadataURL `json:"datasetMetadataUrl,omitempty"`
170+
171+ // The minimum scale at which this layer functions
172+ // +kubebuilder:validation:Pattern:=`^[1-9][0-9]*(.[0-9]+)$`
173+ MinScaleDenominator * string `json:"minscaledenominator,omitempty"`
174+
175+ // The maximum scale at which this layer functions
176+ // +kubebuilder:validation:Pattern:=`^[1-9][0-9]*(.[0-9]+)$`
177+ MaxScaleDenominator * string `json:"maxscaledenominator,omitempty"`
178+
179+ // List of styles used by the layer
180+ // +kubebuilder:validations:MinItems:=1
181+ Styles []Style `json:"styles,omitempty"`
182+
183+ // TODO ??
184+ LabelNoClip bool `json:"labelNoClip,omitempty"`
185+
186+ // Data (gpkg/postgis/tif) used by the layer
187+ Data * Data `json:"data,omitempty"`
188+
189+ // Sublayers of the layer
107190 Layers * []Layer `json:"layers,omitempty"`
108191}
109192
@@ -130,13 +213,22 @@ type Authority struct {
130213}
131214
132215type Style struct {
133- Name string `json:"name"`
134- Title * string `json:"title"`
135- Abstract * string `json:"abstract"`
136- Visualization * string `json:"visualization"`
137- Legend * Legend `json:"legend"`
216+ // +kubebuilder:validations:MinLength:=1
217+ Name string `json:"name"`
218+
219+ // +kubebuilder:validations:MinLength:=1
220+ Title * string `json:"title,omitempty"`
221+
222+ // +kubebuilder:validations:MinLength:=1
223+ Abstract * string `json:"abstract,omitempty"`
224+
225+ // +kubebuilder:validations:MinLength:=1
226+ Visualization * string `json:"visualization,omitempty"`
227+
228+ Legend * Legend `json:"legend,omitempty"`
138229}
139230
231+ // TODO add validations + descriptions
140232type Legend struct {
141233 Width int32 `json:"width"`
142234 Height int32 `json:"height"`
0 commit comments