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

Commit f51b1e5

Browse files
committed
Allow using existing LB and VPCGW ips
1 parent 93faaba commit f51b1e5

13 files changed

+306
-43
lines changed

api/v1beta1/scalewaycluster_types.go

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,34 @@ const ClusterFinalizer = "scalewaycluster.infrastructure.cluster.x-k8s.io"
99

1010
// ScalewayClusterSpec defines the desired state of ScalewayCluster
1111
type ScalewayClusterSpec struct {
12+
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
1213
// +optional
1314
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
1415

1516
// TODO: enforce immutable field(s)
1617

18+
// FailureDomains is a list of failure domains where the control-plane nodes
19+
// and resources (loadbalancer, public gateway, etc.) will be created.
1720
FailureDomains []string `json:"failureDomains,omitempty"`
1821

22+
// Region represents the region where the cluster will be hosted.
1923
Region string `json:"region"`
2024

25+
// Network contains network related options for the cluster.
2126
// +optional
2227
Network NetworkSpec `json:"network"`
2328

29+
// ControlPlaneLoadBalancer contains loadbalancer options.
2430
// +optional
2531
ControlPlaneLoadBalancer *LoadBalancerSpec `json:"controlPlaneLoadBalancer"`
2632

33+
// Name of the secret that contains the Scaleway client parameters.
34+
// The following keys must be set: accessKey, secretKey, projectID.
35+
// The following key is optional: apiURL.
2736
ScalewaySecretName string `json:"scalewaySecretName"`
2837
}
2938

39+
// NetworkSpec defines network specific settings.
3040
type NetworkSpec struct {
3141
// PrivateNetwork allows attaching machines of the cluster to a Private
3242
// Network.
@@ -40,65 +50,88 @@ type NetworkSpec struct {
4050
PublicGateway *PublicGatewaySpec `json:"publicGateway,omitempty"`
4151
}
4252

53+
// PrivateNetworkSpec defines Private Network settings for the cluster.
4354
type PrivateNetworkSpec struct {
4455
// Set to true to automatically attach machines to a Private Network.
4556
// The Private Network is automatically created if no existing Private
4657
// Network ID is provided.
4758
Enabled bool `json:"enabled"`
59+
4860
// Set a Private Network ID to reuse an existing Private Network. This
4961
// Private Network must have DHCP enabled.
5062
// +optional
5163
ID *string `json:"id,omitempty"`
64+
5265
// Optional subnet for the Private Network. Only used on newly created
5366
// Private Networks.
5467
// +optional
5568
Subnet *string `json:"subnet,omitempty"`
5669
}
5770

71+
// PublicGatewaySpec defines Public Gateway settings for the cluster.
5872
type PublicGatewaySpec struct {
5973
// Set to true to attach a Public Gateway to the Private Network.
60-
// The Public Gateway is automatically created if no existing Public Gateway
61-
// ID is provided.
74+
// The Public Gateway will automatically be created if no existing Public
75+
// Gateway ID is provided.
6276
Enabled bool `json:"enabled"`
77+
6378
// ID of an existing Public Gateway that will be attached to the Private
6479
// Network. You should also specify the zone field.
6580
ID *string `json:"id,omitempty"`
81+
6682
// Public Gateway commercial offer type.
6783
// +kubebuilder:default="VPC-GW-S"
6884
// +optional
69-
Type string `json:"type,omitempty"`
70-
// ID of an existing IP.
71-
IPID *string `json:"ipID,omitempty"`
85+
Type *string `json:"type,omitempty"`
86+
87+
// IP to use when creating a Public Gateway.
88+
IP *string `json:"ip,omitempty"`
89+
7290
// Zone where to create the Public Gateway. Must be in the same region as the
7391
// cluster. Defaults to the first zone of the region.
7492
// +optional
7593
Zone *string `json:"zone,omitempty"`
7694
}
7795

96+
// LoadBalancerSpec defines control-plane loadbalancer settings for the cluster.
7897
type LoadBalancerSpec struct {
7998
// Zone where to create the loadbalancer. Must be in the same region as the
8099
// cluster. Defaults to the first zone of the region.
81100
// +optional
82101
Zone *string `json:"zone,omitempty"`
102+
83103
// Load Balancer commercial offer type.
84104
// +kubebuilder:default="LB-S"
85105
// +optional
86-
Type string `json:"type,omitempty"`
106+
Type *string `json:"type,omitempty"`
107+
108+
// IP to use when creating a loadbalancer.
109+
IP *string `json:"ip,omitempty"`
87110
}
88111

89112
// ScalewayClusterStatus defines the observed state of ScalewayCluster
90113
type ScalewayClusterStatus struct {
114+
// Ready is true when all cloud resources are created and ready.
91115
// +kubebuilder:default=false
92-
Ready bool `json:"ready"`
116+
Ready bool `json:"ready"`
117+
118+
// List of failure domains for this cluster.
93119
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
94120

121+
// Network status.
95122
// +optional
96123
Network *NetworkStatus `json:"network,omitempty"`
97124
}
98125

126+
// NetworkStatus contains network status related data.
99127
type NetworkStatus struct {
128+
// ID of the Private Network if available.
129+
// +optional
100130
PrivateNetworkID *string `json:"privateNetworkID,omitempty"`
101-
PublicGatewayID *string `json:"publicGatewayID,omitempty"`
131+
132+
// ID of the Public Gateway if available.
133+
// +optional
134+
PublicGatewayID *string `json:"publicGatewayID,omitempty"`
102135
}
103136

104137
//+kubebuilder:object:root=true

api/v1beta1/scalewaymachine_types.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@ type ScalewayMachineSpec struct {
1212
// TODO: enforce immutable field(s)
1313

1414
// +optional
15-
ProviderID *string `json:"providerID,omitempty"`
16-
Image string `json:"image"`
17-
Type string `json:"type"`
18-
RootVolumeSize *int64 `json:"rootVolumeSize,omitempty"`
15+
ProviderID *string `json:"providerID,omitempty"`
16+
17+
// Label (e.g. ubuntu_jammy) or UUID of an image that will be used to
18+
// create the instance.
19+
Image string `json:"image"`
20+
21+
// Type of instance (e.g. PRO2-S).
22+
Type string `json:"type"`
23+
24+
// Size of the root volume in GB. Defaults to 20 GB.
25+
// +optional
26+
RootVolumeSize *int64 `json:"rootVolumeSize,omitempty"`
27+
28+
// Set to true to create and attach a public IP to the instance.
29+
// Defaults to false.
1930
// +optional
2031
PublicIP *bool `json:"publicIP,omitempty"`
21-
// VolumeType ?
2232
}
2333

2434
// ScalewayMachineStatus defines the observed state of ScalewayMachine
@@ -27,6 +37,7 @@ type ScalewayMachineStatus struct {
2737
// +optional
2838
Ready bool `json:"ready"`
2939

40+
// Addresses of the node.
3041
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
3142
}
3243

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 17 additions & 2 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: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ spec:
3636
description: ScalewayClusterSpec defines the desired state of ScalewayCluster
3737
properties:
3838
controlPlaneEndpoint:
39-
description: APIEndpoint represents a reachable Kubernetes API endpoint.
39+
description: ControlPlaneEndpoint represents the endpoint used to
40+
communicate with the control plane.
4041
properties:
4142
host:
4243
description: The hostname on which the API server is serving.
@@ -50,7 +51,11 @@ spec:
5051
- port
5152
type: object
5253
controlPlaneLoadBalancer:
54+
description: ControlPlaneLoadBalancer contains loadbalancer options.
5355
properties:
56+
ip:
57+
description: IP to use when creating a loadbalancer.
58+
type: string
5459
type:
5560
default: LB-S
5661
description: Load Balancer commercial offer type.
@@ -62,10 +67,14 @@ spec:
6267
type: string
6368
type: object
6469
failureDomains:
70+
description: FailureDomains is a list of failure domains where the
71+
control-plane nodes and resources (loadbalancer, public gateway,
72+
etc.) will be created.
6573
items:
6674
type: string
6775
type: array
6876
network:
77+
description: Network contains network related options for the cluster.
6978
properties:
7079
privateNetwork:
7180
description: PrivateNetwork allows attaching machines of the cluster
@@ -95,16 +104,16 @@ spec:
95104
properties:
96105
enabled:
97106
description: Set to true to attach a Public Gateway to the
98-
Private Network. The Public Gateway is automatically created
99-
if no existing Public Gateway ID is provided.
107+
Private Network. The Public Gateway will automatically be
108+
created if no existing Public Gateway ID is provided.
100109
type: boolean
101110
id:
102111
description: ID of an existing Public Gateway that will be
103112
attached to the Private Network. You should also specify
104113
the zone field.
105114
type: string
106-
ipID:
107-
description: ID of an existing IP.
115+
ip:
116+
description: IP to use when creating a Public Gateway.
108117
type: string
109118
type:
110119
default: VPC-GW-S
@@ -120,8 +129,13 @@ spec:
120129
type: object
121130
type: object
122131
region:
132+
description: Region represents the region where the cluster will be
133+
hosted.
123134
type: string
124135
scalewaySecretName:
136+
description: 'Name of the secret that contains the Scaleway client
137+
parameters. The following keys must be set: accessKey, secretKey,
138+
projectID. The following key is optional: apiURL.'
125139
type: string
126140
required:
127141
- region
@@ -147,17 +161,22 @@ spec:
147161
is suitable for use by control plane machines.
148162
type: boolean
149163
type: object
150-
description: FailureDomains is a slice of FailureDomains.
164+
description: List of failure domains for this cluster.
151165
type: object
152166
network:
167+
description: Network status.
153168
properties:
154169
privateNetworkID:
170+
description: ID of the Private Network if available.
155171
type: string
156172
publicGatewayID:
173+
description: ID of the Public Gateway if available.
157174
type: string
158175
type: object
159176
ready:
160177
default: false
178+
description: Ready is true when all cloud resources are created and
179+
ready.
161180
type: boolean
162181
required:
163182
- ready

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ spec:
4949
ScalewayCluster
5050
properties:
5151
controlPlaneEndpoint:
52-
description: APIEndpoint represents a reachable Kubernetes
53-
API endpoint.
52+
description: ControlPlaneEndpoint represents the endpoint
53+
used to communicate with the control plane.
5454
properties:
5555
host:
5656
description: The hostname on which the API server is serving.
@@ -64,7 +64,12 @@ spec:
6464
- port
6565
type: object
6666
controlPlaneLoadBalancer:
67+
description: ControlPlaneLoadBalancer contains loadbalancer
68+
options.
6769
properties:
70+
ip:
71+
description: IP to use when creating a loadbalancer.
72+
type: string
6873
type:
6974
default: LB-S
7075
description: Load Balancer commercial offer type.
@@ -76,10 +81,15 @@ spec:
7681
type: string
7782
type: object
7883
failureDomains:
84+
description: FailureDomains is a list of failure domains where
85+
the control-plane nodes and resources (loadbalancer, public
86+
gateway, etc.) will be created.
7987
items:
8088
type: string
8189
type: array
8290
network:
91+
description: Network contains network related options for
92+
the cluster.
8393
properties:
8494
privateNetwork:
8595
description: PrivateNetwork allows attaching machines
@@ -110,16 +120,17 @@ spec:
110120
properties:
111121
enabled:
112122
description: Set to true to attach a Public Gateway
113-
to the Private Network. The Public Gateway is automatically
114-
created if no existing Public Gateway ID is provided.
123+
to the Private Network. The Public Gateway will
124+
automatically be created if no existing Public Gateway
125+
ID is provided.
115126
type: boolean
116127
id:
117128
description: ID of an existing Public Gateway that
118129
will be attached to the Private Network. You should
119130
also specify the zone field.
120131
type: string
121-
ipID:
122-
description: ID of an existing IP.
132+
ip:
133+
description: IP to use when creating a Public Gateway.
123134
type: string
124135
type:
125136
default: VPC-GW-S
@@ -135,8 +146,13 @@ spec:
135146
type: object
136147
type: object
137148
region:
149+
description: Region represents the region where the cluster
150+
will be hosted.
138151
type: string
139152
scalewaySecretName:
153+
description: 'Name of the secret that contains the Scaleway
154+
client parameters. The following keys must be set: accessKey,
155+
secretKey, projectID. The following key is optional: apiURL.'
140156
type: string
141157
required:
142158
- region

0 commit comments

Comments
 (0)