Skip to content

Commit ea64b16

Browse files
authored
feat(cluster): Add control plane scaling configuration support (#240)
Issue #, if available: [community#2972](aws-controllers-k8s/community#2972) Description of changes: - Un-ignore CreateClusterInput/Output.ControlPlaneScalingConfig in generator.yaml and regenerate the API types, SDK, CRDs, and deepcopy code - Add a custom update path (`updateControlPlaneScalingConfig`) that calls `UpdateClusterConfig` and requeues on `ResourceInUseException`, plus delta comparison for `Spec.ControlPlaneScalingConfig.Tier` - Handle the AWS-populated default tier: `customPreCompare` copies the latest value onto desired when unset, and Tier is late-initialized so the server-assigned default is reflected back into Spec without a perpetual diff - Add an e2e test that creates a cluster with tier "standard" and updates it to "tier-xl", verifying the change via `DescribeCluster` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 64b54b9 commit ea64b16

14 files changed

Lines changed: 521 additions & 278 deletions
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2026-08-04T17:39:48Z"
2+
build_date: "2026-08-07T17:49:33Z"
33
build_hash: db232581a560896c2dc461a244f96d5bf3191ec6
4-
go_version: go1.26.5
4+
go_version: go1.26.0
55
version: v0.62.0
6-
api_directory_checksum: 621c93f1d724aa33a1f78e47c25d6eb2ddf629e1
6+
api_directory_checksum: 2b5287d0ef597d7039841a4cb7f7ffcb11e36bf8
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.41.2
99
generator_config_info:
10-
file_checksum: db46c605be19c5941469cfff7e4d18f4af00754f
10+
file_checksum: 5a8408f5d7d6b65570ded0a2505a15c2d89d2ab1
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/cluster.go

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

apis/v1alpha1/generator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ resources:
197197
late_initialize: {}
198198
compare:
199199
pre_delete_include: true
200+
ControlPlaneScalingConfig.Tier:
201+
late_initialize: {}
200202
exceptions:
201203
errors:
202204
404:
@@ -635,5 +637,3 @@ ignore:
635637
- CreateCapabilityInput.ClientRequestToken
636638
- CreateAddonInput.NamespaceConfig
637639
- CreateAddonOutput.Addon.NamespaceConfig
638-
- CreateClusterInput.ControlPlaneScalingConfig
639-
- CreateClusterOutput.Cluster.ControlPlaneScalingConfig

apis/v1alpha1/types.go

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

apis/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/eks.services.k8s.aws_clusters.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ spec:
102102
nodeRoleARN:
103103
type: string
104104
type: object
105+
controlPlaneScalingConfig:
106+
description: |-
107+
The control plane scaling tier configuration. For more information, see EKS
108+
Provisioned Control Plane in the Amazon EKS User Guide.
109+
properties:
110+
tier:
111+
type: string
112+
type: object
105113
deletionProtection:
106114
description: |-
107115
Indicates whether to enable deletion protection for the cluster. When enabled,

generator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ resources:
197197
late_initialize: {}
198198
compare:
199199
pre_delete_include: true
200+
ControlPlaneScalingConfig.Tier:
201+
late_initialize: {}
200202
exceptions:
201203
errors:
202204
404:
@@ -635,5 +637,3 @@ ignore:
635637
- CreateCapabilityInput.ClientRequestToken
636638
- CreateAddonInput.NamespaceConfig
637639
- CreateAddonOutput.Addon.NamespaceConfig
638-
- CreateClusterInput.ControlPlaneScalingConfig
639-
- CreateClusterOutput.Cluster.ControlPlaneScalingConfig

helm/crds/eks.services.k8s.aws_clusters.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ spec:
102102
nodeRoleARN:
103103
type: string
104104
type: object
105+
controlPlaneScalingConfig:
106+
description: |-
107+
The control plane scaling tier configuration. For more information, see EKS
108+
Provisioned Control Plane in the Amazon EKS User Guide.
109+
properties:
110+
tier:
111+
type: string
112+
type: object
105113
deletionProtection:
106114
description: |-
107115
Indicates whether to enable deletion protection for the cluster. When enabled,

pkg/resource/cluster/delta.go

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

pkg/resource/cluster/hook.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ func customPreCompare(
191191
if a.ko.Spec.UpgradePolicy == nil && b.ko.Spec.UpgradePolicy != nil {
192192
a.ko.Spec.UpgradePolicy = b.ko.Spec.UpgradePolicy.DeepCopy()
193193
}
194+
if a.ko.Spec.ControlPlaneScalingConfig == nil && b.ko.Spec.ControlPlaneScalingConfig != nil {
195+
a.ko.Spec.ControlPlaneScalingConfig = b.ko.Spec.ControlPlaneScalingConfig.DeepCopy()
196+
}
194197
}
195198

196199
func (rm *resourceManager) customUpdate(
@@ -416,6 +419,21 @@ func (rm *resourceManager) customUpdate(
416419
return returnClusterUpdating(updatedRes)
417420
}
418421

422+
// Handle controlPlaneScalingConfig updates
423+
if delta.DifferentAt("Spec.ControlPlaneScalingConfig") {
424+
if err := rm.updateControlPlaneScalingConfig(ctx, desired); err != nil {
425+
awsErr, ok := extractAWSError(err)
426+
427+
// Check to see if we've raced an async update call and need to requeue
428+
if ok && awsErr.Code == "ResourceInUseException" {
429+
return nil, requeueAfterAsyncUpdate()
430+
}
431+
432+
return nil, err
433+
}
434+
return returnClusterUpdating(updatedRes)
435+
}
436+
419437
// Handle deletionProtection updates
420438
if delta.DifferentAt("Spec.DeletionProtection") {
421439
if err := rm.updateDeletionProtection(ctx, desired); err != nil {
@@ -764,6 +782,33 @@ func (rm *resourceManager) updateZonalShiftConfig(
764782
return nil
765783
}
766784

785+
// updateControlPlaneScalingConfig updates the control plane scaling tier of
786+
// the cluster.
787+
func (rm *resourceManager) updateControlPlaneScalingConfig(
788+
ctx context.Context,
789+
r *resource,
790+
) (err error) {
791+
rlog := ackrtlog.FromContext(ctx)
792+
exit := rlog.Trace("rm.updateControlPlaneScalingConfig")
793+
defer exit(err)
794+
795+
input := &svcsdk.UpdateClusterConfigInput{
796+
Name: r.ko.Spec.Name,
797+
ControlPlaneScalingConfig: &svcsdktypes.ControlPlaneScalingConfig{},
798+
}
799+
if r.ko.Spec.ControlPlaneScalingConfig.Tier != nil {
800+
input.ControlPlaneScalingConfig.Tier = svcsdktypes.ProvisionedControlPlaneTier(*r.ko.Spec.ControlPlaneScalingConfig.Tier)
801+
}
802+
803+
_, err = rm.sdkapi.UpdateClusterConfig(ctx, input)
804+
rm.metrics.RecordAPICall("UPDATE", "UpdateClusterConfig", err)
805+
if err != nil {
806+
return err
807+
}
808+
809+
return nil
810+
}
811+
767812
func (rm *resourceManager) updateDeletionProtection(
768813
ctx context.Context,
769814
r *resource,

0 commit comments

Comments
 (0)