Skip to content

Commit 210d300

Browse files
committed
kubebuilder
1 parent 7d41571 commit 210d300

26 files changed

+994
-31
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
22
# Ignore build and test binaries.
3-
bin/

.gitignore

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1+
2+
13
# Binaries for programs and plugins
24
*.exe
35
*.exe~
46
*.dll
57
*.so
68
*.dylib
7-
bin/*
9+
bin/
810
Dockerfile.cross
911

10-
# Test binary, built with `go test -c`
12+
# Test binary, build with `go test -c`
1113
*.test
1214

1315
# Output of the go coverage tool, specifically when used with LiteIDE
1416
*.out
1517

16-
# Go workspace file
17-
go.work
18-
1918
# Kubernetes Generated files - skip generated files, except for vendored files
19+
2020
!vendor/**/zz_generated.*
2121

2222
# editor and IDE paraphernalia
@@ -25,3 +25,13 @@ go.work
2525
*.swp
2626
*.swo
2727
*~
28+
29+
tmp/
30+
go.work*
31+
components/
32+
!**/components/
33+
/**/cover.html
34+
/**/cover.*.html
35+
36+
*.tmp
37+
.task/
File renamed without changes.

PROJECT

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,13 @@ layout:
77
- go.kubebuilder.io/v4
88
projectName: openmcp-operator
99
repo: github.com/openmcp-project/openmcp-operator
10+
resources:
11+
- api:
12+
crdVersion: v1
13+
namespaced: true
14+
controller: true
15+
domain: openmcp.cloud
16+
kind: DeployableProvider
17+
path: github.com/openmcp-project/openmcp-operator/api/v1alpha1
18+
version: v1alpha1
1019
version: "3"

Taskfile.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ vars:
99
REPO_URL: 'https://github.com/openmcp-project/openmcp-operator'
1010
GENERATE_DOCS_INDEX: "true"
1111
CHART_COMPONENTS: ""
12+
LINTER_VERSION: "v1.64.4"
1213

1314
includes:
1415
shared:
@@ -24,3 +25,4 @@ includes:
2425
REPO_URL: 'https://github.com/openmcp-project/openmcp-operator'
2526
GENERATE_DOCS_INDEX: "true"
2627
CHART_COMPONENTS: ""
28+
LINTER_VERSION: "v1.64.4"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.17.3
7+
name: deployableproviders.openmcp.cloud
8+
spec:
9+
group: openmcp.cloud
10+
names:
11+
kind: DeployableProvider
12+
listKind: DeployableProviderList
13+
plural: deployableproviders
14+
singular: deployableprovider
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: DeployableProvider is the Schema for the deployableproviders
21+
API.
22+
properties:
23+
apiVersion:
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
29+
type: string
30+
kind:
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
37+
type: string
38+
metadata:
39+
type: object
40+
spec:
41+
description: DeployableProviderSpec defines the desired state of DeployableProvider.
42+
properties:
43+
foo:
44+
description: Foo is an example field of DeployableProvider. Edit deployableprovider_types.go
45+
to remove/update
46+
type: string
47+
type: object
48+
status:
49+
description: DeployableProviderStatus defines the observed state of DeployableProvider.
50+
type: object
51+
type: object
52+
served: true
53+
storage: true
54+
subresources:
55+
status: {}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// DeployableProviderSpec defines the desired state of DeployableProvider.
27+
type DeployableProviderSpec struct {
28+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29+
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of DeployableProvider. Edit deployableprovider_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
33+
}
34+
35+
// DeployableProviderStatus defines the observed state of DeployableProvider.
36+
type DeployableProviderStatus struct {
37+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
38+
// Important: Run "make" to regenerate code after modifying this file
39+
}
40+
41+
// +kubebuilder:object:root=true
42+
// +kubebuilder:subresource:status
43+
44+
// DeployableProvider is the Schema for the deployableproviders API.
45+
type DeployableProvider struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec DeployableProviderSpec `json:"spec,omitempty"`
50+
Status DeployableProviderStatus `json:"status,omitempty"`
51+
}
52+
53+
// +kubebuilder:object:root=true
54+
55+
// DeployableProviderList contains a list of DeployableProvider.
56+
type DeployableProviderList struct {
57+
metav1.TypeMeta `json:",inline"`
58+
metav1.ListMeta `json:"metadata,omitempty"`
59+
Items []DeployableProvider `json:"items"`
60+
}
61+
62+
func init() {
63+
SchemeBuilder.Register(&DeployableProvider{}, &DeployableProviderList{})
64+
}

api/v1alpha1/groupversion_info.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API Schema definitions for the v1alpha1 API group.
18+
// +kubebuilder:object:generate=true
19+
// +groupName=openmcp.cloud
20+
package v1alpha1
21+
22+
import (
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
"sigs.k8s.io/controller-runtime/pkg/scheme"
25+
)
26+
27+
var (
28+
// GroupVersion is group version used to register these objects.
29+
GroupVersion = schema.GroupVersion{Group: "openmcp.cloud", Version: "v1alpha1"}
30+
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
32+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
33+
34+
// AddToScheme adds the types in this group-version to the given scheme.
35+
AddToScheme = SchemeBuilder.AddToScheme
36+
)

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ import (
3636
"sigs.k8s.io/controller-runtime/pkg/metrics/filters"
3737
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3838
"sigs.k8s.io/controller-runtime/pkg/webhook"
39+
40+
openmcpcloudv1alpha1 "github.com/openmcp-project/openmcp-operator/api/v1alpha1"
41+
"github.com/openmcp-project/openmcp-operator/internal/controller"
3942
// +kubebuilder:scaffold:imports
4043
)
4144

@@ -47,6 +50,7 @@ var (
4750
func init() {
4851
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
4952

53+
utilruntime.Must(openmcpcloudv1alpha1.AddToScheme(scheme))
5054
// +kubebuilder:scaffold:scheme
5155
}
5256

@@ -198,6 +202,13 @@ func main() {
198202
os.Exit(1)
199203
}
200204

205+
if err = (&controller.DeployableProviderReconciler{
206+
Client: mgr.GetClient(),
207+
Scheme: mgr.GetScheme(),
208+
}).SetupWithManager(mgr); err != nil {
209+
setupLog.Error(err, "unable to create controller", "controller", "DeployableProvider")
210+
os.Exit(1)
211+
}
201212
// +kubebuilder:scaffold:builder
202213

203214
if metricsCertWatcher != nil {

0 commit comments

Comments
 (0)