Skip to content

Commit 4d47ac8

Browse files
committed
fix bugs and add first unit tests
1 parent c748333 commit 4d47ac8

24 files changed

+788
-43
lines changed

api/crds/manifests/dns.openmcp.cloud_dnsserviceconfigs.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,33 +100,35 @@ spec:
100100
If target is nil or target.name is empty, the secret will be copied with the same name as the source secret.
101101
properties:
102102
source:
103-
description: ObjectReference is a reference to an object in
104-
any namespace.
103+
description: LocalObjectReference is a reference to an object
104+
in the same namespace as the resource referencing it.
105105
properties:
106106
name:
107-
description: Name is the name of the object.
108-
type: string
109-
namespace:
110-
description: Namespace is the namespace of the object.
107+
default: ""
108+
description: |-
109+
Name of the referent.
110+
This field is effectively required, but due to backwards compatibility is
111+
allowed to be empty. Instances of this type with an empty value here are
112+
almost certainly wrong.
113+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
111114
type: string
112-
required:
113-
- name
114-
- namespace
115115
type: object
116+
x-kubernetes-map-type: atomic
116117
target:
117-
description: ObjectReference is a reference to an object in
118-
any namespace.
118+
description: LocalObjectReference is a reference to an object
119+
in the same namespace as the resource referencing it.
119120
properties:
120121
name:
121-
description: Name is the name of the object.
122-
type: string
123-
namespace:
124-
description: Namespace is the namespace of the object.
122+
default: ""
123+
description: |-
124+
Name of the referent.
125+
This field is effectively required, but due to backwards compatibility is
126+
allowed to be empty. Instances of this type with an empty value here are
127+
almost certainly wrong.
128+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
125129
type: string
126-
required:
127-
- name
128-
- namespace
129130
type: object
131+
x-kubernetes-map-type: atomic
130132
required:
131133
- source
132134
- target

api/dns/v1alpha1/config_types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ type ExternalDNSSource struct {
4343
// SecretCopy defines the name of the secret to copy and the name of the copied secret.
4444
// If target is nil or target.name is empty, the secret will be copied with the same name as the source secret.
4545
type SecretCopy struct {
46-
Source commonapi.ObjectReference `json:"source"`
47-
Target *commonapi.ObjectReference `json:"target"`
46+
Source commonapi.LocalObjectReference `json:"source"`
47+
Target *commonapi.LocalObjectReference `json:"target"`
4848
}
4949

5050
// ExternalDNSPurposeConfig holds a purpose selector and the DNS configuration to apply if the selector matches.
@@ -116,6 +116,9 @@ func init() {
116116

117117
// Matches returns true if the selector matches the given list of purposes.
118118
func (ps *PurposeSelector) Matches(purposes []string) bool {
119+
if ps == nil {
120+
return true
121+
}
119122
return requirementMatches(&ps.PurposeSelectorRequirement, purposes, map[*PurposeSelectorRequirement]empty{})
120123
}
121124

api/dns/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/install/install.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
fluxhelmv2 "github.com/fluxcd/helm-controller/api/v2"
1010
fluxsourcev1 "github.com/fluxcd/source-controller/api/v1"
1111

12+
clustersv1alpha1 "github.com/openmcp-project/openmcp-operator/api/clusters/v1alpha1"
13+
1214
dnsv1alpha1 "github.com/openmcp-project/platform-service-dns/api/dns/v1alpha1"
1315
)
1416

@@ -24,6 +26,7 @@ func InstallCRDAPIs(scheme *runtime.Scheme) *runtime.Scheme {
2426
func InstallOperatorAPIsPlatform(scheme *runtime.Scheme) *runtime.Scheme {
2527
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
2628
utilruntime.Must(dnsv1alpha1.AddToScheme(scheme))
29+
utilruntime.Must(clustersv1alpha1.AddToScheme(scheme))
2730
utilruntime.Must(fluxsourcev1.AddToScheme(scheme))
2831
utilruntime.Must(fluxhelmv2.AddToScheme(scheme))
2932

go.mod

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ require (
88
github.com/fluxcd/helm-controller/api v1.3.0
99
github.com/fluxcd/pkg/apis/meta v1.12.0
1010
github.com/fluxcd/source-controller/api v1.6.2
11-
github.com/openmcp-project/controller-utils v0.21.1-0.20250916143313-911636c58c14
11+
github.com/openmcp-project/controller-utils v0.22.0
1212
github.com/openmcp-project/openmcp-operator/api v0.14.0
13-
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250910074108-2166b543cee3
13+
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250918113839-de9cd0290162
1414
github.com/openmcp-project/platform-service-dns/api v0.0.0-00010101000000-000000000000
1515
github.com/spf13/cobra v1.9.1
1616
k8s.io/api v0.34.1
@@ -22,6 +22,7 @@ require (
2222

2323
require (
2424
cel.dev/expr v0.24.0 // indirect
25+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2526
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
2627
github.com/beorn7/perks v1.0.1 // indirect
2728
github.com/blang/semver/v4 v4.0.0 // indirect
@@ -41,11 +42,13 @@ require (
4142
github.com/go-openapi/jsonpointer v0.21.0 // indirect
4243
github.com/go-openapi/jsonreference v0.21.0 // indirect
4344
github.com/go-openapi/swag v0.23.0 // indirect
45+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4446
github.com/gogo/protobuf v1.3.2 // indirect
4547
github.com/google/btree v1.1.3 // indirect
4648
github.com/google/cel-go v0.26.0 // indirect
4749
github.com/google/gnostic-models v0.7.0 // indirect
4850
github.com/google/go-cmp v0.7.0 // indirect
51+
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
4952
github.com/google/uuid v1.6.0 // indirect
5053
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
5154
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -55,6 +58,8 @@ require (
5558
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5659
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
5760
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
61+
github.com/onsi/ginkgo/v2 v2.25.3
62+
github.com/onsi/gomega v1.38.2
5863
github.com/pkg/errors v0.9.1 // indirect
5964
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6065
github.com/prometheus/client_golang v1.22.0 // indirect
@@ -73,6 +78,7 @@ require (
7378
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
7479
go.opentelemetry.io/otel/trace v1.35.0 // indirect
7580
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
81+
go.uber.org/automaxprocs v1.6.0 // indirect
7682
go.uber.org/multierr v1.11.0 // indirect
7783
go.uber.org/zap v1.27.0 // indirect
7884
go.yaml.in/yaml/v2 v2.4.2 // indirect
@@ -85,6 +91,7 @@ require (
8591
golang.org/x/term v0.35.0 // indirect
8692
golang.org/x/text v0.29.0 // indirect
8793
golang.org/x/time v0.10.0 // indirect
94+
golang.org/x/tools v0.37.0 // indirect
8895
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
8996
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
9097
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,19 @@ github.com/onsi/ginkgo/v2 v2.25.3 h1:Ty8+Yi/ayDAGtk4XxmmfUy4GabvM+MegeB4cDLRi6nw
105105
github.com/onsi/ginkgo/v2 v2.25.3/go.mod h1:43uiyQC4Ed2tkOzLsEYm7hnrb7UJTWHYNsuy3bG/snE=
106106
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
107107
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
108-
github.com/openmcp-project/controller-utils v0.21.1-0.20250916143313-911636c58c14 h1:w08DQVsSFxCAbBgmTMGusTdm9sCfrUaaIkPlVijf5u0=
109-
github.com/openmcp-project/controller-utils v0.21.1-0.20250916143313-911636c58c14/go.mod h1:b8VcTK6iXFgkW6pXtIEDbaiQtzqYycVMFmElc7SFBQQ=
108+
github.com/openmcp-project/controller-utils v0.22.0 h1:kdWGds+LOyOaOuKqWZGsJUv17e78HCr5y3bJOMSkdqE=
109+
github.com/openmcp-project/controller-utils v0.22.0/go.mod h1:aIF4lk7agc+yCNRN5Oqg4BLlzRKsGixqwsGmxPoO5ak=
110110
github.com/openmcp-project/openmcp-operator/api v0.14.0 h1:/Ogg13b/IBBmAVQEuFnOKvHuVV3o2DlrQpSQhXca0+g=
111111
github.com/openmcp-project/openmcp-operator/api v0.14.0/go.mod h1:mgckJa59TpgTjta8+BWHwbOxlY1zVasqQTDFQLCs6M8=
112-
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250910074108-2166b543cee3 h1:RJmtE7Iqt8LS2ruGwJed6CqEoVgO1XoPQdDrnDwcaI8=
113-
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250910074108-2166b543cee3/go.mod h1:q3vb/BR9idvd0akkKHsjA5WkR38Lj378F8iFgiOSWs0=
112+
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250918113839-de9cd0290162 h1:eNC5bjGlLBc7Jb9vb6EUmMH0lcyxrstXSX4a9hf6ynI=
113+
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250918113839-de9cd0290162/go.mod h1:p5ekUWhoJyolSkYxGkfqPMLG/cdeiq51G8foU4dMVyQ=
114114
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
115115
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
116116
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
117117
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
118118
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
119+
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
120+
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
119121
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
120122
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
121123
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=

0 commit comments

Comments
 (0)