Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v2beta1/shared_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func ConvertOptionsV3ToV2(src pdoknlv3.Options) WMSWFSOptions {
}
}

//nolint:gosec
func ConvertAutoscaling(src Autoscaling) *pdoknlv3.HorizontalPodAutoscalerPatch {
var minReplicas *int32
if src.MinReplicas != nil {
Expand Down
1 change: 1 addition & 0 deletions api/v2beta1/wfs_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (src *WFS) ConvertTo(dstRaw conversion.Hub) error {
return src.ToV3(dst)
}

//nolint:gosec
func (src *WFS) ToV3(dst *pdoknlv3.WFS) error {
dst.ObjectMeta = src.ObjectMeta

Expand Down
3 changes: 3 additions & 0 deletions api/v2beta1/wms_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (src *WMS) ConvertTo(dstRaw conversion.Hub) error {
return nil
}

//nolint:gosec
func (src *WMS) ToV3(target *pdoknlv3.WMS) {
dst := target

Expand Down Expand Up @@ -424,9 +425,11 @@ func (v2Layer WMSLayer) MapToV3(v2Service WMSService) pdoknlv3.Layer {
return layer
}

//nolint:cyclop
func mapV3LayerToV2Layers(v3Layer pdoknlv3.Layer, parent *pdoknlv3.Layer, serviceEPSG string) []WMSLayer {
var layers []WMSLayer

//nolint:nestif
if parent == nil && v3Layer.Name == nil {
// Default top layer, do not include in v2 layers
if v3Layer.Layers != nil {
Expand Down
1 change: 1 addition & 0 deletions api/v3/wfs_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (wfs *WFS) ValidateCreate() ([]string, error) {
wfs.Name, allErrs)
}

// TODO fix linting (dupl)
func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
warnings := []string{}
allErrs := field.ErrorList{}
Expand Down
1 change: 1 addition & 0 deletions api/v3/wms_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ func (wms *WMS) URLPath() string {
func (wms *WMS) GeoPackages() []*Gpkg {
gpkgs := make([]*Gpkg, 0)

// TODO fix linting (nestif)
if wms.Spec.Service.Layer.Layers != nil {
for _, layer := range wms.Spec.Service.Layer.Layers {
if layer.Data != nil {
Expand Down
3 changes: 3 additions & 0 deletions api/v3/wms_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (wms *WMS) ValidateCreate() ([]string, error) {
wms.Name, allErrs)
}

// TODO fix linting (dupl)
func (wms *WMS) ValidateUpdate(wmsOld *WMS) ([]string, error) {
warnings := []string{}
allErrs := field.ErrorList{}
Expand All @@ -55,6 +56,7 @@ func (wms *WMS) ValidateUpdate(wmsOld *WMS) ([]string, error) {
wms.Name, allErrs)
}

// TODO fix linting (cyclop)
func ValidateWMS(wms *WMS, warnings *[]string, allErrs *field.ErrorList) {
if strings.Contains(wms.GetName(), "wms") {
sharedValidation.AddWarning(
Expand Down Expand Up @@ -220,6 +222,7 @@ func ValidateWMS(wms *WMS, warnings *[]string, allErrs *field.ErrorList) {
}
}

// TODO fix linting (nestif)
if layer.Visible {
hasVisibleLayer = true

Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func init() {
// +kubebuilder:scaffold:scheme
}

//nolint:gocyclo
// TODO fix linting (cyclop)
func main() {
var metricsAddr string
var certDir string
Expand Down
1 change: 1 addition & 0 deletions config/crd/update_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func main() {
updateWMSV3Layers(crdDir)
}

// TODO fix linting (funlen)
func updateWMSV3Layers(crdDir string) {
path := filepath.Join(crdDir, "pdok.nl_wms.yaml")

Expand Down
2 changes: 2 additions & 0 deletions internal/controller/capabilitiesgenerator/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func mapServiceProvider(provider *smoothoperatorv1.ServiceProvider) (serviceProv
}
}

// TODO fix linting (nestif)
if provider.ServiceContact != nil {
serviceProvider.ServiceContact = &wfs200.ServiceContact{
IndividualName: provider.ServiceContact.IndividualName,
Expand Down Expand Up @@ -360,6 +361,7 @@ func getDcpType(url string, fillPost bool) *wms130.DCPType {
return &result
}

// TODO fix linting (funlen)
func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
result := make([]wms130.Layer, 0)
referenceLayer := wms.Spec.Service.Layer
Expand Down
1 change: 1 addition & 0 deletions internal/controller/mapfilegenerator/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, _ *smoothoperatorv1.OwnerI
return result, nil
}

// TODO fix linting (cyclop)
func getWMSLayer(serviceLayer pdoknlv3.Layer, serviceExtent string, wms *pdoknlv3.WMS) WMSLayer {
layerExtent := serviceExtent
if len(serviceLayer.BoundingBoxes) > 0 {
Expand Down
3 changes: 3 additions & 0 deletions internal/controller/mapserver/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
mimeTextXML = "text/xml"
)

// TODO fix linting (funlen)
func GetVolumesForDeployment[O pdoknlv3.WMSWFS](obj O, configMapNames types.HashedConfigMapNames) []v1.Volume {
baseVolume := v1.Volume{Name: "base"}
if use, size := mapperutils.UseEphemeralVolume(obj); use {
Expand Down Expand Up @@ -215,6 +216,7 @@ func GetEnvVarsForDeployment[O pdoknlv3.WMSWFS](obj O, blobsSecretName string) [
}
}

// TODO fix linting (cyclop,gocritic,revive)
// Resources for mapserver container
func GetResourcesForDeployment[O pdoknlv3.WMSWFS](obj O) v1.ResourceRequirements {
resources := v1.ResourceRequirements{
Expand Down Expand Up @@ -289,6 +291,7 @@ func GetResourcesForDeployment[O pdoknlv3.WMSWFS](obj O) v1.ResourceRequirements
/**
Set ephemeral-storage if there is no ephemeral volume
*/
// TODO fix linting (nestif)
if use, _ := mapperutils.UseEphemeralVolume(obj); !use {
ephemeralStorageRequest := mapperutils.EphemeralStorageRequest(obj)
if ephemeralStorageRequest != nil {
Expand Down
26 changes: 15 additions & 11 deletions internal/controller/shared_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ var (
MapserverName = "mapserver"

// Service ports
mapserverPortName = "mapserver"
mapserverPortNr = 80
mapserverWebserviceProxyPortNr = 9111
metricPortName = "metric"
metricPortNr = 9117
mapserverPortName = "mapserver"
mapserverPortNr int32 = 80
mapserverWebserviceProxyPortNr = 9111
metricPortName = "metric"
metricPortNr int32 = 9117

corsHeadersName = "mapserver-headers"
)
Expand Down Expand Up @@ -398,7 +398,7 @@ func mutateIngressRoute[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, ingressRout
Kind: "Service",
Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: int32(mapserverPortNr),
IntVal: mapserverPortNr,
},
},
}
Expand All @@ -423,7 +423,8 @@ func mutateIngressRoute[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, ingressRout
Name: getBareService(obj).GetName(),
Kind: "Service",
Port: intstr.IntOrString{
Type: intstr.Int,
Type: intstr.Int,
//nolint:gosec
IntVal: int32(mapserverWebserviceProxyPortNr),
},
},
Expand Down Expand Up @@ -760,14 +761,14 @@ func mutateService[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, service *corev1.
ports := []corev1.ServicePort{
{
Name: mapserverPortName,
Port: int32(mapserverPortNr),
TargetPort: intstr.FromInt32(int32(mapserverPortNr)),
Port: mapserverPortNr,
TargetPort: intstr.FromInt32(mapserverPortNr),
Protocol: corev1.ProtocolTCP,
},
{
Name: metricPortName,
Port: int32(metricPortNr),
TargetPort: intstr.FromInt32(int32(metricPortNr)),
Port: metricPortNr,
TargetPort: intstr.FromInt32(metricPortNr),
Protocol: corev1.ProtocolTCP,
},
}
Expand Down Expand Up @@ -1000,6 +1001,7 @@ func getFinalizerName[O pdoknlv3.WMSWFS](obj O) string {
return strings.ToLower(string(obj.Type())) + "." + pdoknlv3.GroupVersion.Group + "/finalizer"
}

// TODO fix linting (cyclop)
func createOrUpdateAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Context, r R, obj O, ownerInfo *smoothoperatorv1.OwnerInfo) (operationResults map[string]controllerutil.OperationResult, err error) {
operationResults = make(map[string]controllerutil.OperationResult)
reconcilerClient := getReconcilerClient(r)
Expand Down Expand Up @@ -1070,6 +1072,7 @@ func createOrUpdateAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Con
}
// end region ConfigMap-BlobDownload

// TODO fix linting (nestif)
if obj.Type() == pdoknlv3.ServiceTypeWMS {
wms, _ := any(obj).(*pdoknlv3.WMS)
wmsReconciler := (*WMSReconciler)(r)
Expand Down Expand Up @@ -1205,6 +1208,7 @@ func createOrUpdateAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Con
return operationResults, nil
}

// TODO fix linting (funlen)
func deleteAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Context, r R, obj O, ownerInfo *smoothoperatorv1.OwnerInfo) (err error) {
bareObjects := getSharedBareObjects(obj)
var objects []client.Object
Expand Down
1 change: 1 addition & 0 deletions internal/controller/wfs_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type WFSReconciler struct {
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
// TODO fix linting (dupl)
func (r *WFSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
lgr := log.FromContext(ctx)
lgr.Info("Starting reconcile for WFS resource", "name", req.NamespacedName)
Expand Down
1 change: 1 addition & 0 deletions internal/controller/wms_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type WMSReconciler struct {
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
// TODO fix linting (dupl)
func (r *WMSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
lgr := log.FromContext(ctx)
lgr.Info("Starting reconcile for WMS resource", "name", req.NamespacedName)
Expand Down
1 change: 1 addition & 0 deletions internal/webhook/v3/wfs_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.

package v3

// TODO fix linting (dupl)
import (
"context"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions internal/webhook/v3/wms_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.

package v3

// TODO fix linting (dupl)
import (
"context"
"fmt"
Expand Down
Loading