From 40a8f41b16a8516c96ead863a80f43007b621ec1 Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Fri, 7 Nov 2025 00:35:55 +0900 Subject: [PATCH 1/6] Add support for multiple instance types in AWSManagedMachinePool --- ...uster.x-k8s.io_awsmanagedmachinepools.yaml | 10 +++++ exp/api/v1beta1/conversion.go | 24 +++++++++++- exp/api/v1beta1/zz_generated.conversion.go | 1 + .../v1beta2/awsmanagedmachinepool_types.go | 8 ++++ .../v1beta2/awsmanagedmachinepool_webhook.go | 25 ++++++++++++ exp/api/v1beta2/zz_generated.deepcopy.go | 5 +++ pkg/cloud/services/eks/nodegroup.go | 6 ++- test-awsmanagedmachinepool.yaml | 39 +++++++++++++++++++ 8 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 test-awsmanagedmachinepool.yaml diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml index 92927218c1..ce573dede4 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml @@ -933,6 +933,16 @@ spec: instanceType: description: InstanceType specifies the AWS instance type type: string + instanceTypes: + description: |- + InstanceTypes specifies a list of AWS instance types for the node group. + When specified, this allows using multiple instance types which enhances + the availability of Spot instances. + At most one of InstanceType or InstanceTypes may be specified. + See https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types + items: + type: string + type: array labels: additionalProperties: type: string diff --git a/exp/api/v1beta1/conversion.go b/exp/api/v1beta1/conversion.go index 7b49ed9f64..c0356a51b5 100644 --- a/exp/api/v1beta1/conversion.go +++ b/exp/api/v1beta1/conversion.go @@ -147,6 +147,14 @@ func (src *AWSManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.RolePath = restored.Spec.RolePath dst.Spec.RolePermissionsBoundary = restored.Spec.RolePermissionsBoundary + // Restore InstanceType and InstanceTypes from the hub version + // v1beta1 doesn't have InstanceTypes, but v1beta2 does + // We preserve the exact state through the annotation-based conversion data + // This includes cases where both fields are set (even though webhook would reject it) + // to ensure fuzzy conversion tests pass + dst.Spec.InstanceType = restored.Spec.InstanceType + dst.Spec.InstanceTypes = restored.Spec.InstanceTypes + if restored.Spec.NodeRepairConfig != nil { dst.Spec.NodeRepairConfig = restored.Spec.NodeRepairConfig } @@ -162,12 +170,26 @@ func (r *AWSManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error { return err } + // Preserve v1beta2 data through annotation + // This ensures fuzzy conversion tests pass return utilconversion.MarshalData(src, r) } // Convert_v1beta2_AWSManagedMachinePoolSpec_To_v1beta1_AWSManagedMachinePoolSpec is a conversion function. func Convert_v1beta2_AWSManagedMachinePoolSpec_To_v1beta1_AWSManagedMachinePoolSpec(in *expinfrav1.AWSManagedMachinePoolSpec, out *AWSManagedMachinePoolSpec, s apiconversion.Scope) error { - return autoConvert_v1beta2_AWSManagedMachinePoolSpec_To_v1beta1_AWSManagedMachinePoolSpec(in, out, s) + if err := autoConvert_v1beta2_AWSManagedMachinePoolSpec_To_v1beta1_AWSManagedMachinePoolSpec(in, out, s); err != nil { + return err + } + + // Convert v1beta2 InstanceTypes or InstanceType to v1beta1 InstanceType + // Prefer InstanceTypes if set (use first element), otherwise use InstanceType + if len(in.InstanceTypes) > 0 { + out.InstanceType = &in.InstanceTypes[0] + } else if in.InstanceType != nil { + out.InstanceType = in.InstanceType + } + + return nil } func Convert_v1beta2_AWSMachinePoolStatus_To_v1beta1_AWSMachinePoolStatus(in *expinfrav1.AWSMachinePoolStatus, out *AWSMachinePoolStatus, s apiconversion.Scope) error { diff --git a/exp/api/v1beta1/zz_generated.conversion.go b/exp/api/v1beta1/zz_generated.conversion.go index 66003781a3..9826360850 100644 --- a/exp/api/v1beta1/zz_generated.conversion.go +++ b/exp/api/v1beta1/zz_generated.conversion.go @@ -733,6 +733,7 @@ func autoConvert_v1beta2_AWSManagedMachinePoolSpec_To_v1beta1_AWSManagedMachineP out.Taints = *(*Taints)(unsafe.Pointer(&in.Taints)) out.DiskSize = (*int32)(unsafe.Pointer(in.DiskSize)) out.InstanceType = (*string)(unsafe.Pointer(in.InstanceType)) + // WARNING: in.InstanceTypes requires manual conversion: does not exist in peer-type out.Scaling = (*ManagedMachinePoolScaling)(unsafe.Pointer(in.Scaling)) out.RemoteAccess = (*ManagedRemoteAccess)(unsafe.Pointer(in.RemoteAccess)) out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) diff --git a/exp/api/v1beta2/awsmanagedmachinepool_types.go b/exp/api/v1beta2/awsmanagedmachinepool_types.go index 28bff362f6..52660240e3 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_types.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_types.go @@ -180,6 +180,14 @@ type AWSManagedMachinePoolSpec struct { // +optional InstanceType *string `json:"instanceType,omitempty"` + // InstanceTypes specifies a list of AWS instance types for the node group. + // When specified, this allows using multiple instance types which enhances + // the availability of Spot instances. + // At most one of InstanceType or InstanceTypes may be specified. + // See https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types + // +optional + InstanceTypes []string `json:"instanceTypes,omitempty"` + // Scaling specifies scaling for the ASG behind this pool // +optional Scaling *ManagedMachinePoolScaling `json:"scaling,omitempty"` diff --git a/exp/api/v1beta2/awsmanagedmachinepool_webhook.go b/exp/api/v1beta2/awsmanagedmachinepool_webhook.go index 38ceffe3f3..3c31e8707a 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_webhook.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_webhook.go @@ -124,6 +124,20 @@ func (r *AWSManagedMachinePool) validateRemoteAccess() field.ErrorList { return allErrs } +func (r *AWSManagedMachinePool) validateInstanceTypes() field.ErrorList { + var allErrs field.ErrorList + + // InstanceType and InstanceTypes are mutually exclusive + if r.Spec.InstanceType != nil && len(r.Spec.InstanceTypes) > 0 { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec", "InstanceTypes"), + r.Spec.InstanceTypes, + "cannot specify both instanceType and instanceTypes. Use instanceTypes for multiple instance types or instanceType for a single instance type")) + } + + return allErrs +} + func (r *AWSManagedMachinePool) validateLaunchTemplate() field.ErrorList { var allErrs field.ErrorList if r.Spec.AWSLaunchTemplate == nil { @@ -133,6 +147,9 @@ func (r *AWSManagedMachinePool) validateLaunchTemplate() field.ErrorList { if r.Spec.InstanceType != nil { allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "InstanceType"), r.Spec.InstanceType, "InstanceType cannot be specified when LaunchTemplate is specified")) } + if len(r.Spec.InstanceTypes) > 0 { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "InstanceTypes"), r.Spec.InstanceTypes, "InstanceTypes cannot be specified when LaunchTemplate is specified")) + } if r.Spec.DiskSize != nil { allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "DiskSize"), r.Spec.DiskSize, "DiskSize cannot be specified when LaunchTemplate is specified")) } @@ -171,6 +188,9 @@ func (*awsManagedMachinePoolWebhook) ValidateCreate(_ context.Context, obj runti if errs := r.validateNodegroupUpdateConfig(); len(errs) > 0 { allErrs = append(allErrs, errs...) } + if errs := r.validateInstanceTypes(); len(errs) > 0 { + allErrs = append(allErrs, errs...) + } if errs := r.validateLaunchTemplate(); len(errs) > 0 { allErrs = append(allErrs, errs...) } @@ -216,6 +236,9 @@ func (*awsManagedMachinePoolWebhook) ValidateUpdate(_ context.Context, oldObj, n if errs := r.validateNodegroupUpdateConfig(); len(errs) > 0 { allErrs = append(allErrs, errs...) } + if errs := r.validateInstanceTypes(); len(errs) > 0 { + allErrs = append(allErrs, errs...) + } if errs := r.validateLaunchTemplate(); len(errs) > 0 { allErrs = append(allErrs, errs...) } @@ -265,6 +288,8 @@ func (r *AWSManagedMachinePool) validateImmutable(old *AWSManagedMachinePool) fi appendErrorIfMutated(old.Spec.SubnetIDs, r.Spec.SubnetIDs, "subnetIDs") appendErrorIfSetAndMutated(old.Spec.RoleName, r.Spec.RoleName, "roleName") appendErrorIfMutated(old.Spec.DiskSize, r.Spec.DiskSize, "diskSize") + appendErrorIfMutated(old.Spec.InstanceType, r.Spec.InstanceType, "instanceType") + appendErrorIfMutated(old.Spec.InstanceTypes, r.Spec.InstanceTypes, "instanceTypes") appendErrorIfMutated(old.Spec.AMIType, r.Spec.AMIType, "amiType") appendErrorIfMutated(old.Spec.RemoteAccess, r.Spec.RemoteAccess, "remoteAccess") appendErrorIfSetAndMutated(old.Spec.CapacityType, r.Spec.CapacityType, "capacityType") diff --git a/exp/api/v1beta2/zz_generated.deepcopy.go b/exp/api/v1beta2/zz_generated.deepcopy.go index 9a19d29f0e..ab7aefcd21 100644 --- a/exp/api/v1beta2/zz_generated.deepcopy.go +++ b/exp/api/v1beta2/zz_generated.deepcopy.go @@ -532,6 +532,11 @@ func (in *AWSManagedMachinePoolSpec) DeepCopyInto(out *AWSManagedMachinePoolSpec *out = new(string) **out = **in } + if in.InstanceTypes != nil { + in, out := &in.InstanceTypes, &out.InstanceTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.Scaling != nil { in, out := &in.Scaling, &out.Scaling *out = new(ManagedMachinePoolScaling) diff --git a/pkg/cloud/services/eks/nodegroup.go b/pkg/cloud/services/eks/nodegroup.go index 79110fb30e..386c8329aa 100644 --- a/pkg/cloud/services/eks/nodegroup.go +++ b/pkg/cloud/services/eks/nodegroup.go @@ -231,7 +231,11 @@ func (s *NodegroupService) createNodegroup(ctx context.Context) (*ekstypes.Nodeg if managedPool.DiskSize != nil { input.DiskSize = managedPool.DiskSize } - if managedPool.InstanceType != nil { + // Support both InstanceTypes (preferred for multiple types) and InstanceType (for single type) + // Webhook validation ensures they are mutually exclusive + if len(managedPool.InstanceTypes) > 0 { + input.InstanceTypes = managedPool.InstanceTypes + } else if managedPool.InstanceType != nil { input.InstanceTypes = []string{aws.ToString(managedPool.InstanceType)} } if len(managedPool.Taints) > 0 { diff --git a/test-awsmanagedmachinepool.yaml b/test-awsmanagedmachinepool.yaml new file mode 100644 index 0000000000..2003ea1181 --- /dev/null +++ b/test-awsmanagedmachinepool.yaml @@ -0,0 +1,39 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: AWSManagedMachinePool +metadata: + name: test-pool-multiple-instance-types + namespace: default +spec: + eksNodegroupName: test-nodegroup + # Use instanceTypes (plural) to specify multiple instance types + # This enhances availability when using Spot instances + instanceTypes: + - t3.medium + - t3a.medium + - t2.medium + capacityType: spot + scaling: + minSize: 1 + maxSize: 10 + updateConfig: + maxUnavailable: 1 + tags: + usage: test +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: AWSManagedMachinePool +metadata: + name: test-pool-single-instance-type + namespace: default +spec: + eksNodegroupName: test-nodegroup-single + # Use instanceType (singular) for a single instance type (backward compatible) + instanceType: t3.medium + capacityType: on-demand + scaling: + minSize: 1 + maxSize: 5 + updateConfig: + maxUnavailable: 1 + tags: + usage: test From 2336b84a629c2b87fa1691f4b7c8d53a7d48fb2c Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Fri, 7 Nov 2025 09:33:53 +0900 Subject: [PATCH 2/6] Add deprecation notice and improve documentation for InstanceType field --- ...uster.x-k8s.io_awsmanagedmachinepools.yaml | 12 +- .../v1beta2/awsmanagedmachinepool_types.go | 11 +- .../v1beta2/awsmanagedmachinepool_webhook.go | 5 + .../awsmanagedmachinepool_webhook_test.go | 139 ++++++++++++++++++ 4 files changed, 159 insertions(+), 8 deletions(-) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml index ce573dede4..30d133c04d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml @@ -931,15 +931,19 @@ spec: name of the managed machine pool. type: string instanceType: - description: InstanceType specifies the AWS instance type + description: |- + InstanceType specifies the AWS instance type. + This field is deprecated. Use InstanceTypes instead. type: string instanceTypes: description: |- InstanceTypes specifies a list of AWS instance types for the node group. - When specified, this allows using multiple instance types which enhances - the availability of Spot instances. + The order of instance types specified determines priority of picking that instance type. + This is also influenced by the CapacityType. For On-Demand capacity, the allocation strategy + uses the order of instance types to determine which instance type to use first when fulfilling capacity. + See AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types + for more information. At most one of InstanceType or InstanceTypes may be specified. - See https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types items: type: string type: array diff --git a/exp/api/v1beta2/awsmanagedmachinepool_types.go b/exp/api/v1beta2/awsmanagedmachinepool_types.go index 52660240e3..d7a34d8233 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_types.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_types.go @@ -176,15 +176,18 @@ type AWSManagedMachinePoolSpec struct { // +optional DiskSize *int32 `json:"diskSize,omitempty"` - // InstanceType specifies the AWS instance type + // InstanceType specifies the AWS instance type. + // This field is deprecated. Use InstanceTypes instead. // +optional InstanceType *string `json:"instanceType,omitempty"` // InstanceTypes specifies a list of AWS instance types for the node group. - // When specified, this allows using multiple instance types which enhances - // the availability of Spot instances. + // The order of instance types specified determines priority of picking that instance type. + // This is also influenced by the CapacityType. For On-Demand capacity, the allocation strategy + // uses the order of instance types to determine which instance type to use first when fulfilling capacity. + // See AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types + // for more information. // At most one of InstanceType or InstanceTypes may be specified. - // See https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types // +optional InstanceTypes []string `json:"instanceTypes,omitempty"` diff --git a/exp/api/v1beta2/awsmanagedmachinepool_webhook.go b/exp/api/v1beta2/awsmanagedmachinepool_webhook.go index 3c31e8707a..6e8c81bf3a 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_webhook.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_webhook.go @@ -200,6 +200,11 @@ func (*awsManagedMachinePoolWebhook) ValidateCreate(_ context.Context, obj runti allErrs = append(allErrs, r.Spec.AdditionalTags.Validate()...) + // Log deprecation warning for InstanceType field + if r.Spec.InstanceType != nil { + mmpLog.Info("spec.instanceType is deprecated, use spec.instanceTypes instead", "managed-machine-pool", klog.KObj(r)) + } + if len(allErrs) == 0 { return nil, nil } diff --git a/exp/api/v1beta2/awsmanagedmachinepool_webhook_test.go b/exp/api/v1beta2/awsmanagedmachinepool_webhook_test.go index 34401a3cec..951bd2d733 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_webhook_test.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_webhook_test.go @@ -155,6 +155,37 @@ func TestAWSManagedMachinePoolValidateCreate(t *testing.T) { }, wantErr: false, }, + { + name: "both instanceType and instanceTypes are specified", + pool: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-4", + InstanceTypes: []string{"m5.xlarge", "m5.2xlarge"}, + InstanceType: ptr.To("m5.xlarge"), + }, + }, + wantErr: true, + }, + { + name: "only instanceTypes is accepted", + pool: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-5", + InstanceTypes: []string{"m5.xlarge", "m5.2xlarge"}, + }, + }, + wantErr: false, + }, + { + name: "only instanceType is accepted", + pool: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-6", + InstanceType: ptr.To("m5.xlarge"), + }, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -693,6 +724,114 @@ func TestAWSManagedMachinePoolValidateUpdate(t *testing.T) { }, wantErr: false, }, + { + name: "adding instanceType is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceType: ptr.To("m5.xlarge"), + }, + }, + wantErr: true, + }, + { + name: "removing instanceType is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceType: ptr.To("m5.xlarge"), + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + }, + }, + wantErr: true, + }, + { + name: "changing instanceType is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceType: ptr.To("m5.xlarge"), + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceType: ptr.To("m5.2xlarge"), + }, + }, + wantErr: true, + }, + { + name: "adding instanceTypes is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceTypes: []string{"m5.xlarge", "m5.2xlarge"}, + }, + }, + wantErr: true, + }, + { + name: "removing instanceTypes is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceTypes: []string{"m5.xlarge", "m5.2xlarge"}, + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + }, + }, + wantErr: true, + }, + { + name: "changing instanceTypes is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceTypes: []string{"m5.xlarge", "m5.2xlarge"}, + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceTypes: []string{"m5.xlarge", "m6.xlarge"}, + }, + }, + wantErr: true, + }, + { + name: "adding both instanceType and instanceTypes is rejected", + old: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + }, + }, + new: &AWSManagedMachinePool{ + Spec: AWSManagedMachinePoolSpec{ + EKSNodegroupName: "eks-node-group-1", + InstanceType: ptr.To("m5.xlarge"), + InstanceTypes: []string{"m5.xlarge", "m6.xlarge"}, + }, + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From ecb9ac3ae1f543d2f0ee6d9473c2a49557d3769c Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Sat, 15 Nov 2025 17:05:42 +0900 Subject: [PATCH 3/6] Mark InstanceType field as deprecated with kubebuilder annotation --- ...infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml | 2 +- exp/api/v1beta2/awsmanagedmachinepool_types.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml index 30d133c04d..a679256a86 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml @@ -933,7 +933,7 @@ spec: instanceType: description: |- InstanceType specifies the AWS instance type. - This field is deprecated. Use InstanceTypes instead. + Deprecated: Use InstanceTypes instead. type: string instanceTypes: description: |- diff --git a/exp/api/v1beta2/awsmanagedmachinepool_types.go b/exp/api/v1beta2/awsmanagedmachinepool_types.go index d7a34d8233..348f2611c0 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_types.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_types.go @@ -177,8 +177,9 @@ type AWSManagedMachinePoolSpec struct { DiskSize *int32 `json:"diskSize,omitempty"` // InstanceType specifies the AWS instance type. - // This field is deprecated. Use InstanceTypes instead. + // Deprecated: Use InstanceTypes instead. // +optional + // +kubebuilder:validation:Deprecated InstanceType *string `json:"instanceType,omitempty"` // InstanceTypes specifies a list of AWS instance types for the node group. From 3ac7f79a37a3406cc43936adb15c4f797ca127e3 Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Wed, 26 Nov 2025 21:35:15 +0900 Subject: [PATCH 4/6] Remove redundant comment about InstanceType/InstanceTypes mutual exclusivity --- exp/api/v1beta2/awsmanagedmachinepool_types.go | 1 - 1 file changed, 1 deletion(-) diff --git a/exp/api/v1beta2/awsmanagedmachinepool_types.go b/exp/api/v1beta2/awsmanagedmachinepool_types.go index 348f2611c0..a975664ae0 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_types.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_types.go @@ -188,7 +188,6 @@ type AWSManagedMachinePoolSpec struct { // uses the order of instance types to determine which instance type to use first when fulfilling capacity. // See AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types // for more information. - // At most one of InstanceType or InstanceTypes may be specified. // +optional InstanceTypes []string `json:"instanceTypes,omitempty"` From f6e9be3934cb941ec371b48bdb66c67615c05f1d Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Wed, 26 Nov 2025 21:38:29 +0900 Subject: [PATCH 5/6] docs: add instance type examples to InstanceTypes field comment --- exp/api/v1beta2/awsmanagedmachinepool_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp/api/v1beta2/awsmanagedmachinepool_types.go b/exp/api/v1beta2/awsmanagedmachinepool_types.go index a975664ae0..88f31f6afd 100644 --- a/exp/api/v1beta2/awsmanagedmachinepool_types.go +++ b/exp/api/v1beta2/awsmanagedmachinepool_types.go @@ -185,7 +185,7 @@ type AWSManagedMachinePoolSpec struct { // InstanceTypes specifies a list of AWS instance types for the node group. // The order of instance types specified determines priority of picking that instance type. // This is also influenced by the CapacityType. For On-Demand capacity, the allocation strategy - // uses the order of instance types to determine which instance type to use first when fulfilling capacity. + // uses the order of instance types to determine which instance type to use first when fulfilling capacity for ex; c5.large, c4.large, and c3.large . // See AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types // for more information. // +optional From b712b6c64db00eebb275669bf5392071891363b0 Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Thu, 27 Nov 2025 10:56:50 +0900 Subject: [PATCH 6/6] make generate --- ...infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml index a679256a86..33b742dafe 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml @@ -940,10 +940,9 @@ spec: InstanceTypes specifies a list of AWS instance types for the node group. The order of instance types specified determines priority of picking that instance type. This is also influenced by the CapacityType. For On-Demand capacity, the allocation strategy - uses the order of instance types to determine which instance type to use first when fulfilling capacity. + uses the order of instance types to determine which instance type to use first when fulfilling capacity for ex; c5.large, c4.large, and c3.large . See AWS documentation https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types for more information. - At most one of InstanceType or InstanceTypes may be specified. items: type: string type: array