Skip to content

Commit 3846738

Browse files
author
Jelle Dijkstra
committed
Mergig with Damien
1 parent 3eb69e3 commit 3846738

40 files changed

+2488
-779
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
**Build and push your image to the location specified by `IMG`:**
1717

1818
```sh
19-
make docker-build docker-push IMG=<some-registry>/mapserver-operator:tag
19+
make docker-build docker-push IMG=<some-registry>/configmap_files-operator:tag
2020
```
2121

2222
**NOTE:** This image ought to be published in the personal registry you specified.
@@ -32,7 +32,7 @@ make install
3232
**Deploy the Manager to the cluster with the image specified by `IMG`:**
3333

3434
```sh
35-
make deploy IMG=<some-registry>/mapserver-operator:tag
35+
make deploy IMG=<some-registry>/configmap_files-operator:tag
3636
```
3737

3838
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
@@ -75,7 +75,7 @@ Following the options to release and provide this solution to the users.
7575
1. Build the installer for the image built and published in the registry:
7676

7777
```sh
78-
make build-installer IMG=<some-registry>/mapserver-operator:tag
78+
make build-installer IMG=<some-registry>/configmap_files-operator:tag
7979
```
8080

8181
**NOTE:** The makefile target mentioned above generates an 'install.yaml'
@@ -89,7 +89,7 @@ Users can just run 'kubectl apply -f <URL for YAML BUNDLE>' to install
8989
the project, i.e.:
9090

9191
```sh
92-
kubectl apply -f https://raw.githubusercontent.com/<org>/mapserver-operator/<tag or branch>/dist/install.yaml
92+
kubectl apply -f https://raw.githubusercontent.com/<org>/configmap_files-operator/<tag or branch>/dist/install.yaml
9393
```
9494

9595
### By providing a Helm Chart

api/v2beta1/shared_conversion.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
66
shared_model "github.com/pdok/smooth-operator/model"
7-
autoscalingv2 "k8s.io/api/autoscaling/v2beta1"
7+
autoscalingv2 "k8s.io/api/autoscaling/v2"
88
corev1 "k8s.io/api/core/v1"
99
)
1010

@@ -60,8 +60,11 @@ func ConverseAutoscaling(src Autoscaling) *autoscalingv2.HorizontalPodAutoscaler
6060
metrics = append(metrics, autoscalingv2.MetricSpec{
6161
Type: autoscalingv2.ResourceMetricSourceType,
6262
Resource: &autoscalingv2.ResourceMetricSource{
63-
Name: corev1.ResourceCPU,
64-
TargetAverageUtilization: Pointer(int32(*src.AverageCPUUtilization)),
63+
Name: corev1.ResourceCPU,
64+
Target: autoscalingv2.MetricTarget{
65+
Type: autoscalingv2.UtilizationMetricType,
66+
AverageUtilization: Pointer(int32(*src.AverageCPUUtilization)),
67+
},
6568
},
6669
})
6770
}
@@ -215,7 +218,7 @@ func NewV2KubernetesObject(lifecycle *shared_model.Lifecycle, podSpecPatch *core
215218

216219
if scalingSpec.Metrics != nil {
217220
kub.Autoscaling.AverageCPUUtilization = Pointer(
218-
int(*scalingSpec.Metrics[0].Resource.TargetAverageUtilization),
221+
int(*scalingSpec.Metrics[0].Resource.Target.AverageUtilization),
219222
)
220223
}
221224
}

api/v2beta1/wfs_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (src *WFS) ConvertTo(dstRaw conversion.Hub) error {
6161

6262
service := pdoknlv3.WFSService{
6363
Prefix: "",
64-
BaseURL: CreateBaseURL("https://service.pdok.nl", "wfs", src.Spec.General),
64+
URL: CreateBaseURL("https://service.pdok.nl", "wfs", src.Spec.General),
6565
OwnerInfoRef: "pdok",
6666
Title: src.Spec.Service.Title,
6767
Abstract: src.Spec.Service.Abstract,

api/v2beta1/wms_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (src *WMS) ConvertTo(dstRaw conversion.Hub) error {
6565
dst.Spec.Options = ConverseOptionsV2ToV3(src.Spec.Options)
6666

6767
service := pdoknlv3.WMSService{
68-
BaseURL: CreateBaseURL("https://service.pdok.nl", "wms", src.Spec.General),
68+
URL: CreateBaseURL("https://service.pdok.nl", "wms", src.Spec.General),
6969
OwnerInfoRef: "pdok",
7070
Title: src.Spec.Service.Title,
7171
Abstract: src.Spec.Service.Abstract,

api/v2beta1/wms_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ type StylingAssets struct {
109109
BlobKeys []string `json:"blobKeys,omitempty"`
110110
}
111111

112-
// ConfigMapRef contains all the config map name and all keys in that configmap that are relevant
112+
// ConfigMapRef contains all the config map name and all keys in that configmap_files that are relevant
113113
// the Keys can be empty, so that the v1 WMS can convert to the v2beta1 WMS
114114
type ConfigMapRef struct {
115115
Name string `json:"name"`

api/v3/shared_types.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package v3
22

33
import (
44
corev1 "k8s.io/api/core/v1"
5+
"net/url"
56
"strings"
67
)
78

8-
var baseURL string
9+
var host string
910

1011
type Mapfile struct {
1112
ConfigMapKeyRef corev1.ConfigMapKeySelector `json:"configMapKeyRef"`
@@ -73,10 +74,27 @@ type Columns struct {
7374
Alias *string `json:"alias,omitempty"`
7475
}
7576

76-
func SetBaseURL(url string) {
77-
baseURL = strings.TrimSuffix(url, "/")
77+
func SetHost(url string) {
78+
host = strings.TrimSuffix(url, "/")
7879
}
7980

80-
func GetBaseURL() string {
81-
return baseURL
81+
func GetHost() string {
82+
return host
83+
}
84+
85+
func GetBaseURLPath[T *WFS | *WMS](o T) string {
86+
var serviceUrl string
87+
switch any(o).(type) {
88+
case *WFS:
89+
if WFS, ok := any(o).(*WFS); ok {
90+
serviceUrl = WFS.Spec.Service.URL
91+
}
92+
case *WMS:
93+
if WMS, ok := any(o).(*WMS); ok {
94+
serviceUrl = WMS.Spec.Service.URL
95+
}
96+
}
97+
98+
parsed, _ := url.Parse(serviceUrl)
99+
return strings.TrimPrefix(parsed.Path, "/")
82100
}

api/v3/wfs_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ package v3
2626

2727
import (
2828
shared_model "github.com/pdok/smooth-operator/model"
29-
autoscalingv2 "k8s.io/api/autoscaling/v2beta1"
29+
autoscalingv2 "k8s.io/api/autoscaling/v2"
3030
corev1 "k8s.io/api/core/v1"
3131
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3232
)
@@ -79,7 +79,7 @@ type WFSSpec struct {
7979

8080
type WFSService struct {
8181
Prefix string `json:"prefix"`
82-
BaseURL string `json:"baseUrl"`
82+
URL string `json:"url"`
8383
Inspire *Inspire `json:"inspire,omitempty"`
8484
Mapfile *Mapfile `json:"mapfile,omitempty"`
8585
OwnerInfoRef string `json:"ownerInfoRef"`

api/v3/wfs_validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
3535
}
3636

3737
// Check service.baseURL did not change
38-
if wfs.Spec.Service.BaseURL != wfsOld.Spec.Service.BaseURL {
38+
if wfs.Spec.Service.URL != wfsOld.Spec.Service.URL {
3939
reasons = append(reasons, fmt.Sprintf("service.baseURL is immutable"))
4040
}
4141

@@ -59,7 +59,7 @@ func validateWFS(wfs *WFS, warnings *[]string, reasons *[]string) {
5959

6060
service := wfs.Spec.Service
6161

62-
err := sharedValidation.ValidateBaseURL(service.BaseURL)
62+
err := sharedValidation.ValidateBaseURL(service.URL)
6363
if err != nil {
6464
*reasons = append(*reasons, fmt.Sprintf("%v", err))
6565
}

api/v3/wms_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ package v3
2626

2727
import (
2828
shared_model "github.com/pdok/smooth-operator/model"
29-
autoscalingv2 "k8s.io/api/autoscaling/v2beta1"
29+
autoscalingv2 "k8s.io/api/autoscaling/v2"
3030
corev1 "k8s.io/api/core/v1"
3131
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3232
"maps"
@@ -52,7 +52,7 @@ type WMSSpec struct {
5252
}
5353

5454
type WMSService struct {
55-
BaseURL string `json:"baseUrl"`
55+
URL string `json:"url"`
5656
Title string `json:"title"`
5757
Abstract string `json:"abstract"`
5858
Keywords []string `json:"keywords"`

api/v3/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)