Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWSManagedMachinePool - Launch Template support #3094

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,9 @@ spec:
launchTemplateID:
description: The ID of the launch template
type: string
launchTemplateVersion:
description: The version of the launch template
type: string
ready:
description: Ready is true when the provider resource is ready.
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ spec:
- AL2_x86_64
- AL2_x86_64_GPU
- AL2_ARM_64
- CUSTOM
type: string
amiVersion:
description: AMIVersion defines the desired AMI release version. If
Expand All @@ -553,6 +554,169 @@ spec:
items:
type: string
type: array
awsLaunchTemplate:
description: AWSLaunchTemplate specifies the launch template to use
to create the managed node group. If AWSLaunchTemplate is specified,
certain node group configuraions outside of launch template are
prohibited (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html).
properties:
additionalSecurityGroups:
description: AdditionalSecurityGroups is an array of references
to security groups that should be applied to the instances.
These security groups would be set in addition to any security
groups defined at the cluster level or in the actuator.
items:
description: AWSResourceReference is a reference to a specific
AWS resource by ID or filters. Only one of ID or Filters may
be specified. Specifying more than one will result in a validation
error.
properties:
arn:
description: 'ARN of resource. Deprecated: This field has
no function and is going to be removed in the next release.'
type: string
filters:
description: 'Filters is a set of key/value pairs used to
identify a resource They are applied according to the
rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html'
items:
description: Filter is a filter used to identify an AWS
resource.
properties:
name:
description: Name of the filter. Filter names are
case-sensitive.
type: string
values:
description: Values includes one or more filter values.
Filter values are case-sensitive.
items:
type: string
type: array
required:
- name
- values
type: object
type: array
id:
description: ID of resource
type: string
type: object
type: array
ami:
description: AMI is the reference to the AMI from which to create
the machine instance.
properties:
eksLookupType:
description: EKSOptimizedLookupType If specified, will look
up an EKS Optimized image in SSM Parameter store
enum:
- AmazonLinux
- AmazonLinuxGPU
type: string
id:
description: ID of resource
type: string
type: object
iamInstanceProfile:
description: The name or the Amazon Resource Name (ARN) of the
instance profile associated with the IAM role for the instance.
The instance profile contains the IAM role.
type: string
imageLookupBaseOS:
description: ImageLookupBaseOS is the name of the base operating
system to use for image lookup the AMI is not set.
type: string
imageLookupFormat:
description: 'ImageLookupFormat is the AMI naming format to look
up the image for this machine It will be ignored if an explicit
AMI is set. Supports substitutions for {{.BaseOS}} and {{.K8sVersion}}
with the base OS and kubernetes version, respectively. The BaseOS
will be the value in ImageLookupBaseOS or ubuntu (the default),
and the kubernetes version as defined by the packages produced
by kubernetes/release without v as a prefix: 1.13.0, 1.12.5-mybuild.1,
or 1.17.3. For example, the default image format of capa-ami-{{.BaseOS}}-?{{.K8sVersion}}-*
will end up searching for AMIs that match the pattern capa-ami-ubuntu-?1.18.0-*
for a Machine that is targeting kubernetes v1.18.0 and the ubuntu
base OS. See also: https://golang.org/pkg/text/template/'
type: string
imageLookupOrg:
description: ImageLookupOrg is the AWS Organization ID to use
for image lookup if AMI is not set.
type: string
instanceType:
description: 'InstanceType is the type of instance to create.
Example: m4.xlarge'
type: string
name:
description: The name of the launch template.
type: string
rootVolume:
description: RootVolume encapsulates the configuration options
for the root volume
properties:
deviceName:
description: Device name
type: string
encrypted:
description: Encrypted is whether the volume should be encrypted
or not.
type: boolean
encryptionKey:
description: EncryptionKey is the KMS key to use to encrypt
the volume. Can be either a KMS key ID or ARN. If Encrypted
is set and this is omitted, the default AWS key will be
used. The key must already exist and be accessible by the
controller.
type: string
iops:
description: IOPS is the number of IOPS requested for the
disk. Not applicable to all types.
format: int64
type: integer
size:
description: Size specifies size (in Gi) of the storage device.
Must be greater than the image snapshot size or 8 (whichever
is greater).
format: int64
minimum: 8
type: integer
throughput:
description: Throughput to provision in MiB/s supported for
the volume type. Not applicable to all types.
format: int64
type: integer
type:
description: Type is the type of the volume (e.g. gp2, io1,
etc...).
type: string
required:
- size
type: object
spotMarketOptions:
description: SpotMarketOptions are options for configuring AWSMachinePool
instances to be run using AWS Spot instances.
properties:
maxPrice:
description: MaxPrice defines the maximum price the user is
willing to pay for Spot VM instances
type: string
type: object
sshKeyName:
description: SSHKeyName is the name of the ssh key to attach to
the instance. Valid values are empty string (do not use SSH
keys), a valid SSH key name, or omitted (use the default SSH
key name)
type: string
versionNumber:
description: 'VersionNumber is the version of the launch template
that is applied. Typically a new version is created when at
least one of the following happens: 1) A new launch template
spec is applied. 2) One or more parameters in an existing template
is changed. 3) A new AMI is discovered.'
format: int64
type: integer
type: object
capacityType:
default: onDemand
description: CapacityType specifies the capacity type for the ASG
Expand Down Expand Up @@ -761,6 +925,12 @@ spec:
events to the MachinePool object and/or logged in the controller's
output."
type: string
launchTemplateID:
description: The ID of the launch template
type: string
launchTemplateVersion:
description: The version of the launch template
type: string
ready:
default: false
description: Ready denotes that the AWSManagedMachinePool nodegroup
Expand Down
3 changes: 3 additions & 0 deletions controlplane/eks/api/v1beta1/awsmanagedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
const (
// ManagedControlPlaneFinalizer allows the controller to clean up resources on delete.
ManagedControlPlaneFinalizer = "awsmanagedcontrolplane.controlplane.cluster.x-k8s.io"

// AWSManagedControlPlaneKind is the Kind of AWSManagedControlPlane.
AWSManagedControlPlaneKind = "AWSManagedControlPlane"
)

// AWSManagedControlPlaneSpec defines the desired state of an Amazon EKS Cluster.
Expand Down
70 changes: 69 additions & 1 deletion docs/book/src/crd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18283,7 +18283,7 @@ FargateProfileStatus
<h3 id="infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">AWSLaunchTemplate
</h3>
<p>
(<em>Appears on:</em><a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSMachinePoolSpec">AWSMachinePoolSpec</a>)
(<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>)
</p>
<p>
<p>AWSLaunchTemplate defines the desired state of AWSLaunchTemplate.</p>
Expand Down Expand Up @@ -18956,6 +18956,18 @@ string
</tr>
<tr>
<td>
<code>launchTemplateVersion</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>The version of the launch template</p>
</td>
</tr>
<tr>
<td>
<code>failureReason</code><br/>
<em>
<a href="https://pkg.go.dev/sigs.k8s.io/[email protected]/errors#MachineStatusError">
Expand Down Expand Up @@ -19292,6 +19304,22 @@ UpdateConfig
to the nodegroup.</p>
</td>
</tr>
<tr>
<td>
<code>awsLaunchTemplate</code><br/>
<em>
<a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">
AWSLaunchTemplate
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>AWSLaunchTemplate specifies the launch template to use to create the managed node group.
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
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>
</td>
</tr>
</table>
</td>
</tr>
Expand Down Expand Up @@ -19557,6 +19585,22 @@ UpdateConfig
to the nodegroup.</p>
</td>
</tr>
<tr>
<td>
<code>awsLaunchTemplate</code><br/>
<em>
<a href="#infrastructure.cluster.x-k8s.io/v1beta1.AWSLaunchTemplate">
AWSLaunchTemplate
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>AWSLaunchTemplate specifies the launch template to use to create the managed node group.
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
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>
</td>
</tr>
</tbody>
</table>
<h3 id="infrastructure.cluster.x-k8s.io/v1beta1.AWSManagedMachinePoolStatus">AWSManagedMachinePoolStatus
Expand Down Expand Up @@ -19601,6 +19645,30 @@ int32
</tr>
<tr>
<td>
<code>launchTemplateID</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>The ID of the launch template</p>
</td>
</tr>
<tr>
<td>
<code>launchTemplateVersion</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>The version of the launch template</p>
</td>
</tr>
<tr>
<td>
<code>failureReason</code><br/>
<em>
<a href="https://pkg.go.dev/sigs.k8s.io/[email protected]/errors#MachineStatusError">
Expand Down
19 changes: 19 additions & 0 deletions exp/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (r *AWSMachinePool) ConvertTo(dstRaw conversion.Hub) error {
infrav1alpha3.RestoreRootVolume(restored.Spec.AWSLaunchTemplate.RootVolume, dst.Spec.AWSLaunchTemplate.RootVolume)
}
dst.Spec.AWSLaunchTemplate.SpotMarketOptions = restored.Spec.AWSLaunchTemplate.SpotMarketOptions
dst.Status.LaunchTemplateVersion = restored.Status.LaunchTemplateVersion
return nil
}

Expand Down Expand Up @@ -93,6 +94,9 @@ func (r *AWSManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.CapacityType = restored.Spec.CapacityType
dst.Spec.RoleAdditionalPolicies = restored.Spec.RoleAdditionalPolicies
dst.Spec.UpdateConfig = restored.Spec.UpdateConfig
dst.Spec.AWSLaunchTemplate = restored.Spec.AWSLaunchTemplate
dst.Status.LaunchTemplateID = restored.Status.LaunchTemplateID
dst.Status.LaunchTemplateVersion = restored.Status.LaunchTemplateVersion

return nil
}
Expand Down Expand Up @@ -169,6 +173,21 @@ func Convert_v1beta1_AWSManagedMachinePoolSpec_To_v1alpha3_AWSManagedMachinePool
return autoConvert_v1beta1_AWSManagedMachinePoolSpec_To_v1alpha3_AWSManagedMachinePoolSpec(in, out, s)
}

// Convert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus is a conversion function.
func Convert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus(in *infrav1exp.AWSManagedMachinePoolStatus, out *AWSManagedMachinePoolStatus, s apiconversion.Scope) error {
return autoConvert_v1beta1_AWSManagedMachinePoolStatus_To_v1alpha3_AWSManagedMachinePoolStatus(in, out, s)
}

// Convert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus is a conversion function.
func Convert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus(in *infrav1exp.AWSMachinePoolStatus, out *AWSMachinePoolStatus, s apiconversion.Scope) error {
return autoConvert_v1beta1_AWSMachinePoolStatus_To_v1alpha3_AWSMachinePoolStatus(in, out, s)
}

// Convert_v1beta1_Instance_To_v1alpha3_Instance is a conversion function.
func Convert_v1beta1_Instance_To_v1alpha3_Instance(in *infrav1.Instance, out *infrav1alpha3.Instance, s apiconversion.Scope) error {
return infrav1alpha3.Convert_v1beta1_Instance_To_v1alpha3_Instance(in, out, s)
}

// Convert_v1alpha3_Instance_To_v1beta1_Instance is a conversion function.
func Convert_v1alpha3_Instance_To_v1beta1_Instance(in *infrav1alpha3.Instance, out *infrav1.Instance, s apiconversion.Scope) error {
return infrav1alpha3.Convert_v1alpha3_Instance_To_v1beta1_Instance(in, out, s)
Expand Down
Loading