Skip to content

Conversation

serngawy
Copy link
Contributor

@serngawy serngawy commented Sep 26, 2025

What type of PR is this?

What this PR does / why we need it:

Adding auto node config for karpenter feature

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:

Checklist:

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

Release note:

Add ROSA-HCP auto node feature for karpenter support

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Sep 26, 2025
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 26, 2025
default: disable
description: AutoNode mode allowed values are enable & disable
enum:
- enable

Choose a reason for hiding this comment

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

@serngawy enabled and disabled are the allowed values.

Copy link
Contributor Author

@serngawy serngawy Sep 26, 2025

Choose a reason for hiding this comment

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

the enum values are enabled & disabled. Changed it to match the values.

description: |-
AutoNode role ARN that has the IAM Policy and cluster-specific Role that gives permissions to the Karpenter controller.
IAM policy should be as below AND the role must be attached with the same OIDC-ID that is used with the ROSA-HCP cluster.
{
Copy link

@robpblake robpblake Sep 26, 2025

Choose a reason for hiding this comment

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

@serngawy The Policy for the IAM role is highly likely to change. For the private preview we are giving this to customers via documentation, so I would suggest not to embed it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

AutoNode *AutoNode `json:"autoNode,omitempty"`
}

// AutoNode set the auto nde mode and auto node role ARN.

Choose a reason for hiding this comment

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

@serngawy set the AutoNode mode and AutoNode role ARN

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 26, 2025
If not set, audit log forwarding is disabled.
type: string
autoNode:
description: AutoNode set the autoNode mode and autoNode role ARN.

Choose a reason for hiding this comment

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

@serngawy Minor typo here "A"utoNode rather than "a"utoNode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

@damdo
Copy link
Member

damdo commented Sep 30, 2025

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Sep 30, 2025
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

Left some API suggestions. Thanks

Comment on lines 249 to 266
// AutoNode set the AutoNode mode and AutoNode role ARN.
// +optional
AutoNode *AutoNode `json:"autoNode,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I think this doesn't need to be a pointer right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pointer is easier to check struct value.

Comment on lines 207 to 234
// Test case 7: AutoNode update
t.Run("Update Auto Node", func(t *testing.T) {
rosaControlPlane := &rosacontrolplanev1.ROSAControlPlane{
Spec: rosacontrolplanev1.RosaControlPlaneSpec{
AutoNode: &rosacontrolplanev1.AutoNode{
Mode: rosacontrolplanev1.Enabled,
RoleARN: "autoNodeARN",
},
},
}

mockCluster, _ := v1.NewCluster().
AutoNode(v1.NewClusterAutoNode().Mode("disabled")).
AWS(v1.NewAWS().AutoNode(v1.NewAwsAutoNode().RoleArn("anyARN"))).
Build()

expectedOCMSpec := ocm.Spec{
AutoNodeMode: "enabled",
AutoNodeRoleARN: "autoNodeARN",
}

reconciler := &ROSAControlPlaneReconciler{}
ocmSpec, updated := reconciler.updateOCMClusterSpec(rosaControlPlane, mockCluster)

g.Expect(updated).To(BeTrue())
g.Expect(ocmSpec).To(Equal(expectedOCMSpec))
})
Copy link
Member

Choose a reason for hiding this comment

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

Once we have polished the API above let's define unit tests for the various cases where things are left empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add more test for ValidateControlPlaneSpec below

@damdo
Copy link
Member

damdo commented Sep 30, 2025

/assign @nrb @damdo @richardcase

@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
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2025
@damdo
Copy link
Member

damdo commented Oct 2, 2025

/cherry-pick release-2.9

@k8s-infra-cherrypick-robot

@damdo: once the present PR merges, I will cherry-pick it on top of release-2.9 in a new PR and assign it to you.

In response to this:

/cherry-pick release-2.9

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.

@serngawy
Copy link
Contributor Author

serngawy commented Oct 2, 2025

/test pull-cluster-api-provider-aws-test

Copy link
Contributor

@nrb nrb left a comment

Choose a reason for hiding this comment

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

I ran KAL against this PR and it found some issues that I've marked inline.

I used the CAPI KAL configuration for the analysis.

// +optional
ClusterRegistryConfig *RegistryConfig `json:"clusterRegistryConfig,omitempty"`

// AutoNode set the AutoNode mode and AutoNode role ARN.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this will be exposed as a YAML field, the doc should start with autoNodeMode, rather than the usual Go convention.

Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @serngawy

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ad84c2beaeb2f73718631eee048733984c56952b

@damdo damdo requested a review from nrb October 7, 2025 07:39
@damdo
Copy link
Member

damdo commented Oct 7, 2025

@richardcase @nrb if you are happy with the latest changes, let's try and get this in :) TY

@richardcase
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardcase

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2025
@k8s-ci-robot k8s-ci-robot merged commit 213faa0 into kubernetes-sigs:main Oct 7, 2025
18 checks passed
@k8s-infra-cherrypick-robot

@damdo: #5686 failed to apply on top of branch "release-2.9":

Applying: Add ROSA-HCP AutoNode for karpenter auto scale
Using index info to reconstruct a base tree...
M	config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml
M	controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
M	controlplane/rosa/api/v1beta2/zz_generated.deepcopy.go
M	controlplane/rosa/controllers/rosacontrolplane_controller.go
M	controlplane/rosa/controllers/rosacontrolplane_controller_test.go
M	go.mod
M	go.sum
Falling back to patching base and 3-way merge...
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
Auto-merging controlplane/rosa/controllers/rosacontrolplane_controller_test.go
Auto-merging controlplane/rosa/controllers/rosacontrolplane_controller.go
CONFLICT (content): Merge conflict in controlplane/rosa/controllers/rosacontrolplane_controller.go
Auto-merging controlplane/rosa/api/v1beta2/zz_generated.deepcopy.go
CONFLICT (content): Merge conflict in controlplane/rosa/api/v1beta2/zz_generated.deepcopy.go
Auto-merging controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Auto-merging config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Add ROSA-HCP AutoNode for karpenter auto scale

In response to this:

/cherry-pick release-2.9

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.

@serngawy
Copy link
Contributor Author

serngawy commented Oct 7, 2025

/cherry-pick release-2.9

@k8s-infra-cherrypick-robot

@serngawy: new pull request created: #5699

In response to this:

/cherry-pick release-2.9

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants