Skip to content

Commit ef88319

Browse files
committed
Initial scafolding of cyborg controllers and crds
Using operator-sdk command: operator-sdk create api --group cyborg --version v1beta1 --kind Cyborg --resource --controller operator-sdk create api --group cyborg --version v1beta1 --kind CyborgAPI --resource --controller operator-sdk create api --group cyborg --version v1beta1 --kind CyborgConductor --resource --controller Signed-off-by: Alfredo Moralejo <amoralej@redhat.com>
1 parent 13c7e53 commit ef88319

33 files changed

Lines changed: 1432 additions & 0 deletions

PROJECT

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,31 @@ resources:
129129
defaulting: true
130130
validation: true
131131
webhookVersion: v1
132+
- api:
133+
crdVersion: v1
134+
namespaced: true
135+
controller: true
136+
domain: openstack.org
137+
group: cyborg
138+
kind: Cyborg
139+
path: github.com/openstack-k8s-operators/nova-operator/api/cyborg/v1beta1
140+
version: v1beta1
141+
- api:
142+
crdVersion: v1
143+
namespaced: true
144+
controller: true
145+
domain: openstack.org
146+
group: cyborg
147+
kind: CyborgAPI
148+
path: github.com/openstack-k8s-operators/nova-operator/api/cyborg/v1beta1
149+
version: v1beta1
150+
- api:
151+
crdVersion: v1
152+
namespaced: true
153+
controller: true
154+
domain: openstack.org
155+
group: cyborg
156+
kind: CyborgConductor
157+
path: github.com/openstack-k8s-operators/nova-operator/api/cyborg/v1beta1
158+
version: v1beta1
132159
version: "3"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.18.0
7+
name: cyborgapis.cyborg.openstack.org
8+
spec:
9+
group: cyborg.openstack.org
10+
names:
11+
kind: CyborgAPI
12+
listKind: CyborgAPIList
13+
plural: cyborgapis
14+
singular: cyborgapi
15+
scope: Namespaced
16+
versions:
17+
- name: v1beta1
18+
schema:
19+
openAPIV3Schema:
20+
description: CyborgAPI is the Schema for the cyborgapis 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: CyborgAPISpec defines the desired state of CyborgAPI.
41+
properties:
42+
foo:
43+
description: Foo is an example field of CyborgAPI. Edit cyborgapi_types.go
44+
to remove/update
45+
type: string
46+
type: object
47+
status:
48+
description: CyborgAPIStatus defines the observed state of CyborgAPI.
49+
type: object
50+
type: object
51+
served: true
52+
storage: true
53+
subresources:
54+
status: {}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.18.0
7+
name: cyborgconductors.cyborg.openstack.org
8+
spec:
9+
group: cyborg.openstack.org
10+
names:
11+
kind: CyborgConductor
12+
listKind: CyborgConductorList
13+
plural: cyborgconductors
14+
singular: cyborgconductor
15+
scope: Namespaced
16+
versions:
17+
- name: v1beta1
18+
schema:
19+
openAPIV3Schema:
20+
description: CyborgConductor is the Schema for the cyborgconductors 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: CyborgConductorSpec defines the desired state of CyborgConductor.
41+
properties:
42+
foo:
43+
description: Foo is an example field of CyborgConductor. Edit cyborgconductor_types.go
44+
to remove/update
45+
type: string
46+
type: object
47+
status:
48+
description: CyborgConductorStatus defines the observed state of CyborgConductor.
49+
type: object
50+
type: object
51+
served: true
52+
storage: true
53+
subresources:
54+
status: {}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.18.0
7+
name: cyborgs.cyborg.openstack.org
8+
spec:
9+
group: cyborg.openstack.org
10+
names:
11+
kind: Cyborg
12+
listKind: CyborgList
13+
plural: cyborgs
14+
singular: cyborg
15+
scope: Namespaced
16+
versions:
17+
- name: v1beta1
18+
schema:
19+
openAPIV3Schema:
20+
description: Cyborg is the Schema for the cyborgs 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: CyborgSpec defines the desired state of Cyborg.
41+
properties:
42+
foo:
43+
description: Foo is an example field of Cyborg. Edit cyborg_types.go
44+
to remove/update
45+
type: string
46+
type: object
47+
status:
48+
description: CyborgStatus defines the observed state of Cyborg.
49+
type: object
50+
type: object
51+
served: true
52+
storage: true
53+
subresources:
54+
status: {}

api/cyborg/v1beta1/cyborg_types.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Copyright 2022.
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 v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// CyborgSpec defines the desired state of Cyborg.
24+
type CyborgSpec struct {
25+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
26+
// Important: Run "make" to regenerate code after modifying this file
27+
28+
// Foo is an example field of Cyborg. Edit cyborg_types.go to remove/update
29+
Foo string `json:"foo,omitempty"`
30+
}
31+
32+
// CyborgStatus defines the observed state of Cyborg.
33+
type CyborgStatus struct {
34+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
35+
// Important: Run "make" to regenerate code after modifying this file
36+
}
37+
38+
// +kubebuilder:object:root=true
39+
// +kubebuilder:subresource:status
40+
41+
// Cyborg is the Schema for the cyborgs API.
42+
type Cyborg struct {
43+
metav1.TypeMeta `json:",inline"`
44+
metav1.ObjectMeta `json:"metadata,omitempty"`
45+
46+
Spec CyborgSpec `json:"spec,omitempty"`
47+
Status CyborgStatus `json:"status,omitempty"`
48+
}
49+
50+
// +kubebuilder:object:root=true
51+
52+
// CyborgList contains a list of Cyborg.
53+
type CyborgList struct {
54+
metav1.TypeMeta `json:",inline"`
55+
metav1.ListMeta `json:"metadata,omitempty"`
56+
Items []Cyborg `json:"items"`
57+
}
58+
59+
func init() {
60+
SchemeBuilder.Register(&Cyborg{}, &CyborgList{})
61+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright 2022.
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 v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// CyborgAPISpec defines the desired state of CyborgAPI.
24+
type CyborgAPISpec struct {
25+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
26+
// Important: Run "make" to regenerate code after modifying this file
27+
28+
// Foo is an example field of CyborgAPI. Edit cyborgapi_types.go to remove/update
29+
Foo string `json:"foo,omitempty"`
30+
}
31+
32+
// CyborgAPIStatus defines the observed state of CyborgAPI.
33+
type CyborgAPIStatus struct {
34+
}
35+
36+
// +kubebuilder:object:root=true
37+
// +kubebuilder:subresource:status
38+
39+
// CyborgAPI is the Schema for the cyborgapis API.
40+
type CyborgAPI struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
44+
Spec CyborgAPISpec `json:"spec,omitempty"`
45+
Status CyborgAPIStatus `json:"status,omitempty"`
46+
}
47+
48+
// +kubebuilder:object:root=true
49+
50+
// CyborgAPIList contains a list of CyborgAPI.
51+
type CyborgAPIList struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ListMeta `json:"metadata,omitempty"`
54+
Items []CyborgAPI `json:"items"`
55+
}
56+
57+
func init() {
58+
SchemeBuilder.Register(&CyborgAPI{}, &CyborgAPIList{})
59+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2022.
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 v1beta1
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+
// CyborgConductorSpec defines the desired state of CyborgConductor.
27+
type CyborgConductorSpec 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 CyborgConductor. Edit cyborgconductor_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
33+
}
34+
35+
// CyborgConductorStatus defines the observed state of CyborgConductor.
36+
type CyborgConductorStatus 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+
// CyborgConductor is the Schema for the cyborgconductors API.
45+
type CyborgConductor struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec CyborgConductorSpec `json:"spec,omitempty"`
50+
Status CyborgConductorStatus `json:"status,omitempty"`
51+
}
52+
53+
// +kubebuilder:object:root=true
54+
55+
// CyborgConductorList contains a list of CyborgConductor.
56+
type CyborgConductorList struct {
57+
metav1.TypeMeta `json:",inline"`
58+
metav1.ListMeta `json:"metadata,omitempty"`
59+
Items []CyborgConductor `json:"items"`
60+
}
61+
62+
func init() {
63+
SchemeBuilder.Register(&CyborgConductor{}, &CyborgConductorList{})
64+
}

0 commit comments

Comments
 (0)