Skip to content

Commit 7b3ba01

Browse files
authored
feat: add volume APIs to AWS and EKS Nodes (#1309)
**What problem does this PR solve?**: Exposes CAPA's [rootVolume](https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/88cb4b92b1a76591623e9d5ef347bfdc22010622/api/v1beta1/types.go#L184) and [nonRootVolumes](https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/88cb4b92b1a76591623e9d5ef347bfdc22010622/api/v1beta1/types.go#L188C33-L188C47) APIs in CAREN API. I did not use the capav1.Volume type directly so that we can have proper kubebuilder annotations and used basic types instead of pointers that the CAPA uses (inconsistently). **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> Unit tests and also created an EKS cluster with 2 Nodepools Defaults with default root volume <img width="1433" height="179" alt="image" src="https://github.com/user-attachments/assets/2d6259ea-c553-432a-b8b9-cc6b6c7c714e" /> Second nodepool with a modified root and additional volume <img width="1429" height="209" alt="image" src="https://github.com/user-attachments/assets/f6ff7f41-fae4-4ffa-aaa4-ce3282bc6ed4" /> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent 6f834ef commit 7b3ba01

19 files changed

+1563
-0
lines changed

api/v1alpha1/aws_node_types.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
package v1alpha1
55

6+
import (
7+
capav1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
8+
)
9+
610
type AWSControlPlaneNodeSpec struct {
711
// The IAM instance profile to use for the cluster Machines.
812
// +kubebuilder:validation:Optional
@@ -50,6 +54,10 @@ type AWSGenericNodeSpec struct {
5054
// PlacementGroup specifies the placement group in which to launch the instance.
5155
// +kubebuilder:validation:Optional
5256
PlacementGroup *PlacementGroup `json:"placementGroup,omitempty"`
57+
58+
// Configuration options for the root and additional storage volume.
59+
// +kubebuilder:validation:Optional
60+
Volumes *AWSVolumes `json:"volumes,omitempty"`
5361
}
5462

5563
// +kubebuilder:validation:MaxItems=32
@@ -105,3 +113,47 @@ type AMILookup struct {
105113
// +kubebuilder:validation:MaxLength=32
106114
BaseOS string `json:"baseOS,omitempty"`
107115
}
116+
117+
type AWSVolumes struct {
118+
// Configuration options for the root storage volume.
119+
// +kubebuilder:validation:Optional
120+
Root *AWSVolume `json:"root,omitempty"`
121+
122+
// Configuration options for non-root storage volumes.
123+
// +kubebuilder:validation:Optional
124+
NonRoot []AWSVolume `json:"nonroot,omitempty"`
125+
}
126+
127+
type AWSVolume struct {
128+
// Device name
129+
// +kubebuilder:validation:Optional
130+
DeviceName string `json:"deviceName,omitempty"`
131+
132+
// Size specifies size (in Gi) of the storage device.
133+
// Must be greater than the image snapshot size or 8 (whichever is greater).
134+
// +kubebuilder:validation:Optional
135+
// +kubebuilder:validation:Minimum=8
136+
Size int64 `json:"size,omitempty"`
137+
138+
// Type is the type of the volume (e.g. gp2, io1, etc...).
139+
// +kubebuilder:validation:Optional
140+
Type capav1.VolumeType `json:"type,omitempty"`
141+
142+
// IOPS is the number of IOPS requested for the disk. Not applicable to all types.
143+
// +kubebuilder:validation:Optional
144+
IOPS int64 `json:"iops,omitempty"`
145+
146+
// Throughput to provision in MiB/s supported for the volume type. Not applicable to all types.
147+
// +kubebuilder:validation:Optional
148+
Throughput int64 `json:"throughput,omitempty"`
149+
150+
// Encrypted is whether the volume should be encrypted or not.
151+
// +kubebuilder:validation:Optional
152+
Encrypted bool `json:"encrypted,omitempty"`
153+
154+
// EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
155+
// If Encrypted is set and this is omitted, the default AWS key will be used.
156+
// The key must already exist and be accessible by the controller.
157+
// +kubebuilder:validation:Optional
158+
EncryptionKey string `json:"encryptionKey,omitempty"`
159+
}

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,80 @@ spec:
444444
required:
445445
- name
446446
type: object
447+
volumes:
448+
description: Configuration options for the root and additional storage volume.
449+
properties:
450+
nonroot:
451+
description: Configuration options for non-root storage volumes.
452+
items:
453+
properties:
454+
deviceName:
455+
description: Device name
456+
type: string
457+
encrypted:
458+
description: Encrypted is whether the volume should be encrypted or not.
459+
type: boolean
460+
encryptionKey:
461+
description: |-
462+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
463+
If Encrypted is set and this is omitted, the default AWS key will be used.
464+
The key must already exist and be accessible by the controller.
465+
type: string
466+
iops:
467+
description: IOPS is the number of IOPS requested for the disk. Not applicable to all types.
468+
format: int64
469+
type: integer
470+
size:
471+
description: |-
472+
Size specifies size (in Gi) of the storage device.
473+
Must be greater than the image snapshot size or 8 (whichever is greater).
474+
format: int64
475+
minimum: 8
476+
type: integer
477+
throughput:
478+
description: Throughput to provision in MiB/s supported for the volume type. Not applicable to all types.
479+
format: int64
480+
type: integer
481+
type:
482+
description: Type is the type of the volume (e.g. gp2, io1, etc...).
483+
type: string
484+
type: object
485+
type: array
486+
root:
487+
description: Configuration options for the root storage volume.
488+
properties:
489+
deviceName:
490+
description: Device name
491+
type: string
492+
encrypted:
493+
description: Encrypted is whether the volume should be encrypted or not.
494+
type: boolean
495+
encryptionKey:
496+
description: |-
497+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
498+
If Encrypted is set and this is omitted, the default AWS key will be used.
499+
The key must already exist and be accessible by the controller.
500+
type: string
501+
iops:
502+
description: IOPS is the number of IOPS requested for the disk. Not applicable to all types.
503+
format: int64
504+
type: integer
505+
size:
506+
description: |-
507+
Size specifies size (in Gi) of the storage device.
508+
Must be greater than the image snapshot size or 8 (whichever is greater).
509+
format: int64
510+
minimum: 8
511+
type: integer
512+
throughput:
513+
description: Throughput to provision in MiB/s supported for the volume type. Not applicable to all types.
514+
format: int64
515+
type: integer
516+
type:
517+
description: Type is the type of the volume (e.g. gp2, io1, etc...).
518+
type: string
519+
type: object
520+
type: object
447521
type: object
448522
nodeRegistration:
449523
default: {}

api/v1alpha1/crds/caren.nutanix.com_awsworkernodeconfigs.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,89 @@ spec:
117117
required:
118118
- name
119119
type: object
120+
volumes:
121+
description: Configuration options for the root and additional
122+
storage volume.
123+
properties:
124+
nonroot:
125+
description: Configuration options for non-root storage volumes.
126+
items:
127+
properties:
128+
deviceName:
129+
description: Device name
130+
type: string
131+
encrypted:
132+
description: Encrypted is whether the volume should
133+
be encrypted or not.
134+
type: boolean
135+
encryptionKey:
136+
description: |-
137+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
138+
If Encrypted is set and this is omitted, the default AWS key will be used.
139+
The key must already exist and be accessible by the controller.
140+
type: string
141+
iops:
142+
description: IOPS is the number of IOPS requested for
143+
the disk. Not applicable to all types.
144+
format: int64
145+
type: integer
146+
size:
147+
description: |-
148+
Size specifies size (in Gi) of the storage device.
149+
Must be greater than the image snapshot size or 8 (whichever is greater).
150+
format: int64
151+
minimum: 8
152+
type: integer
153+
throughput:
154+
description: Throughput to provision in MiB/s supported
155+
for the volume type. Not applicable to all types.
156+
format: int64
157+
type: integer
158+
type:
159+
description: Type is the type of the volume (e.g. gp2,
160+
io1, etc...).
161+
type: string
162+
type: object
163+
type: array
164+
root:
165+
description: Configuration options for the root storage volume.
166+
properties:
167+
deviceName:
168+
description: Device name
169+
type: string
170+
encrypted:
171+
description: Encrypted is whether the volume should be
172+
encrypted or not.
173+
type: boolean
174+
encryptionKey:
175+
description: |-
176+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
177+
If Encrypted is set and this is omitted, the default AWS key will be used.
178+
The key must already exist and be accessible by the controller.
179+
type: string
180+
iops:
181+
description: IOPS is the number of IOPS requested for
182+
the disk. Not applicable to all types.
183+
format: int64
184+
type: integer
185+
size:
186+
description: |-
187+
Size specifies size (in Gi) of the storage device.
188+
Must be greater than the image snapshot size or 8 (whichever is greater).
189+
format: int64
190+
minimum: 8
191+
type: integer
192+
throughput:
193+
description: Throughput to provision in MiB/s supported
194+
for the volume type. Not applicable to all types.
195+
format: int64
196+
type: integer
197+
type:
198+
description: Type is the type of the volume (e.g. gp2,
199+
io1, etc...).
200+
type: string
201+
type: object
202+
type: object
120203
type: object
121204
nodeRegistration:
122205
default: {}

api/v1alpha1/crds/caren.nutanix.com_eksworkernodeconfigs.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,89 @@ spec:
117117
required:
118118
- name
119119
type: object
120+
volumes:
121+
description: Configuration options for the root and additional
122+
storage volume.
123+
properties:
124+
nonroot:
125+
description: Configuration options for non-root storage volumes.
126+
items:
127+
properties:
128+
deviceName:
129+
description: Device name
130+
type: string
131+
encrypted:
132+
description: Encrypted is whether the volume should
133+
be encrypted or not.
134+
type: boolean
135+
encryptionKey:
136+
description: |-
137+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
138+
If Encrypted is set and this is omitted, the default AWS key will be used.
139+
The key must already exist and be accessible by the controller.
140+
type: string
141+
iops:
142+
description: IOPS is the number of IOPS requested for
143+
the disk. Not applicable to all types.
144+
format: int64
145+
type: integer
146+
size:
147+
description: |-
148+
Size specifies size (in Gi) of the storage device.
149+
Must be greater than the image snapshot size or 8 (whichever is greater).
150+
format: int64
151+
minimum: 8
152+
type: integer
153+
throughput:
154+
description: Throughput to provision in MiB/s supported
155+
for the volume type. Not applicable to all types.
156+
format: int64
157+
type: integer
158+
type:
159+
description: Type is the type of the volume (e.g. gp2,
160+
io1, etc...).
161+
type: string
162+
type: object
163+
type: array
164+
root:
165+
description: Configuration options for the root storage volume.
166+
properties:
167+
deviceName:
168+
description: Device name
169+
type: string
170+
encrypted:
171+
description: Encrypted is whether the volume should be
172+
encrypted or not.
173+
type: boolean
174+
encryptionKey:
175+
description: |-
176+
EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
177+
If Encrypted is set and this is omitted, the default AWS key will be used.
178+
The key must already exist and be accessible by the controller.
179+
type: string
180+
iops:
181+
description: IOPS is the number of IOPS requested for
182+
the disk. Not applicable to all types.
183+
format: int64
184+
type: integer
185+
size:
186+
description: |-
187+
Size specifies size (in Gi) of the storage device.
188+
Must be greater than the image snapshot size or 8 (whichever is greater).
189+
format: int64
190+
minimum: 8
191+
type: integer
192+
throughput:
193+
description: Throughput to provision in MiB/s supported
194+
for the volume type. Not applicable to all types.
195+
format: int64
196+
type: integer
197+
type:
198+
description: Type is the type of the volume (e.g. gp2,
199+
io1, etc...).
200+
type: string
201+
type: object
202+
type: object
120203
type: object
121204
taints:
122205
description: Taints specifies the taints the Node API object should

api/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)