Skip to content

Commit a65f1f5

Browse files
committed
✨ Support ignition v3 and presigned URLs
Signed-off-by: Vince Prignano <[email protected]>
1 parent d0c8e32 commit a65f1f5

15 files changed

+216
-82
lines changed

api/v1beta1/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,7 @@ func Convert_v1beta2_IPv6_To_v1beta1_IPv6(in *v1beta2.IPv6, out *IPv6, s convers
9494
func Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in *v1beta2.NetworkSpec, out *NetworkSpec, s conversion.Scope) error {
9595
return autoConvert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in, out, s)
9696
}
97+
98+
func Convert_v1beta2_S3Bucket_To_v1beta1_S3Bucket(in *v1beta2.S3Bucket, out *S3Bucket, s conversion.Scope) error {
99+
return autoConvert_v1beta2_S3Bucket_To_v1beta1_S3Bucket(in, out, s)
100+
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/awscluster_types.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,22 @@ type AWSClusterStatus struct {
239239
type S3Bucket struct {
240240
// ControlPlaneIAMInstanceProfile is a name of the IAMInstanceProfile, which will be allowed
241241
// to read control-plane node bootstrap data from S3 Bucket.
242-
ControlPlaneIAMInstanceProfile string `json:"controlPlaneIAMInstanceProfile"`
242+
// +optional
243+
ControlPlaneIAMInstanceProfile string `json:"controlPlaneIAMInstanceProfile,omitempty"`
243244

244245
// NodesIAMInstanceProfiles is a list of IAM instance profiles, which will be allowed to read
245246
// worker nodes bootstrap data from S3 Bucket.
246-
NodesIAMInstanceProfiles []string `json:"nodesIAMInstanceProfiles"`
247+
// +optional
248+
NodesIAMInstanceProfiles []string `json:"nodesIAMInstanceProfiles,omitempty"`
249+
250+
// PresignedURLDuration defines the duration for which presigned URLs are valid.
251+
//
252+
// This is used to generate presigned URLs for S3 Bucket objects, which are used by
253+
// control-plane and worker nodes to fetch bootstrap data.
254+
//
255+
// When enabled, the IAM instance profiles specified are not used.
256+
// +optional
257+
PresignedURLDuration *metav1.Duration `json:"presignedURLDuration,omitempty"`
247258

248259
// Name defines name of S3 Bucket to be created.
249260
// +kubebuilder:validation:MinLength:=3

api/v1beta2/awsmachine_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ type Ignition struct {
195195
//
196196
// +optional
197197
// +kubebuilder:default="2.3"
198-
// +kubebuilder:validation:Enum="2.3"
198+
// +kubebuilder:validation:Enum="2.3";"3.0";"3.1";"3.2";"3.3";"3.4"
199199
Version string `json:"version,omitempty"`
200200
}
201201

api/v1beta2/s3bucket.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,22 @@ func (b *S3Bucket) Validate() []*field.Error {
4343
"can be set only if the BootstrapFormatIgnition feature gate is enabled"))
4444
}
4545

46-
if b.ControlPlaneIAMInstanceProfile == "" {
47-
errs = append(errs,
48-
field.Required(field.NewPath("spec", "s3Bucket", "controlPlaneIAMInstanceProfiles"), "can't be empty"))
49-
}
50-
51-
if len(b.NodesIAMInstanceProfiles) == 0 {
52-
errs = append(errs,
53-
field.Required(field.NewPath("spec", "s3Bucket", "nodesIAMInstanceProfiles"), "can't be empty"))
54-
}
46+
if b.PresignedURLDuration == nil {
47+
if b.ControlPlaneIAMInstanceProfile == "" {
48+
errs = append(errs,
49+
field.Required(field.NewPath("spec", "s3Bucket", "controlPlaneIAMInstanceProfiles"), "can't be empty"))
50+
}
5551

56-
for i, iamInstanceProfile := range b.NodesIAMInstanceProfiles {
57-
if iamInstanceProfile == "" {
52+
if len(b.NodesIAMInstanceProfiles) == 0 {
5853
errs = append(errs,
59-
field.Required(field.NewPath("spec", "s3Bucket", fmt.Sprintf("nodesIAMInstanceProfiles[%d]", i)), "can't be empty"))
54+
field.Required(field.NewPath("spec", "s3Bucket", "nodesIAMInstanceProfiles"), "can't be empty"))
55+
}
56+
57+
for i, iamInstanceProfile := range b.NodesIAMInstanceProfiles {
58+
if iamInstanceProfile == "" {
59+
errs = append(errs,
60+
field.Required(field.NewPath("spec", "s3Bucket", fmt.Sprintf("nodesIAMInstanceProfiles[%d]", i)), "can't be empty"))
61+
}
6062
}
6163
}
6264

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 8 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_awsclusters.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,10 +1476,15 @@ spec:
14761476
items:
14771477
type: string
14781478
type: array
1479+
presignedURLDuration:
1480+
description: "PresignedURLDuration defines the duration for which
1481+
presigned URLs are valid. \n This is used to generate presigned
1482+
URLs for S3 Bucket objects, which are used by control-plane
1483+
and worker nodes to fetch bootstrap data. \n When enabled, the
1484+
IAM instance profiles specified are not used."
1485+
type: string
14791486
required:
1480-
- controlPlaneIAMInstanceProfile
14811487
- name
1482-
- nodesIAMInstanceProfiles
14831488
type: object
14841489
sshKeyName:
14851490
description: SSHKeyName is the name of the ssh key to attach to the

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,16 @@ spec:
10921092
items:
10931093
type: string
10941094
type: array
1095+
presignedURLDuration:
1096+
description: "PresignedURLDuration defines the duration
1097+
for which presigned URLs are valid. \n This is used
1098+
to generate presigned URLs for S3 Bucket objects, which
1099+
are used by control-plane and worker nodes to fetch
1100+
bootstrap data. \n When enabled, the IAM instance profiles
1101+
specified are not used."
1102+
type: string
10951103
required:
1096-
- controlPlaneIAMInstanceProfile
10971104
- name
1098-
- nodesIAMInstanceProfiles
10991105
type: object
11001106
sshKeyName:
11011107
description: SSHKeyName is the name of the ssh key to attach

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ spec:
638638
used to generate bootstrap data.
639639
enum:
640640
- "2.3"
641+
- "3.0"
642+
- "3.1"
643+
- "3.2"
644+
- "3.3"
645+
- "3.4"
641646
type: string
642647
type: object
643648
imageLookupBaseOS:

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ spec:
584584
will be used to generate bootstrap data.
585585
enum:
586586
- "2.3"
587+
- "3.0"
588+
- "3.1"
589+
- "3.2"
590+
- "3.3"
591+
- "3.4"
587592
type: string
588593
type: object
589594
imageLookupBaseOS:

0 commit comments

Comments
 (0)