Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 3acfb17

Browse files
committed
Generate Template resources
1 parent f1daad8 commit 3acfb17

21 files changed

+776
-73
lines changed

PROJECT

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,20 @@ resources:
2626
kind: ScalewayMachine
2727
path: github.com/Tomy2e/cluster-api-provider-scaleway/api/v1beta1
2828
version: v1beta1
29+
- api:
30+
crdVersion: v1
31+
namespaced: true
32+
domain: cluster.x-k8s.io
33+
group: infrastructure
34+
kind: ScalewayClusterTemplate
35+
path: github.com/Tomy2e/cluster-api-provider-scaleway/api/v1beta1
36+
version: v1beta1
37+
- api:
38+
crdVersion: v1
39+
namespaced: true
40+
domain: cluster.x-k8s.io
41+
group: infrastructure
42+
kind: ScalewayMachineTemplate
43+
path: github.com/Tomy2e/cluster-api-provider-scaleway/api/v1beta1
44+
version: v1beta1
2945
version: "3"

api/v1beta1/scalewaycluster_types.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,17 @@ package v1beta1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
56
)
67

7-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
8-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
9-
108
// ScalewayClusterSpec defines the desired state of ScalewayCluster
119
type ScalewayClusterSpec struct {
12-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
13-
// Important: Run "make" to regenerate code after modifying this file
14-
15-
// Foo is an example field of ScalewayCluster. Edit scalewaycluster_types.go to remove/update
16-
Foo string `json:"foo,omitempty"`
10+
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
1711
}
1812

1913
// ScalewayClusterStatus defines the observed state of ScalewayCluster
2014
type ScalewayClusterStatus struct {
21-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
22-
// Important: Run "make" to regenerate code after modifying this file
15+
Ready bool `json:"ready"`
2316
}
2417

2518
//+kubebuilder:object:root=true
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package v1beta1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
type ScalewayClusterTemplateSpec struct {
8+
Template ScalewayClusterTemplateResource `json:"template"`
9+
}
10+
11+
//+kubebuilder:object:root=true
12+
//+kubebuilder:resource:path=scalewayclustertemplates,scope=Namespaced,categories=cluster-api,shortName=sct
13+
//+kubebuilder:storageversion
14+
15+
// ScalewayClusterTemplate is the Schema for the scalewayclustertemplates API
16+
type ScalewayClusterTemplate struct {
17+
metav1.TypeMeta `json:",inline"`
18+
metav1.ObjectMeta `json:"metadata,omitempty"`
19+
20+
Spec ScalewayClusterTemplateSpec `json:"spec,omitempty"`
21+
}
22+
23+
type ScalewayClusterTemplateResource struct {
24+
// Standard object's metadata.
25+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
26+
// +optional
27+
ObjectMeta metav1.ObjectMeta `json:"metadata,omitempty"`
28+
Spec ScalewayClusterSpec `json:"spec"`
29+
}
30+
31+
//+kubebuilder:object:root=true
32+
33+
// ScalewayClusterTemplateList contains a list of ScalewayClusterTemplate
34+
type ScalewayClusterTemplateList struct {
35+
metav1.TypeMeta `json:",inline"`
36+
metav1.ListMeta `json:"metadata,omitempty"`
37+
Items []ScalewayClusterTemplate `json:"items"`
38+
}
39+
40+
func init() {
41+
SchemeBuilder.Register(&ScalewayClusterTemplate{}, &ScalewayClusterTemplateList{})
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package v1beta1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// ScalewayMachineTemplateSpec defines the desired state of ScalewayMachineTemplate
8+
type ScalewayMachineTemplateSpec struct {
9+
Template ScalewayMachineTemplateResource `json:"template"`
10+
}
11+
12+
//+kubebuilder:object:root=true
13+
//+kubebuilder:resource:path=scalewaymachinetemplates,scope=Namespaced,categories=cluster-api,shortName=smt
14+
//+kubebuilder:storageversion
15+
16+
// ScalewayMachineTemplate is the Schema for the scalewaymachinetemplates API
17+
type ScalewayMachineTemplate struct {
18+
metav1.TypeMeta `json:",inline"`
19+
metav1.ObjectMeta `json:"metadata,omitempty"`
20+
21+
Spec ScalewayMachineTemplateSpec `json:"spec,omitempty"`
22+
}
23+
24+
type ScalewayMachineTemplateResource struct {
25+
// Standard object's metadata.
26+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
27+
// +optional
28+
ObjectMeta metav1.ObjectMeta `json:"metadata,omitempty"`
29+
Spec ScalewayMachineSpec `json:"spec"`
30+
}
31+
32+
//+kubebuilder:object:root=true
33+
34+
// ScalewayMachineTemplateList contains a list of ScalewayMachineTemplate
35+
type ScalewayMachineTemplateList struct {
36+
metav1.TypeMeta `json:",inline"`
37+
metav1.ListMeta `json:"metadata,omitempty"`
38+
Items []ScalewayMachineTemplate `json:"items"`
39+
}
40+
41+
func init() {
42+
SchemeBuilder.Register(&ScalewayMachineTemplate{}, &ScalewayMachineTemplateList{})
43+
}

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/infrastructure.cluster.x-k8s.io_scalewayclusters.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,30 @@ spec:
3535
spec:
3636
description: ScalewayClusterSpec defines the desired state of ScalewayCluster
3737
properties:
38-
foo:
39-
description: Foo is an example field of ScalewayCluster. Edit scalewaycluster_types.go
40-
to remove/update
41-
type: string
38+
controlPlaneEndpoint:
39+
description: APIEndpoint represents a reachable Kubernetes API endpoint.
40+
properties:
41+
host:
42+
description: The hostname on which the API server is serving.
43+
type: string
44+
port:
45+
description: The port on which the API server is serving.
46+
format: int32
47+
type: integer
48+
required:
49+
- host
50+
- port
51+
type: object
52+
required:
53+
- controlPlaneEndpoint
4254
type: object
4355
status:
4456
description: ScalewayClusterStatus defines the observed state of ScalewayCluster
57+
properties:
58+
ready:
59+
type: boolean
60+
required:
61+
- ready
4562
type: object
4663
type: object
4764
served: true

0 commit comments

Comments
 (0)