Skip to content

Conversation

afarbos
Copy link
Contributor

@afarbos afarbos commented Jul 31, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds support for node auto repair configuration in EKS managed node groups. Node auto repair is a feature that allows EKS to automatically repair unhealthy nodes by replacing them, helping maintain cluster health and availability.

https://aws.amazon.com/about-aws/whats-new/2024/12/node-health-monitoring-auto-repair-amazon-eks/

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

  • API Types: Added NodeRepairConfig field to AWSManagedMachinePoolSpec with an enabled boolean field
  • EKS Service: Integrated node repair configuration into node group creation and update logic
  • Converters: Added NodegroupRepairConfigToSDK and NodegroupRepairConfigFromSDK functions
  • Tests: Added comprehensive unit tests for the new converter functions

Checklist:

  • squashed commits
  • includes documentation
  • includes emoji in title
  • adds unit tests
  • adds or updates e2e tests

Release note:

Added support for configuring node auto repair functionality in EKS managed node groups

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 31, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @afarbos. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dlipovetsky for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@afarbos afarbos force-pushed the af/EKSNodeRepair branch 4 times, most recently from c29aa17 to 308295b Compare July 31, 2025 17:46
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 31, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2025
}

// NodeRepairConfig defines the node auto repair configuration for managed node groups.
type NodeRepairConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance to extend this struct (adding more fields) ? if not, then adding autoNodeRepair boolean field under spec is better

Copy link
Contributor Author

@afarbos afarbos Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is are more fields, see https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/[email protected]/types#NodeRepairConfig / https://docs.aws.amazon.com/eks/latest/APIReference/API_NodeRepairConfig.html Do you want me to add support for all?
Note: those did not exist when this PR was created

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine as a struct, given that more options may be supported in the future. Is enabled enough as default to get the feature to work nicely? If yes, I think we can live with only the enabled field for now.

@serngawy
Copy link
Contributor

serngawy commented Oct 1, 2025

@afarbos rebase is required for the PR

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2025
@afarbos
Copy link
Contributor Author

afarbos commented Oct 6, 2025

@afarbos rebase is required for the PR

rebased

@afarbos afarbos requested a review from serngawy October 6, 2025 16:55
}

// NodeRepairConfig defines the node auto repair configuration for managed node groups.
type NodeRepairConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine as a struct, given that more options may be supported in the future. Is enabled enough as default to get the feature to work nicely? If yes, I think we can live with only the enabled field for now.

Comment on lines +220 to +221
// NodegroupRepairConfigToSDK is used to convert a CAPA NodeRepairConfig to AWS SDK NodeRepairConfig.
func NodegroupRepairConfigToSDK(repairConfig *expinfrav1.NodeRepairConfig) *ekstypes.NodeRepairConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NodegroupRepairConfigToSDK is used to convert a CAPA NodeRepairConfig to AWS SDK NodeRepairConfig.
func NodegroupRepairConfigToSDK(repairConfig *expinfrav1.NodeRepairConfig) *ekstypes.NodeRepairConfig {
// NodeRepairConfigToSDK is used to convert a CAPA NodeRepairConfig to AWS SDK NodeRepairConfig.
func NodeRepairConfigToSDK(repairConfig *expinfrav1.NodeRepairConfig) *ekstypes.NodeRepairConfig {

expinfrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/exp/api/v1beta2"
)

func TestNodegroupRepairConfigToSDK(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func TestNodegroupRepairConfigToSDK(t *testing.T) {
func TestNodeRepairConfigToSDK(t *testing.T) {

return
}
if result == nil || tt.expected == nil {
t.Errorf("NodegroupRepairConfigToSDK() = %v, want %v", result, tt.expected)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Errorf("NodegroupRepairConfigToSDK() = %v, want %v", result, tt.expected)
t.Errorf("NodeRepairConfigToSDK() = %v, want %v", result, tt.expected)

[repeated]

Comment on lines +58 to +61
if result == nil && tt.expected == nil {
return
}
if result == nil || tt.expected == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if result == nil && tt.expected == nil {
return
}
if result == nil || tt.expected == nil {
if result == nil {

...as the function shouldn't return nil

t.Errorf("NodegroupRepairConfigToSDK() = %v, want %v", result, tt.expected)
return
}
if *result.Enabled != *tt.expected.Enabled {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead use reflect.DeepEqual or something else that diffs the whole struct at once? That will be easier once new fields become supported in CAPA.

@AndiDog AndiDog self-assigned this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants