Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Dockerfile.cross

# Go workspace file
go.work
go.work.sum

# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# mapserver-operator

_Kubernetes controller/operator to serve WFS and WMS instances._

[![Build](https://github.com/PDOK/mapserver-operator/actions/workflows/build-and-publish-image.yml/badge.svg)](https://github.com/PDOK/mapserver-operator/actions/workflows/build-and-publish-image.yml)
[![Lint (go)](https://github.com/PDOK/mapserver-operator/actions/workflows/lint.yml/badge.svg)](https://github.com/PDOK/mapserver-operator/actions/workflows/lint.yml)
[![GitHub license](https://img.shields.io/github/license/PDOK/mapserver-operator)](https://github.com/PDOK/mapserver-operator/blob/master/LICENSE)

## Description

This Kubernetes controller cq operator (an operator could be described as a specialized controller)
ensures that the necessary resources are created or kept up-to-date in a cluster
to deploy instances of the [Web Map Service](https://www.ogc.org/standards/wms/)(WMS) and [Web Features Service](https://www.ogc.org/standards/wfs/)(WFS). This repository is a complete solution to deploy WMS and WFS services according to CR schemas.
Expand All @@ -14,12 +16,14 @@ This operator uses two Custom Resources(CR) called _WMS_ and _WFS_ as the input
## Getting Started

### Prerequisites

- go version v1.26.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.

### To Deploy on the cluster

**Build and push your image to the location specified by `IMG`:**

```sh
Expand Down Expand Up @@ -55,6 +59,7 @@ kubectl apply -k config/samples/
>**NOTE**: Ensure that the samples has default values to test it out.

### To Uninstall

**Delete the instances (CRs) from the cluster:**

```sh
Expand All @@ -73,6 +78,17 @@ make uninstall
make undeploy
```

## Command-line flags

### Reloader annotations

Use `--set-reloader-annotations=search` to set `reloader.stakater.com/search=true` on Deployments.
Search mode requires `reloader.stakater.com/match=true` on the referenced ConfigMaps or Secrets.
Use `=auto` to set `reloader.stakater.com/auto=true` instead.
For backwards compatibility, the bare flag and `=true` still select auto mode.
The default (`=false`) disables both annotations; switching modes removes the other annotation.
The equivalent environment variable is `SET_RELOADER_ANNOTATIONS`.

## Develop

The project is written in Go and scaffolded with [kubebuilder](https://kubebuilder.io).
Expand All @@ -83,6 +99,7 @@ Read the manual when you want/need to make changes.
E.g. run `make test` before committing.

To update the scaffolding:

- Install the latest version of kubebuilder globally on your machine;
- Run: `kubebuilder alpha update --from-branch master`

Expand All @@ -92,13 +109,16 @@ Install [golangci-lint](https://golangci-lint.run/usage/install/) and run `golan
from the root.
(Don't run `make lint`, it uses an old version of golangci-lint.)

# Contributing
## Contributing

### How to contribute

Mapserver-operator is solely developed by PDOK. Contributions are however always welcome. If you have any questions or suggestions you can create an issue in the issue tracker.

### Contact

The maintainers can be contacted through the issue tracker.

# Authors
## Authors

This project is developed by [PDOK](https://www.pdok.nl/), a platform for publication of geographic datasets of Dutch governmental institutions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/pdok/featureinfo-generator v1.5.0
github.com/pdok/ogc-capabilities-generator v1.0.4
github.com/pdok/ogc-specifications v1.0.7
github.com/pdok/smooth-operator v1.3.0
github.com/pdok/smooth-operator v1.3.1
github.com/peterbourgon/ff v1.7.1
github.com/stretchr/testify v1.12.1
github.com/traefik/traefik/v3 v3.7.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ github.com/pdok/ogc-capabilities-generator v1.0.4 h1:SPTQjlITPK7xrOU6Y6bLK4I1MSk
github.com/pdok/ogc-capabilities-generator v1.0.4/go.mod h1:/ryq2/xD1ulgop21OwPVtXYHgKEcRQQ+64HYo20ZHWs=
github.com/pdok/ogc-specifications v1.0.7 h1:ZWmDr7mjfhvCT5okKYNl7MqSm9k2zkJRnPLj/bnbMUY=
github.com/pdok/ogc-specifications v1.0.7/go.mod h1:GYFKRtWDDKS/elBRXQvGoMLL97yrtdRqyCFmnb4iPTA=
github.com/pdok/smooth-operator v1.3.0 h1:STIrzo1n3mY38RxD899sfzFiYkeyWHuIpQ6jcdQVtzI=
github.com/pdok/smooth-operator v1.3.0/go.mod h1:Z87CdfxCKTvb7lkd19w1q+bGK0XaqHfa/ppDD8Zpnq0=
github.com/pdok/smooth-operator v1.3.1 h1:ycmKM77RcYz2XJdr+NQwvbkYDMzbeFgWt5In5W7Zj7I=
github.com/pdok/smooth-operator v1.3.1/go.mod h1:Z87CdfxCKTvb7lkd19w1q+bGK0XaqHfa/ppDD8Zpnq0=
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
github.com/peterbourgon/ff v1.7.1 h1:xt1lxTG+Nr2+tFtysY7abFgPoH3Lug8CwYJMOmJRXhk=
github.com/peterbourgon/ff v1.7.1/go.mod h1:fYI5YA+3RDqQRExmFbHnBjEeWzh9TrS8rnRpEq7XIg0=
Expand Down
17 changes: 13 additions & 4 deletions internal/controller/shared_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controller

import (
"context"
"flag"
"fmt"
"os"
"slices"
Expand Down Expand Up @@ -331,18 +332,26 @@ func testMutates[R Reconciler, O pdoknlv3.WMSWFS](reconcilerFn func() R, resourc
DeferCleanup(func() {
reloader.SetReloaderAnnotations(originalEnabled)
})
flags := flag.NewFlagSet("reloader", flag.ContinueOnError)
reloader.BindFlag(flags)
deployment := getBareDeployment(resource)

for _, enabled := range []bool{false, true, false} {
By(fmt.Sprintf("Mutating the Deployment with Reloader annotations enabled: %t", enabled))
reloader.SetReloaderAnnotations(enabled)
const legacyAutoMode = "true"
for _, mode := range []string{"false", legacyAutoMode, "search", "auto", "false"} {
By("Mutating the Deployment with Reloader annotation mode: " + mode)
Expect(flags.Parse([]string{"--" + reloader.FlagName + "=" + mode})).To(Succeed())
Expect(mutateDeployment(reconcilerFn(), resource, deployment, configMapNames)).To(Succeed())

if enabled {
if mode == legacyAutoMode || mode == "auto" {
Expect(deployment.Annotations).To(HaveKeyWithValue(reloader.AutoAnnotation, reloader.AutoAnnotationValue))
} else {
Expect(deployment.Annotations).NotTo(HaveKey(reloader.AutoAnnotation))
}
if mode == "search" {
Expect(deployment.Annotations).To(HaveKeyWithValue(reloader.SearchAnnotation, reloader.SearchAnnotationValue))
} else {
Expect(deployment.Annotations).NotTo(HaveKey(reloader.SearchAnnotation))
}
}
})

Expand Down
Loading