Skip to content

Commit c214566

Browse files
committed
controller implementation continued (still unfinished)
1 parent 4412651 commit c214566

File tree

9 files changed

+948
-69
lines changed

9 files changed

+948
-69
lines changed

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

Lines changed: 572 additions & 3 deletions
Large diffs are not rendered by default.

api/dns/v1alpha1/config_types.go

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import (
44
"slices"
55

66
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7+
"k8s.io/apimachinery/pkg/runtime"
8+
9+
fluxv1 "github.com/fluxcd/source-controller/api/v1"
10+
11+
commonapi "github.com/openmcp-project/openmcp-operator/api/common"
712
)
813

914
// DNSServiceConfigSpec defines the desired state of DNSServiceConfig
@@ -13,13 +18,34 @@ type DNSServiceConfigSpec struct {
1318
// +optional
1419
Selector *metav1.LabelSelector `json:"selector,omitempty"`
1520

21+
// ExternalDNSSource is the source of the external-dns helm chart.
22+
ExternalDNSSource ExternalDNSSource `json:"externalDNSSource"`
23+
1624
// ExternalDNSForPurposes is a list of DNS configurations in combination with purpose selectors.
1725
// The first matching purpose selector will be applied to the Cluster.
1826
// If no selector matches, no configuration will be applied.
1927
// +optional
2028
ExternalDNSForPurposes []ExternalDNSPurposeConfig `json:"externalDNSForPurposes,omitempty"`
2129
}
2230

31+
// ExternalDNSSource defines the source of the external-dns helm chart in form of a Flux source.
32+
// Exactly one of 'HelmRepository', 'GitRepository' or 'OCIRepository' must be set.
33+
// If 'copyAuthSecret' is set, the referenced source secret is copied into the namespace where the Flux resources are created with the specified target name.
34+
// +kubebuilder:validation:XValidation:rule=`size(self.filter(property, (property != "copyAuthSecret") && (size(self[property]) > 0))) == 1`, message="Exactly one of 'helm', 'git', or 'oci' must be set"
35+
type ExternalDNSSource struct {
36+
Helm *fluxv1.HelmRepositorySpec `json:"helm,omitempty"`
37+
Git *fluxv1.GitRepositorySpec `json:"git,omitempty"`
38+
OCI *fluxv1.OCIRepositorySpec `json:"oci,omitempty"`
39+
CopyAuthSecret *SecretCopy `json:"copyAuthSecret,omitempty"`
40+
}
41+
42+
// SecretCopy defines the name of the secret to copy and the name of the copied secret.
43+
// If target is nil or target.name is empty, the secret will be copied with the same name as the source secret.
44+
type SecretCopy struct {
45+
Source commonapi.ObjectReference `json:"source"`
46+
Target *commonapi.ObjectReference `json:"target"`
47+
}
48+
2349
// ExternalDNSPurposeConfig holds a purpose selector and the DNS configuration to apply if the selector matches.
2450
type ExternalDNSPurposeConfig struct {
2551
// Name is an optional name.
@@ -30,8 +56,9 @@ type ExternalDNSPurposeConfig struct {
3056
// If not set, all Clusters are matched.
3157
// +optional
3258
PurposeSelector *PurposeSelector `json:"purposeSelector,omitempty"`
33-
// Config is the DNS configuration to apply if the selector matches.
34-
Config ExternalDNSConfig `json:"config"`
59+
// HelmValues are the helm values to deploy external-dns with, if the purpose selector matches.
60+
// +kubebuilder:validation:Schemaless
61+
HelmValues runtime.RawExtension `json:"config"`
3562
}
3663

3764
// PurposeSelector is a selector to match against the list of purposes of a Cluster.
@@ -54,10 +81,6 @@ type PurposeSelectorRequirement struct {
5481
Name string `json:"name,omitempty"`
5582
}
5683

57-
type ExternalDNSConfig struct {
58-
// TODO
59-
}
60-
6184
// +kubebuilder:object:root=true
6285
// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform"
6386
// +kubebuilder:resource:scope=Cluster,shortName=dnscfg

api/dns/v1alpha1/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ import (
66

77
const (
88
OperationAnnotation = "dns." + openmcpconst.OperationAnnotation
9+
10+
ExternalDNSFinalizerOnCluster = "platformservice." + openmcpconst.OpenMCPGroupName + "/dns"
911
)

api/dns/v1alpha1/zz_generated.deepcopy.go

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

api/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/openmcp-project/platform-service-dns/api
33
go 1.25.1
44

55
require (
6+
github.com/fluxcd/source-controller/api v1.6.2
67
github.com/openmcp-project/openmcp-operator/api v0.14.0
78
k8s.io/apiextensions-apiserver v0.34.0
89
k8s.io/apimachinery v0.34.0
@@ -11,6 +12,8 @@ require (
1112
)
1213

1314
require (
15+
github.com/fluxcd/pkg/apis/acl v0.7.0 // indirect
16+
github.com/fluxcd/pkg/apis/meta v1.12.0 // indirect
1417
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
1518
github.com/go-logr/logr v1.4.3 // indirect
1619
github.com/gogo/protobuf v1.3.2 // indirect

api/go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/fluxcd/pkg/apis/acl v0.7.0 h1:dMhZJH+g6ZRPjs4zVOAN9vHBd1DcavFgcIFkg5ooOE0=
7+
github.com/fluxcd/pkg/apis/acl v0.7.0/go.mod h1:uv7pXXR/gydiX4MUwlQa7vS8JONEDztynnjTvY3JxKQ=
8+
github.com/fluxcd/pkg/apis/meta v1.12.0 h1:XW15TKZieC2b7MN8VS85stqZJOx+/b8jATQ/xTUhVYg=
9+
github.com/fluxcd/pkg/apis/meta v1.12.0/go.mod h1:+son1Va60x2eiDcTwd7lcctbI6C+K3gM7R+ULmEq1SI=
10+
github.com/fluxcd/source-controller/api v1.6.2 h1:UmodAeqLIeF29HdTqf2GiacZyO+hJydJlepDaYsMvhc=
11+
github.com/fluxcd/source-controller/api v1.6.2/go.mod h1:ZJcAi0nemsnBxjVgmJl0WQzNvB0rMETxQMTdoFosmMw=
612
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
713
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
814
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.25.1
55
replace github.com/openmcp-project/platform-service-dns/api => ./api
66

77
require (
8+
github.com/fluxcd/source-controller/api v1.6.2
89
github.com/openmcp-project/controller-utils v0.19.0
910
github.com/openmcp-project/openmcp-operator/api v0.14.0
1011
github.com/openmcp-project/openmcp-operator/lib v0.14.1-0.20250910074108-2166b543cee3
@@ -28,6 +29,8 @@ require (
2829
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
2930
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
3031
github.com/felixge/httpsnoop v1.0.4 // indirect
32+
github.com/fluxcd/pkg/apis/acl v0.7.0 // indirect
33+
github.com/fluxcd/pkg/apis/meta v1.12.0 // indirect
3134
github.com/fsnotify/fsnotify v1.9.0 // indirect
3235
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
3336
github.com/go-logr/logr v1.4.3 // indirect

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjT
2525
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
2626
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
2727
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
28+
github.com/fluxcd/pkg/apis/acl v0.7.0 h1:dMhZJH+g6ZRPjs4zVOAN9vHBd1DcavFgcIFkg5ooOE0=
29+
github.com/fluxcd/pkg/apis/acl v0.7.0/go.mod h1:uv7pXXR/gydiX4MUwlQa7vS8JONEDztynnjTvY3JxKQ=
30+
github.com/fluxcd/pkg/apis/meta v1.12.0 h1:XW15TKZieC2b7MN8VS85stqZJOx+/b8jATQ/xTUhVYg=
31+
github.com/fluxcd/pkg/apis/meta v1.12.0/go.mod h1:+son1Va60x2eiDcTwd7lcctbI6C+K3gM7R+ULmEq1SI=
32+
github.com/fluxcd/source-controller/api v1.6.2 h1:UmodAeqLIeF29HdTqf2GiacZyO+hJydJlepDaYsMvhc=
33+
github.com/fluxcd/source-controller/api v1.6.2/go.mod h1:ZJcAi0nemsnBxjVgmJl0WQzNvB0rMETxQMTdoFosmMw=
2834
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
2935
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
3036
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=

0 commit comments

Comments
 (0)