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

Commit 2f87fdf

Browse files
committed
Implement ScalewayCluster and ScalewayMachine controllers
1 parent 3acfb17 commit 2f87fdf

27 files changed

+1832
-59
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# cluster-api-provider-scaleway
2-
// TODO(user): Add simple overview of use/purpose
2+
3+
⚠ This is currently a proof-of-concept. Do NOT use in production! ⚠
4+
5+
As this is still an early release, the current API is NOT guaranteed to be stable.
6+
Things will break in the first releases, be prepared for it.
7+
8+
Do not hesitate to contribute by opening issues/pull requests.
39

410
## Description
511
// TODO(user): An in-depth paragraph about your project and overview of use

api/v1beta1/scalewaycluster_types.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,56 @@ import (
55
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
66
)
77

8+
const ClusterFinalizer = "scalewaycluster.infrastructure.cluster.x-k8s.io"
9+
810
// ScalewayClusterSpec defines the desired state of ScalewayCluster
911
type ScalewayClusterSpec struct {
12+
// +optional
1013
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
14+
15+
// TODO: enforce immutable field(s)
16+
17+
FailureDomains []string `json:"failureDomains,omitempty"`
18+
19+
Region string `json:"region"`
20+
21+
// +optional
22+
Network NetworkSpec `json:"network"`
23+
24+
// +optional
25+
ControlPlaneLoadBalancer *LoadBalancerSpec `json:"controlPlaneLoadBalancer"`
26+
27+
ScalewaySecretName string `json:"scalewaySecretName"`
28+
}
29+
30+
type NetworkSpec struct {
31+
// +optional
32+
PrivateNetwork *PrivateNetworkSpec `json:"privateNetwork,omitempty"`
33+
}
34+
35+
type PrivateNetworkSpec struct {
36+
Enabled bool `json:"enabled"`
37+
// Set the ID to reuse an existing PrivateNetwork.
38+
// +optional
39+
ID *string `json:"id,omitempty"`
40+
}
41+
42+
type LoadBalancerSpec struct {
43+
// Zone where to create the loadbalancer. Must be in the same region as the
44+
// cluster. Defaults to the first zone of the region.
45+
// +optional
46+
Zone *string `json:"zone,omitempty"`
47+
// Load Balancer commercial offer type.
48+
// +kubebuilder:default="LB-S"
49+
// +optional
50+
Type string `json:"type,omitempty"`
1151
}
1252

1353
// ScalewayClusterStatus defines the observed state of ScalewayCluster
1454
type ScalewayClusterStatus struct {
15-
Ready bool `json:"ready"`
55+
// +kubebuilder:default=false
56+
Ready bool `json:"ready"`
57+
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
1658
}
1759

1860
//+kubebuilder:object:root=true

api/v1beta1/scalewaymachine_types.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,31 @@ package v1beta1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
clusterv1 "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.
8+
const MachineFinalizer = "scalewaymachine.infrastructure.cluster.x-k8s.io"
99

1010
// ScalewayMachineSpec defines the desired state of ScalewayMachine
1111
type ScalewayMachineSpec 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 ScalewayMachine. Edit scalewaymachine_types.go to remove/update
16-
Foo string `json:"foo,omitempty"`
12+
// TODO: enforce immutable field(s)
13+
14+
// +optional
15+
ProviderID *string `json:"providerID,omitempty"`
16+
Image string `json:"image"`
17+
Type string `json:"type"`
18+
RootVolumeSize *int64 `json:"rootVolumeSize,omitempty"`
19+
// +optional
20+
PublicIP *bool `json:"publicIP,omitempty"`
1721
}
1822

1923
// ScalewayMachineStatus defines the observed state of ScalewayMachine
2024
type ScalewayMachineStatus struct {
21-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
22-
// Important: Run "make" to regenerate code after modifying this file
25+
// Ready is true when the provider resource is ready.
26+
// +optional
27+
Ready bool `json:"ready"`
28+
29+
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
2330
}
2431

2532
//+kubebuilder:object:root=true

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 105 additions & 6 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: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,67 @@ spec:
4949
- host
5050
- port
5151
type: object
52+
controlPlaneLoadBalancer:
53+
properties:
54+
type:
55+
default: LB-S
56+
description: Load Balancer commercial offer type.
57+
type: string
58+
zone:
59+
description: Zone where to create the loadbalancer. Must be in
60+
the same region as the cluster. Defaults to the first zone of
61+
the region.
62+
type: string
63+
type: object
64+
failureDomains:
65+
items:
66+
type: string
67+
type: array
68+
network:
69+
properties:
70+
privateNetwork:
71+
properties:
72+
enabled:
73+
type: boolean
74+
id:
75+
description: Set the ID to reuse an existing PrivateNetwork.
76+
type: string
77+
required:
78+
- enabled
79+
type: object
80+
type: object
81+
region:
82+
type: string
83+
scalewaySecretName:
84+
type: string
5285
required:
53-
- controlPlaneEndpoint
86+
- region
87+
- scalewaySecretName
5488
type: object
5589
status:
5690
description: ScalewayClusterStatus defines the observed state of ScalewayCluster
5791
properties:
92+
failureDomains:
93+
additionalProperties:
94+
description: FailureDomainSpec is the Schema for Cluster API failure
95+
domains. It allows controllers to understand how many failure
96+
domains a cluster can optionally span across.
97+
properties:
98+
attributes:
99+
additionalProperties:
100+
type: string
101+
description: Attributes is a free form map of attributes an
102+
infrastructure provider might use or require.
103+
type: object
104+
controlPlane:
105+
description: ControlPlane determines if this failure domain
106+
is suitable for use by control plane machines.
107+
type: boolean
108+
type: object
109+
description: FailureDomains is a slice of FailureDomains.
110+
type: object
58111
ready:
112+
default: false
59113
type: boolean
60114
required:
61115
- ready

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

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,42 @@ spec:
6363
- host
6464
- port
6565
type: object
66+
controlPlaneLoadBalancer:
67+
properties:
68+
type:
69+
default: LB-S
70+
description: Load Balancer commercial offer type.
71+
type: string
72+
zone:
73+
description: Zone where to create the loadbalancer. Must
74+
be in the same region as the cluster. Defaults to the
75+
first zone of the region.
76+
type: string
77+
type: object
78+
failureDomains:
79+
items:
80+
type: string
81+
type: array
82+
network:
83+
properties:
84+
privateNetwork:
85+
properties:
86+
enabled:
87+
type: boolean
88+
id:
89+
description: Set the ID to reuse an existing PrivateNetwork.
90+
type: string
91+
required:
92+
- enabled
93+
type: object
94+
type: object
95+
region:
96+
type: string
97+
scalewaySecretName:
98+
type: string
6699
required:
67-
- controlPlaneEndpoint
100+
- region
101+
- scalewaySecretName
68102
type: object
69103
required:
70104
- spec

0 commit comments

Comments
 (0)