Skip to content

Commit 0402f41

Browse files
authored
Merge pull request #3094 from richardchen331/launch_template_support
AWSManagedMachinePool - Launch Template support
2 parents f22d6f6 + ed6ea44 commit 0402f41

36 files changed

+1273
-479
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,9 @@ spec:
14131413
launchTemplateID:
14141414
description: The ID of the launch template
14151415
type: string
1416+
launchTemplateVersion:
1417+
description: The version of the launch template
1418+
type: string
14161419
ready:
14171420
description: Ready is true when the provider resource is ready.
14181421
type: boolean

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

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ spec:
540540
- AL2_x86_64
541541
- AL2_x86_64_GPU
542542
- AL2_ARM_64
543+
- CUSTOM
543544
type: string
544545
amiVersion:
545546
description: AMIVersion defines the desired AMI release version. If
@@ -553,6 +554,169 @@ spec:
553554
items:
554555
type: string
555556
type: array
557+
awsLaunchTemplate:
558+
description: AWSLaunchTemplate specifies the launch template to use
559+
to create the managed node group. If AWSLaunchTemplate is specified,
560+
certain node group configuraions outside of launch template are
561+
prohibited (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html).
562+
properties:
563+
additionalSecurityGroups:
564+
description: AdditionalSecurityGroups is an array of references
565+
to security groups that should be applied to the instances.
566+
These security groups would be set in addition to any security
567+
groups defined at the cluster level or in the actuator.
568+
items:
569+
description: AWSResourceReference is a reference to a specific
570+
AWS resource by ID or filters. Only one of ID or Filters may
571+
be specified. Specifying more than one will result in a validation
572+
error.
573+
properties:
574+
arn:
575+
description: 'ARN of resource. Deprecated: This field has
576+
no function and is going to be removed in the next release.'
577+
type: string
578+
filters:
579+
description: 'Filters is a set of key/value pairs used to
580+
identify a resource They are applied according to the
581+
rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html'
582+
items:
583+
description: Filter is a filter used to identify an AWS
584+
resource.
585+
properties:
586+
name:
587+
description: Name of the filter. Filter names are
588+
case-sensitive.
589+
type: string
590+
values:
591+
description: Values includes one or more filter values.
592+
Filter values are case-sensitive.
593+
items:
594+
type: string
595+
type: array
596+
required:
597+
- name
598+
- values
599+
type: object
600+
type: array
601+
id:
602+
description: ID of resource
603+
type: string
604+
type: object
605+
type: array
606+
ami:
607+
description: AMI is the reference to the AMI from which to create
608+
the machine instance.
609+
properties:
610+
eksLookupType:
611+
description: EKSOptimizedLookupType If specified, will look
612+
up an EKS Optimized image in SSM Parameter store
613+
enum:
614+
- AmazonLinux
615+
- AmazonLinuxGPU
616+
type: string
617+
id:
618+
description: ID of resource
619+
type: string
620+
type: object
621+
iamInstanceProfile:
622+
description: The name or the Amazon Resource Name (ARN) of the
623+
instance profile associated with the IAM role for the instance.
624+
The instance profile contains the IAM role.
625+
type: string
626+
imageLookupBaseOS:
627+
description: ImageLookupBaseOS is the name of the base operating
628+
system to use for image lookup the AMI is not set.
629+
type: string
630+
imageLookupFormat:
631+
description: 'ImageLookupFormat is the AMI naming format to look
632+
up the image for this machine It will be ignored if an explicit
633+
AMI is set. Supports substitutions for {{.BaseOS}} and {{.K8sVersion}}
634+
with the base OS and kubernetes version, respectively. The BaseOS
635+
will be the value in ImageLookupBaseOS or ubuntu (the default),
636+
and the kubernetes version as defined by the packages produced
637+
by kubernetes/release without v as a prefix: 1.13.0, 1.12.5-mybuild.1,
638+
or 1.17.3. For example, the default image format of capa-ami-{{.BaseOS}}-?{{.K8sVersion}}-*
639+
will end up searching for AMIs that match the pattern capa-ami-ubuntu-?1.18.0-*
640+
for a Machine that is targeting kubernetes v1.18.0 and the ubuntu
641+
base OS. See also: https://golang.org/pkg/text/template/'
642+
type: string
643+
imageLookupOrg:
644+
description: ImageLookupOrg is the AWS Organization ID to use
645+
for image lookup if AMI is not set.
646+
type: string
647+
instanceType:
648+
description: 'InstanceType is the type of instance to create.
649+
Example: m4.xlarge'
650+
type: string
651+
name:
652+
description: The name of the launch template.
653+
type: string
654+
rootVolume:
655+
description: RootVolume encapsulates the configuration options
656+
for the root volume
657+
properties:
658+
deviceName:
659+
description: Device name
660+
type: string
661+
encrypted:
662+
description: Encrypted is whether the volume should be encrypted
663+
or not.
664+
type: boolean
665+
encryptionKey:
666+
description: EncryptionKey is the KMS key to use to encrypt
667+
the volume. Can be either a KMS key ID or ARN. If Encrypted
668+
is set and this is omitted, the default AWS key will be
669+
used. The key must already exist and be accessible by the
670+
controller.
671+
type: string
672+
iops:
673+
description: IOPS is the number of IOPS requested for the
674+
disk. Not applicable to all types.
675+
format: int64
676+
type: integer
677+
size:
678+
description: Size specifies size (in Gi) of the storage device.
679+
Must be greater than the image snapshot size or 8 (whichever
680+
is greater).
681+
format: int64
682+
minimum: 8
683+
type: integer
684+
throughput:
685+
description: Throughput to provision in MiB/s supported for
686+
the volume type. Not applicable to all types.
687+
format: int64
688+
type: integer
689+
type:
690+
description: Type is the type of the volume (e.g. gp2, io1,
691+
etc...).
692+
type: string
693+
required:
694+
- size
695+
type: object
696+
spotMarketOptions:
697+
description: SpotMarketOptions are options for configuring AWSMachinePool
698+
instances to be run using AWS Spot instances.
699+
properties:
700+
maxPrice:
701+
description: MaxPrice defines the maximum price the user is
702+
willing to pay for Spot VM instances
703+
type: string
704+
type: object
705+
sshKeyName:
706+
description: SSHKeyName is the name of the ssh key to attach to
707+
the instance. Valid values are empty string (do not use SSH
708+
keys), a valid SSH key name, or omitted (use the default SSH
709+
key name)
710+
type: string
711+
versionNumber:
712+
description: 'VersionNumber is the version of the launch template
713+
that is applied. Typically a new version is created when at
714+
least one of the following happens: 1) A new launch template
715+
spec is applied. 2) One or more parameters in an existing template
716+
is changed. 3) A new AMI is discovered.'
717+
format: int64
718+
type: integer
719+
type: object
556720
capacityType:
557721
default: onDemand
558722
description: CapacityType specifies the capacity type for the ASG
@@ -761,6 +925,12 @@ spec:
761925
events to the MachinePool object and/or logged in the controller's
762926
output."
763927
type: string
928+
launchTemplateID:
929+
description: The ID of the launch template
930+
type: string
931+
launchTemplateVersion:
932+
description: The version of the launch template
933+
type: string
764934
ready:
765935
default: false
766936
description: Ready denotes that the AWSManagedMachinePool nodegroup

controlplane/eks/api/v1beta1/awsmanagedcontrolplane_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
const (
2828
// ManagedControlPlaneFinalizer allows the controller to clean up resources on delete.
2929
ManagedControlPlaneFinalizer = "awsmanagedcontrolplane.controlplane.cluster.x-k8s.io"
30+
31+
// AWSManagedControlPlaneKind is the Kind of AWSManagedControlPlane.
32+
AWSManagedControlPlaneKind = "AWSManagedControlPlane"
3033
)
3134

3235
// AWSManagedControlPlaneSpec defines the desired state of an Amazon EKS Cluster.

docs/book/src/crd/index.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18283,7 +18283,7 @@ FargateProfileStatus
1828318283
<h3 id="infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">AWSLaunchTemplate
1828418284
</h3>
1828518285
<p>
18286-
(<em>Appears on:</em><a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSMachinePoolSpec">AWSMachinePoolSpec</a>)
18286+
(<em>Appears on:</em><a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSMachinePoolSpec">AWSMachinePoolSpec</a>, <a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSManagedMachinePoolSpec">AWSManagedMachinePoolSpec</a>)
1828718287
</p>
1828818288
<p>
1828918289
<p>AWSLaunchTemplate defines the desired state of AWSLaunchTemplate.</p>
@@ -18956,6 +18956,18 @@ string
1895618956
</tr>
1895718957
<tr>
1895818958
<td>
18959+
<code>launchTemplateVersion</code><br/>
18960+
<em>
18961+
string
18962+
</em>
18963+
</td>
18964+
<td>
18965+
<em>(Optional)</em>
18966+
<p>The version of the launch template</p>
18967+
</td>
18968+
</tr>
18969+
<tr>
18970+
<td>
1895918971
<code>failureReason</code><br/>
1896018972
<em>
1896118973
<a href="https://pkg.go.dev/sigs.k8s.io/[email protected]/errors#MachineStatusError">
@@ -19292,6 +19304,22 @@ UpdateConfig
1929219304
to the nodegroup.</p>
1929319305
</td>
1929419306
</tr>
19307+
<tr>
19308+
<td>
19309+
<code>awsLaunchTemplate</code><br/>
19310+
<em>
19311+
<a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">
19312+
AWSLaunchTemplate
19313+
</a>
19314+
</em>
19315+
</td>
19316+
<td>
19317+
<em>(Optional)</em>
19318+
<p>AWSLaunchTemplate specifies the launch template to use to create the managed node group.
19319+
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
19320+
are prohibited (<a href="https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html">https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html</a>).</p>
19321+
</td>
19322+
</tr>
1929519323
</table>
1929619324
</td>
1929719325
</tr>
@@ -19557,6 +19585,22 @@ UpdateConfig
1955719585
to the nodegroup.</p>
1955819586
</td>
1955919587
</tr>
19588+
<tr>
19589+
<td>
19590+
<code>awsLaunchTemplate</code><br/>
19591+
<em>
19592+
<a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">
19593+
AWSLaunchTemplate
19594+
</a>
19595+
</em>
19596+
</td>
19597+
<td>
19598+
<em>(Optional)</em>
19599+
<p>AWSLaunchTemplate specifies the launch template to use to create the managed node group.
19600+
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
19601+
are prohibited (<a href="https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html">https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html</a>).</p>
19602+
</td>
19603+
</tr>
1956019604
</tbody>
1956119605
</table>
1956219606
<h3 id="infrastructure.cluster.x-k8s.io/v1beta1.AWSManagedMachinePoolStatus">AWSManagedMachinePoolStatus
@@ -19601,6 +19645,30 @@ int32
1960119645
</tr>
1960219646
<tr>
1960319647
<td>
19648+
<code>launchTemplateID</code><br/>
19649+
<em>
19650+
string
19651+
</em>
19652+
</td>
19653+
<td>
19654+
<em>(Optional)</em>
19655+
<p>The ID of the launch template</p>
19656+
</td>
19657+
</tr>
19658+
<tr>
19659+
<td>
19660+
<code>launchTemplateVersion</code><br/>
19661+
<em>
19662+
string
19663+
</em>
19664+
</td>
19665+
<td>
19666+
<em>(Optional)</em>
19667+
<p>The version of the launch template</p>
19668+
</td>
19669+
</tr>
19670+
<tr>
19671+
<td>
1960419672
<code>failureReason</code><br/>
1960519673
<em>
1960619674
<a href="https://pkg.go.dev/sigs.k8s.io/[email protected]/errors#MachineStatusError">

exp/api/v1alpha3/conversion.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (r *AWSMachinePool) ConvertTo(dstRaw conversion.Hub) error {
4646
infrav1alpha3.RestoreRootVolume(restored.Spec.AWSLaunchTemplate.RootVolume, dst.Spec.AWSLaunchTemplate.RootVolume)
4747
}
4848
dst.Spec.AWSLaunchTemplate.SpotMarketOptions = restored.Spec.AWSLaunchTemplate.SpotMarketOptions
49+
dst.Status.LaunchTemplateVersion = restored.Status.LaunchTemplateVersion
4950
return nil
5051
}
5152

@@ -93,6 +94,9 @@ func (r *AWSManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
9394
dst.Spec.CapacityType = restored.Spec.CapacityType
9495
dst.Spec.RoleAdditionalPolicies = restored.Spec.RoleAdditionalPolicies
9596
dst.Spec.UpdateConfig = restored.Spec.UpdateConfig
97+
dst.Spec.AWSLaunchTemplate = restored.Spec.AWSLaunchTemplate
98+
dst.Status.LaunchTemplateID = restored.Status.LaunchTemplateID
99+
dst.Status.LaunchTemplateVersion = restored.Status.LaunchTemplateVersion
96100

97101
return nil
98102
}
@@ -169,6 +173,21 @@ func Convert_v1beta1_AWSManagedMachinePoolSpec_To_v1alpha3_AWSManagedMachinePool
169173
return autoConvert_v1beta1_AWSManagedMachinePoolSpec_To_v1alpha3_AWSManagedMachinePoolSpec(in, out, s)
170174
}
171175

176+
// Convert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus is a conversion function.
177+
func Convert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus(in *infrav1exp.AWSManagedMachinePoolStatus, out *AWSManagedMachinePoolStatus, s apiconversion.Scope) error {
178+
return autoConvert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus(in, out, s)
179+
}
180+
181+
// Convert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus is a conversion function.
182+
func Convert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus(in *infrav1exp.AWSMachinePoolStatus, out *AWSMachinePoolStatus, s apiconversion.Scope) error {
183+
return autoConvert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus(in, out, s)
184+
}
185+
186+
// Convert_v1beta1_Instance_To_v1alpha3_Instance is a conversion function.
187+
func Convert_v1beta1_Instance_To_v1alpha3_Instance(in *infrav1.Instance, out *infrav1alpha3.Instance, s apiconversion.Scope) error {
188+
return infrav1alpha3.Convert_v1beta1_Instance_To_v1alpha3_Instance(in, out, s)
189+
}
190+
172191
// Convert_v1alpha3_Instance_To_v1beta1_Instance is a conversion function.
173192
func Convert_v1alpha3_Instance_To_v1beta1_Instance(in *infrav1alpha3.Instance, out *infrav1.Instance, s apiconversion.Scope) error {
174193
return infrav1alpha3.Convert_v1alpha3_Instance_To_v1beta1_Instance(in, out, s)

0 commit comments

Comments
 (0)