Skip to content

Commit e435634

Browse files
committed
set an explicit struct for dataDisks instead of a map
1 parent 9013d31 commit e435634

11 files changed

+1067
-254
lines changed

.golangci-kal.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ linters:
1919
# TODO: remove linters from this list as we add support from them
2020
disable:
2121
- "ssatags"
22-
- "nomaps"
2322
- "integers"
2423
- "jsontags"
2524
- "requiredfields"

api/v1alpha2/linodemachine_types.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type LinodeMachineSpec struct {
118118
// dataDisks is a map of any additional disks to add to an instance,
119119
// The sum of these disks + the OSDisk must not be more than allowed on a linodes plan
120120
// +optional
121-
DataDisks map[string]*InstanceDisk `json:"dataDisks,omitempty"`
121+
DataDisks *InstanceDisks `json:"dataDisks,omitempty"`
122122

123123
// diskEncryption determines if the disks of the instance should be encrypted. The default is disabled.
124124
// +optional
@@ -210,6 +210,30 @@ type IPv6CreateOptions struct {
210210
IsPublicIPv6 *bool `json:"isPublicIPv6,omitempty"`
211211
}
212212

213+
type InstanceDisks struct {
214+
// sdb is a disk for the instance.
215+
// +optional
216+
SDB *InstanceDisk `json:"sdb,omitempty"`
217+
// sdc is a disk for the instance.
218+
// +optional
219+
SDC *InstanceDisk `json:"sdc,omitempty"`
220+
// sdd is a disk for the instance.
221+
// +optional
222+
SDD *InstanceDisk `json:"sdd,omitempty"`
223+
// sde is a disk for the instance.
224+
// +optional
225+
SDE *InstanceDisk `json:"sde,omitempty"`
226+
// sdf is a disk for the instance.
227+
// +optional
228+
SDF *InstanceDisk `json:"sdf,omitempty"`
229+
// sdg is a disk for the instance.
230+
// +optional
231+
SDG *InstanceDisk `json:"sdg,omitempty"`
232+
// sdh is a disk for the instance.
233+
// +optional
234+
SDH *InstanceDisk `json:"sdh,omitempty"`
235+
}
236+
213237
// InstanceDisk defines a list of disks to use for an instance
214238
type InstanceDisk struct {
215239
// diskID is the linode assigned ID of the disk.

api/v1alpha2/zz_generated.deepcopy.go

Lines changed: 52 additions & 13 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_linodemachines.yaml

Lines changed: 211 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -127,40 +127,220 @@ spec:
127127
type: object
128128
x-kubernetes-map-type: atomic
129129
dataDisks:
130-
additionalProperties:
131-
description: InstanceDisk defines a list of disks to use for an
132-
instance
133-
properties:
134-
diskID:
135-
description: diskID is the linode assigned ID of the disk.
136-
type: integer
137-
filesystem:
138-
description: filesystem of disk to provision, the default disk
139-
filesystem is "ext4".
140-
enum:
141-
- raw
142-
- swap
143-
- ext3
144-
- ext4
145-
- initrd
146-
type: string
147-
label:
148-
description: label for the instance disk, if nothing is provided,
149-
it will match the device name.
150-
type: string
151-
size:
152-
anyOf:
153-
- type: integer
154-
- type: string
155-
description: size of the disk in resource.Quantity notation.
156-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
157-
x-kubernetes-int-or-string: true
158-
required:
159-
- size
160-
type: object
161130
description: |-
162131
dataDisks is a map of any additional disks to add to an instance,
163132
The sum of these disks + the OSDisk must not be more than allowed on a linodes plan
133+
properties:
134+
sdb:
135+
description: sdb is a disk for the instance.
136+
properties:
137+
diskID:
138+
description: diskID is the linode assigned ID of the disk.
139+
type: integer
140+
filesystem:
141+
description: filesystem of disk to provision, the default
142+
disk filesystem is "ext4".
143+
enum:
144+
- raw
145+
- swap
146+
- ext3
147+
- ext4
148+
- initrd
149+
type: string
150+
label:
151+
description: label for the instance disk, if nothing is provided,
152+
it will match the device name.
153+
type: string
154+
size:
155+
anyOf:
156+
- type: integer
157+
- type: string
158+
description: size of the disk in resource.Quantity notation.
159+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
160+
x-kubernetes-int-or-string: true
161+
required:
162+
- size
163+
type: object
164+
sdc:
165+
description: sdc is a disk for the instance.
166+
properties:
167+
diskID:
168+
description: diskID is the linode assigned ID of the disk.
169+
type: integer
170+
filesystem:
171+
description: filesystem of disk to provision, the default
172+
disk filesystem is "ext4".
173+
enum:
174+
- raw
175+
- swap
176+
- ext3
177+
- ext4
178+
- initrd
179+
type: string
180+
label:
181+
description: label for the instance disk, if nothing is provided,
182+
it will match the device name.
183+
type: string
184+
size:
185+
anyOf:
186+
- type: integer
187+
- type: string
188+
description: size of the disk in resource.Quantity notation.
189+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
190+
x-kubernetes-int-or-string: true
191+
required:
192+
- size
193+
type: object
194+
sdd:
195+
description: sdd is a disk for the instance.
196+
properties:
197+
diskID:
198+
description: diskID is the linode assigned ID of the disk.
199+
type: integer
200+
filesystem:
201+
description: filesystem of disk to provision, the default
202+
disk filesystem is "ext4".
203+
enum:
204+
- raw
205+
- swap
206+
- ext3
207+
- ext4
208+
- initrd
209+
type: string
210+
label:
211+
description: label for the instance disk, if nothing is provided,
212+
it will match the device name.
213+
type: string
214+
size:
215+
anyOf:
216+
- type: integer
217+
- type: string
218+
description: size of the disk in resource.Quantity notation.
219+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
220+
x-kubernetes-int-or-string: true
221+
required:
222+
- size
223+
type: object
224+
sde:
225+
description: sde is a disk for the instance.
226+
properties:
227+
diskID:
228+
description: diskID is the linode assigned ID of the disk.
229+
type: integer
230+
filesystem:
231+
description: filesystem of disk to provision, the default
232+
disk filesystem is "ext4".
233+
enum:
234+
- raw
235+
- swap
236+
- ext3
237+
- ext4
238+
- initrd
239+
type: string
240+
label:
241+
description: label for the instance disk, if nothing is provided,
242+
it will match the device name.
243+
type: string
244+
size:
245+
anyOf:
246+
- type: integer
247+
- type: string
248+
description: size of the disk in resource.Quantity notation.
249+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
250+
x-kubernetes-int-or-string: true
251+
required:
252+
- size
253+
type: object
254+
sdf:
255+
description: sdf is a disk for the instance.
256+
properties:
257+
diskID:
258+
description: diskID is the linode assigned ID of the disk.
259+
type: integer
260+
filesystem:
261+
description: filesystem of disk to provision, the default
262+
disk filesystem is "ext4".
263+
enum:
264+
- raw
265+
- swap
266+
- ext3
267+
- ext4
268+
- initrd
269+
type: string
270+
label:
271+
description: label for the instance disk, if nothing is provided,
272+
it will match the device name.
273+
type: string
274+
size:
275+
anyOf:
276+
- type: integer
277+
- type: string
278+
description: size of the disk in resource.Quantity notation.
279+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
280+
x-kubernetes-int-or-string: true
281+
required:
282+
- size
283+
type: object
284+
sdg:
285+
description: sdg is a disk for the instance.
286+
properties:
287+
diskID:
288+
description: diskID is the linode assigned ID of the disk.
289+
type: integer
290+
filesystem:
291+
description: filesystem of disk to provision, the default
292+
disk filesystem is "ext4".
293+
enum:
294+
- raw
295+
- swap
296+
- ext3
297+
- ext4
298+
- initrd
299+
type: string
300+
label:
301+
description: label for the instance disk, if nothing is provided,
302+
it will match the device name.
303+
type: string
304+
size:
305+
anyOf:
306+
- type: integer
307+
- type: string
308+
description: size of the disk in resource.Quantity notation.
309+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
310+
x-kubernetes-int-or-string: true
311+
required:
312+
- size
313+
type: object
314+
sdh:
315+
description: sdh is a disk for the instance.
316+
properties:
317+
diskID:
318+
description: diskID is the linode assigned ID of the disk.
319+
type: integer
320+
filesystem:
321+
description: filesystem of disk to provision, the default
322+
disk filesystem is "ext4".
323+
enum:
324+
- raw
325+
- swap
326+
- ext3
327+
- ext4
328+
- initrd
329+
type: string
330+
label:
331+
description: label for the instance disk, if nothing is provided,
332+
it will match the device name.
333+
type: string
334+
size:
335+
anyOf:
336+
- type: integer
337+
- type: string
338+
description: size of the disk in resource.Quantity notation.
339+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
340+
x-kubernetes-int-or-string: true
341+
required:
342+
- size
343+
type: object
164344
type: object
165345
diskEncryption:
166346
description: diskEncryption determines if the disks of the instance

0 commit comments

Comments
 (0)