@@ -8,26 +8,26 @@ import (
88 "strings"
99 "time"
1010
11- "github.com/pdok/mapserver-operator/internal/controller/featureinfogenerator"
12- "github.com/pdok/mapserver-operator/internal/controller/legendgenerator"
13- "github.com/pdok/mapserver-operator/internal/controller/mapserver"
14- "github.com/pdok/mapserver-operator/internal/controller/ogcwebserviceproxy"
15- "github.com/pdok/mapserver-operator/internal/controller/types"
16- appsv1 "k8s.io/api/apps/v1"
1711 "k8s.io/apimachinery/pkg/api/resource"
1812
1913 pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
2014 "github.com/pdok/mapserver-operator/internal/controller/blobdownload"
2115 "github.com/pdok/mapserver-operator/internal/controller/capabilitiesgenerator"
16+ "github.com/pdok/mapserver-operator/internal/controller/featureinfogenerator"
17+ "github.com/pdok/mapserver-operator/internal/controller/legendgenerator"
2218 "github.com/pdok/mapserver-operator/internal/controller/mapfilegenerator"
2319 "github.com/pdok/mapserver-operator/internal/controller/mapperutils"
20+ "github.com/pdok/mapserver-operator/internal/controller/mapserver"
21+ "github.com/pdok/mapserver-operator/internal/controller/ogcwebserviceproxy"
2422 "github.com/pdok/mapserver-operator/internal/controller/static"
23+ "github.com/pdok/mapserver-operator/internal/controller/types"
2524 smoothoperatorv1 "github.com/pdok/smooth-operator/api/v1"
2625 "github.com/pdok/smooth-operator/model"
2726 smoothoperatork8s "github.com/pdok/smooth-operator/pkg/k8s"
2827 smoothoperatorutils "github.com/pdok/smooth-operator/pkg/util"
2928 traefikdynamic "github.com/traefik/traefik/v3/pkg/config/dynamic"
3029 traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
30+ appsv1 "k8s.io/api/apps/v1"
3131 autoscalingv2 "k8s.io/api/autoscaling/v2"
3232 corev1 "k8s.io/api/core/v1"
3333 v1 "k8s.io/api/policy/v1"
@@ -261,8 +261,8 @@ func getInitContainerForDeployment[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O)
261261
262262 initContainers := []corev1.Container {
263263 * blobDownloadInitContainer ,
264- * mapfileGeneratorInitContainer ,
265264 * capabilitiesGeneratorInitContainer ,
265+ * mapfileGeneratorInitContainer ,
266266 }
267267
268268 if wms , ok := any (obj ).(* pdoknlv3.WMS ); ok {
@@ -301,30 +301,6 @@ func getContainersForDeployment[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O) ([]
301301 }
302302
303303 containers := []corev1.Container {
304- {
305- Name : "apache-exporter" ,
306- Image : images .ApacheExporterImage ,
307- ImagePullPolicy : corev1 .PullIfNotPresent ,
308- TerminationMessagePolicy : corev1 .TerminationMessageReadFile ,
309- TerminationMessagePath : "/dev/termination-log" ,
310- Ports : []corev1.ContainerPort {
311- {
312- ContainerPort : 9117 ,
313- Protocol : corev1 .ProtocolTCP ,
314- },
315- },
316- Args : []string {
317- "--scrape_uri=http://localhost/server-status?auto" ,
318- },
319- Resources : corev1.ResourceRequirements {
320- Limits : corev1.ResourceList {
321- corev1 .ResourceMemory : resource .MustParse ("48M" ),
322- },
323- Requests : corev1.ResourceList {
324- corev1 .ResourceCPU : resource .MustParse ("0.02" ),
325- },
326- },
327- },
328304 {
329305 Name : MapserverName ,
330306 Image : images .MapserverImage ,
@@ -351,6 +327,30 @@ func getContainersForDeployment[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O) ([]
351327 },
352328 },
353329 },
330+ {
331+ Name : "apache-exporter" ,
332+ Image : images .ApacheExporterImage ,
333+ ImagePullPolicy : corev1 .PullIfNotPresent ,
334+ TerminationMessagePolicy : corev1 .TerminationMessageReadFile ,
335+ TerminationMessagePath : "/dev/termination-log" ,
336+ Ports : []corev1.ContainerPort {
337+ {
338+ ContainerPort : 9117 ,
339+ Protocol : corev1 .ProtocolTCP ,
340+ },
341+ },
342+ Args : []string {
343+ "--scrape_uri=http://localhost/server-status?auto" ,
344+ },
345+ Resources : corev1.ResourceRequirements {
346+ Limits : corev1.ResourceList {
347+ corev1 .ResourceMemory : resource .MustParse ("48M" ),
348+ },
349+ Requests : corev1.ResourceList {
350+ corev1 .ResourceCPU : resource .MustParse ("0.02" ),
351+ },
352+ },
353+ },
354354 }
355355
356356 if wms , ok := any (obj ).(* pdoknlv3.WMS ); ok {
@@ -414,8 +414,7 @@ func mutateIngressRoute[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, ingressRout
414414 }
415415
416416 middlewareRef := traefikiov1alpha1.MiddlewareRef {
417- Name : getBareCorsHeadersMiddleware (obj ).GetName (),
418- Namespace : obj .GetNamespace (),
417+ Name : getBareCorsHeadersMiddleware (obj ).GetName (),
419418 }
420419
421420 if obj .Type () == pdoknlv3 .ServiceTypeWMS {
@@ -463,6 +462,9 @@ func mutateIngressRoute[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, ingressRout
463462 }}
464463 }
465464
465+ // Add finalizers
466+ ingressRoute .Finalizers = []string {"uptime.pdok.nl/finalizer" }
467+
466468 if err := smoothoperatorutils .EnsureSetGVK (reconcilerClient , ingressRoute , ingressRoute ); err != nil {
467469 return err
468470 }
@@ -675,8 +677,9 @@ func mutateHorizontalPodAutoscaler[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O,
675677
676678 autoscaler .Spec = autoscalingv2.HorizontalPodAutoscalerSpec {
677679 ScaleTargetRef : autoscalingv2.CrossVersionObjectReference {
678- Kind : "Deployment" ,
679- Name : getSuffixedName (obj , MapserverName ),
680+ APIVersion : "apps/v1" ,
681+ Kind : "Deployment" ,
682+ Name : getSuffixedName (obj , MapserverName ),
680683 },
681684 MinReplicas : & minReplicas ,
682685 MaxReplicas : maxReplicas ,
@@ -698,13 +701,13 @@ func mutateHorizontalPodAutoscaler[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O,
698701 SelectPolicy : smoothoperatorutils .Pointer (autoscalingv2 .MaxChangePolicySelect ),
699702 Policies : []autoscalingv2.HPAScalingPolicy {
700703 {
701- Type : autoscalingv2 .PodsScalingPolicy ,
702- Value : 1 ,
704+ Type : autoscalingv2 .PercentScalingPolicy ,
705+ Value : 10 ,
703706 PeriodSeconds : 600 ,
704707 },
705708 {
706- Type : autoscalingv2 .PercentScalingPolicy ,
707- Value : 10 ,
709+ Type : autoscalingv2 .PodsScalingPolicy ,
710+ Value : 1 ,
708711 PeriodSeconds : 600 ,
709712 },
710713 },
0 commit comments