Skip to content

Commit 2c9020f

Browse files
committed
provider controller
1 parent b6b6d95 commit 2c9020f

14 files changed

+654
-182
lines changed

PROJECT

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ layout:
88
projectName: openmcp-operator
99
repo: github.com/openmcp-project/openmcp-operator
1010
resources:
11+
- api:
12+
crdVersion: v1
13+
domain: openmcp.cloud
14+
kind: ClusterProvider
15+
path: github.com/openmcp-project/openmcp-operator/api/v1alpha1
16+
version: v1alpha1
17+
- api:
18+
crdVersion: v1
19+
domain: openmcp.cloud
20+
kind: ServiceProvider
21+
path: github.com/openmcp-project/openmcp-operator/api/v1alpha1
22+
version: v1alpha1
23+
- api:
24+
crdVersion: v1
25+
domain: openmcp.cloud
26+
kind: PlatformService
27+
path: github.com/openmcp-project/openmcp-operator/api/v1alpha1
28+
version: v1alpha1
1129
- api:
1230
crdVersion: v1
1331
namespaced: true

api/crds/manifests/openmcp.cloud_deployableproviders.yaml renamed to api/crds/manifests/openmcp.cloud_clusterproviders.yaml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.17.3
7-
name: deployableproviders.openmcp.cloud
7+
name: clusterproviders.openmcp.cloud
88
spec:
99
group: openmcp.cloud
1010
names:
11-
kind: DeployableProvider
12-
listKind: DeployableProviderList
13-
plural: deployableproviders
14-
singular: deployableprovider
15-
scope: Namespaced
11+
kind: ClusterProvider
12+
listKind: ClusterProviderList
13+
plural: clusterproviders
14+
singular: clusterprovider
15+
scope: Cluster
1616
versions:
1717
- name: v1alpha1
1818
schema:
1919
openAPIV3Schema:
20-
description: DeployableProvider is the Schema for the deployableproviders
21-
API.
20+
description: ClusterProvider is the Schema for the clusterproviders API.
2221
properties:
2322
apiVersion:
2423
description: |-
@@ -38,32 +37,31 @@ spec:
3837
metadata:
3938
type: object
4039
spec:
41-
description: DeployableProviderSpec defines the desired state of DeployableProvider.
40+
description: DeploymentSpec defines the desired state of a provider.
4241
properties:
43-
deploymentSpec:
44-
description: DeployableSpec defines the desired state of DeployableProvider.
45-
properties:
46-
image:
47-
description: Image is the image of the provider to be deployed.
48-
type: string
49-
imagePullPolicy:
50-
type: string
51-
imagePullSecrets:
52-
items:
53-
type: string
54-
type: array
55-
type: object
56-
foo:
57-
description: Foo is an example field of DeployableProvider. Edit deployableprovider_types.go
58-
to remove/update
42+
image:
43+
description: Image is the name of the image of a provider.
44+
minLength: 1
5945
type: string
46+
imagePullSecrets:
47+
description: |-
48+
ImagePullSecrets are secrets in the same namespace.
49+
They can be used to fetch provider images from private registries.
50+
items:
51+
properties:
52+
name:
53+
description: Name is the name of the referenced resource.
54+
minLength: 1
55+
type: string
56+
required:
57+
- name
58+
type: object
59+
type: array
60+
required:
61+
- image
6062
type: object
6163
status:
62-
description: DeployableProviderStatus defines the observed state of DeployableProvider.
63-
properties:
64-
deploymentStatus:
65-
description: DeployableStatus defines the observed state of DeployableProvider.
66-
type: object
64+
description: DeploymentStatus defines the observed state of a provider.
6765
type: object
6866
type: object
6967
served: true
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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: platformservices.openmcp.cloud
8+
spec:
9+
group: openmcp.cloud
10+
names:
11+
kind: PlatformService
12+
listKind: PlatformServiceList
13+
plural: platformservices
14+
singular: platformservice
15+
scope: Cluster
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: PlatformService is the Schema for the platformservices API.
21+
properties:
22+
apiVersion:
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
28+
type: string
29+
kind:
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: DeploymentSpec defines the desired state of a provider.
41+
properties:
42+
image:
43+
description: Image is the name of the image of a provider.
44+
minLength: 1
45+
type: string
46+
imagePullSecrets:
47+
description: |-
48+
ImagePullSecrets are secrets in the same namespace.
49+
They can be used to fetch provider images from private registries.
50+
items:
51+
properties:
52+
name:
53+
description: Name is the name of the referenced resource.
54+
minLength: 1
55+
type: string
56+
required:
57+
- name
58+
type: object
59+
type: array
60+
required:
61+
- image
62+
type: object
63+
status:
64+
description: DeploymentStatus defines the observed state of a provider.
65+
type: object
66+
type: object
67+
served: true
68+
storage: true
69+
subresources:
70+
status: {}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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: serviceproviders.openmcp.cloud
8+
spec:
9+
group: openmcp.cloud
10+
names:
11+
kind: ServiceProvider
12+
listKind: ServiceProviderList
13+
plural: serviceproviders
14+
singular: serviceprovider
15+
scope: Cluster
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: ServiceProvider is the Schema for the serviceproviders API.
21+
properties:
22+
apiVersion:
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
28+
type: string
29+
kind:
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: DeploymentSpec defines the desired state of a provider.
41+
properties:
42+
image:
43+
description: Image is the name of the image of a provider.
44+
minLength: 1
45+
type: string
46+
imagePullSecrets:
47+
description: |-
48+
ImagePullSecrets are secrets in the same namespace.
49+
They can be used to fetch provider images from private registries.
50+
items:
51+
properties:
52+
name:
53+
description: Name is the name of the referenced resource.
54+
minLength: 1
55+
type: string
56+
required:
57+
- name
58+
type: object
59+
type: array
60+
required:
61+
- image
62+
type: object
63+
status:
64+
description: DeploymentStatus defines the observed state of a provider.
65+
type: object
66+
type: object
67+
served: true
68+
storage: true
69+
subresources:
70+
status: {}

api/v1alpha1/deployableprovider_types.go renamed to api/v1alpha1/clusterprovider_types.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,52 @@ package v1alpha1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
"k8s.io/apimachinery/pkg/runtime/schema"
2122
)
2223

2324
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2425
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2526

26-
// DeployableProviderSpec defines the desired state of DeployableProvider.
27-
type DeployableProviderSpec struct {
27+
// ClusterProviderSpec defines the desired state of ClusterProvider.
28+
type ClusterProviderSpec struct {
2829
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2930
// Important: Run "make" to regenerate code after modifying this file
3031

31-
DeploymentSpec DeployableSpec `json:"deploymentSpec,omitempty"`
32-
33-
// Foo is an example field of DeployableProvider. Edit deployableprovider_types.go to remove/update
32+
// Foo is an example field of ClusterProvider. Edit clusterprovider_types.go to remove/update
3433
Foo string `json:"foo,omitempty"`
3534
}
3635

37-
// DeployableProviderStatus defines the observed state of DeployableProvider.
38-
type DeployableProviderStatus struct {
36+
// ClusterProviderStatus defines the observed state of ClusterProvider.
37+
type ClusterProviderStatus struct {
3938
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
4039
// Important: Run "make" to regenerate code after modifying this file
41-
42-
DeploymentStatus DeployableStatus `json:"deploymentStatus,omitempty"`
4340
}
4441

4542
// +kubebuilder:object:root=true
4643
// +kubebuilder:subresource:status
44+
// +kubebuilder:resource:scope=Cluster
4745

48-
// DeployableProvider is the Schema for the deployableproviders API.
49-
type DeployableProvider struct {
46+
// ClusterProvider is the Schema for the clusterproviders API.
47+
type ClusterProvider struct {
5048
metav1.TypeMeta `json:",inline"`
5149
metav1.ObjectMeta `json:"metadata,omitempty"`
52-
53-
Spec DeployableProviderSpec `json:"spec,omitempty"`
54-
Status DeployableProviderStatus `json:"status,omitempty"`
50+
Spec DeploymentSpec `json:"spec,omitempty"`
51+
Status DeploymentStatus `json:"status,omitempty"`
5552
}
5653

5754
// +kubebuilder:object:root=true
5855

59-
// DeployableProviderList contains a list of DeployableProvider.
60-
type DeployableProviderList struct {
56+
// ClusterProviderList contains a list of ClusterProvider.
57+
type ClusterProviderList struct {
6158
metav1.TypeMeta `json:",inline"`
6259
metav1.ListMeta `json:"metadata,omitempty"`
63-
Items []DeployableProvider `json:"items"`
60+
Items []ClusterProvider `json:"items"`
6461
}
6562

6663
func init() {
67-
SchemeBuilder.Register(&DeployableProvider{}, &DeployableProviderList{})
64+
SchemeBuilder.Register(&ClusterProvider{}, &ClusterProviderList{})
65+
}
66+
67+
func ClusterProviderGKV() schema.GroupVersionKind {
68+
return GroupVersion.WithKind("ClusterProvider")
6869
}

api/v1alpha1/deployable_types.go renamed to api/v1alpha1/deployment_types.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@ package v1alpha1
1919
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2020
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2121

22-
// DeployableSpec defines the desired state of DeployableProvider.
23-
type DeployableSpec struct {
24-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
25-
// Important: Run "make" to regenerate code after modifying this file
26-
27-
// Image is the image of the provider to be deployed.
28-
Image string `json:"image,omitempty"`
29-
ImagePullSecrets []string `json:"imagePullSecrets,omitempty"`
30-
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
22+
// DeploymentSpec defines the desired state of a provider.
23+
type DeploymentSpec struct {
24+
// Image is the name of the image of a provider.
25+
// +kubebuilder:validation:MinLength=1
26+
Image string `json:"image"`
27+
28+
// ImagePullSecrets are secrets in the same namespace.
29+
// They can be used to fetch provider images from private registries.
30+
ImagePullSecrets []ObjectReference `json:"imagePullSecrets,omitempty"`
3131
}
3232

33-
// DeployableStatus defines the observed state of DeployableProvider.
34-
type DeployableStatus struct {
33+
// DeploymentStatus defines the observed state of a provider.
34+
type DeploymentStatus struct {
3535
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
3636
// Important: Run "make" to regenerate code after modifying this file
3737
}
38+
39+
type ObjectReference struct {
40+
// Name is the name of the referenced resource.
41+
// +kubebuilder:validation:MinLength=1
42+
Name string `json:"name"`
43+
}

0 commit comments

Comments
 (0)