Skip to content

Commit f36ec85

Browse files
committed
add api nested module with config type
1 parent 20fc943 commit f36ec85

File tree

9 files changed

+481
-4
lines changed

9 files changed

+481
-4
lines changed

Taskfile.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ includes:
66
flatten: true
77
excludes: [] # put task names in here which are overwritten in this file
88
vars:
9-
# NESTED_MODULES: api
10-
# API_DIRS: '{{.ROOT_DIR}}/api/...'
11-
# MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
9+
NESTED_MODULES: api
10+
API_DIRS: '{{.ROOT_DIR}}/api/...'
11+
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
1212
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/...'
1313
COMPONENTS: 'platform-service-dns'
1414
REPO_URL: 'https://github.com/openmcp-project/platform-service-dns'
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.18.0
7+
labels:
8+
openmcp.cloud/cluster: platform
9+
name: dnsserviceconfigs.clusters.openmcp.cloud
10+
spec:
11+
group: clusters.openmcp.cloud
12+
names:
13+
kind: DNSServiceConfig
14+
listKind: DNSServiceConfigList
15+
plural: dnsserviceconfigs
16+
shortNames:
17+
- dnscfg
18+
singular: dnsserviceconfig
19+
scope: Cluster
20+
versions:
21+
- additionalPrinterColumns:
22+
- jsonPath: .status.phase
23+
name: Phase
24+
type: string
25+
name: v1alpha1
26+
schema:
27+
openAPIV3Schema:
28+
description: DNSServiceConfig is the Schema for the DNS PlatformService configuration
29+
API
30+
properties:
31+
apiVersion:
32+
description: |-
33+
APIVersion defines the versioned schema of this representation of an object.
34+
Servers should convert recognized schemas to the latest internal value, and
35+
may reject unrecognized values.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
37+
type: string
38+
kind:
39+
description: |-
40+
Kind is a string value representing the REST resource this object represents.
41+
Servers may infer this from the endpoint the client submits requests to.
42+
Cannot be updated.
43+
In CamelCase.
44+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
45+
type: string
46+
metadata:
47+
type: object
48+
spec:
49+
description: DNSServiceConfigSpec defines the desired state of DNSServiceConfig
50+
type: object
51+
status:
52+
description: DNSServiceConfigStatus defines the observed state of DNSServiceConfig
53+
properties:
54+
conditions:
55+
description: Conditions contains the conditions.
56+
items:
57+
description: Condition contains details for one aspect of the current
58+
state of this API Resource.
59+
properties:
60+
lastTransitionTime:
61+
description: |-
62+
lastTransitionTime is the last time the condition transitioned from one status to another.
63+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
64+
format: date-time
65+
type: string
66+
message:
67+
description: |-
68+
message is a human readable message indicating details about the transition.
69+
This may be an empty string.
70+
maxLength: 32768
71+
type: string
72+
observedGeneration:
73+
description: |-
74+
observedGeneration represents the .metadata.generation that the condition was set based upon.
75+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
76+
with respect to the current state of the instance.
77+
format: int64
78+
minimum: 0
79+
type: integer
80+
reason:
81+
description: |-
82+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
83+
Producers of specific condition types may define expected values and meanings for this field,
84+
and whether the values are considered a guaranteed API.
85+
The value should be a CamelCase string.
86+
This field may not be empty.
87+
maxLength: 1024
88+
minLength: 1
89+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
90+
type: string
91+
status:
92+
description: status of the condition, one of True, False, Unknown.
93+
enum:
94+
- "True"
95+
- "False"
96+
- Unknown
97+
type: string
98+
type:
99+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
100+
maxLength: 316
101+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
102+
type: string
103+
required:
104+
- lastTransitionTime
105+
- message
106+
- reason
107+
- status
108+
- type
109+
type: object
110+
type: array
111+
observedGeneration:
112+
description: ObservedGeneration is the generation of this resource
113+
that was last reconciled by the controller.
114+
format: int64
115+
type: integer
116+
phase:
117+
description: Phase is the current phase of the resource.
118+
type: string
119+
required:
120+
- observedGeneration
121+
- phase
122+
type: object
123+
type: object
124+
selectableFields:
125+
- jsonPath: .spec.profile
126+
served: true
127+
storage: true
128+
subresources:
129+
status: {}

api/dns/v1alpha1/config_types.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
6+
commonapi "github.com/openmcp-project/openmcp-operator/api/common"
7+
)
8+
9+
// DNSServiceConfigSpec defines the desired state of DNSServiceConfig
10+
type DNSServiceConfigSpec struct {
11+
// TODO
12+
}
13+
14+
// DNSServiceConfigStatus defines the observed state of DNSServiceConfig
15+
type DNSServiceConfigStatus struct {
16+
commonapi.Status `json:",inline"`
17+
}
18+
19+
// +kubebuilder:object:root=true
20+
// +kubebuilder:subresource:status
21+
// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform"
22+
// +kubebuilder:selectablefield:JSONPath=".spec.profile"
23+
// +kubebuilder:printcolumn:JSONPath=`.status.phase`,name="Phase",type=string
24+
// +kubebuilder:resource:scope=Cluster,shortName=dnscfg
25+
26+
// DNSServiceConfig is the Schema for the DNS PlatformService configuration API
27+
type DNSServiceConfig struct {
28+
metav1.TypeMeta `json:",inline"`
29+
metav1.ObjectMeta `json:"metadata,omitempty"`
30+
31+
Spec DNSServiceConfigSpec `json:"spec,omitempty"`
32+
Status DNSServiceConfigStatus `json:"status,omitempty"`
33+
}
34+
35+
// +kubebuilder:object:root=true
36+
37+
// DNSServiceConfigList contains a list of DNSServiceConfig
38+
type DNSServiceConfigList struct {
39+
metav1.TypeMeta `json:",inline"`
40+
metav1.ListMeta `json:"metadata,omitempty"`
41+
Items []DNSServiceConfig `json:"items"`
42+
}
43+
44+
func init() {
45+
SchemeBuilder.Register(&DNSServiceConfig{}, &DNSServiceConfigList{})
46+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// +kubebuilder:object:generate=true
2+
// +groupName=clusters.openmcp.cloud
3+
package v1alpha1
4+
5+
import (
6+
"k8s.io/apimachinery/pkg/runtime/schema"
7+
"sigs.k8s.io/controller-runtime/pkg/scheme"
8+
9+
apiconst "github.com/openmcp-project/openmcp-operator/api/constants"
10+
)
11+
12+
const GroupName = "clusters." + apiconst.OpenMCPGroupName
13+
14+
var (
15+
// GroupVersion is group version used to register these objects
16+
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
17+
18+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
19+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
20+
21+
// AddToScheme adds the types in this group-version to the given scheme.
22+
AddToScheme = SchemeBuilder.AddToScheme
23+
)

api/dns/v1alpha1/zz_generated.deepcopy.go

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

api/go.mod

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module github.com/openmcp-project/platform-service-dns/api
2+
3+
go 1.25.1
4+
5+
require (
6+
github.com/openmcp-project/openmcp-operator/api v0.14.0
7+
k8s.io/apiextensions-apiserver v0.34.0
8+
k8s.io/apimachinery v0.34.0
9+
k8s.io/client-go v0.34.0
10+
sigs.k8s.io/controller-runtime v0.22.1
11+
)
12+
13+
require (
14+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
15+
github.com/go-logr/logr v1.4.3 // indirect
16+
github.com/gogo/protobuf v1.3.2 // indirect
17+
github.com/json-iterator/go v1.1.12 // indirect
18+
github.com/kr/text v0.2.0 // indirect
19+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
20+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
21+
github.com/x448/float16 v0.8.4 // indirect
22+
go.yaml.in/yaml/v2 v2.4.2 // indirect
23+
golang.org/x/net v0.43.0 // indirect
24+
golang.org/x/text v0.28.0 // indirect
25+
gopkg.in/inf.v0 v0.9.1 // indirect
26+
k8s.io/api v0.34.0 // indirect
27+
k8s.io/klog/v2 v2.130.1 // indirect
28+
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // indirect
29+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
30+
sigs.k8s.io/randfill v1.0.0 // indirect
31+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
32+
sigs.k8s.io/yaml v1.6.0 // indirect
33+
)

0 commit comments

Comments
 (0)