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

feat: Add instance profile generation for v1beta1/NodeClass #4575

Merged
merged 6 commits into from
Sep 22, 2023

Conversation

jonathan-innis
Copy link
Contributor

@jonathan-innis jonathan-innis commented Sep 6, 2023

Fixes #N/A

Description

This change adds instance profile generation when specifying a role in the v1beta1/NodeClass. This will not change the ways that instance profiles can be specified with the v1alpha5/Provisioner.

Starting in v1beta1, you will be required to specify a role in your EC2NodeClass like

apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
  name: default
spec:
  role: KarpenterNodeRole-karpenter-test
...

Karpenter will provision an instance profile that uses this role and propagate that profile into the EC2NodeClass status

apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
  name: default
spec:
  role: KarpenterNodeRole-karpenter-test
...
status:
  instanceProfile: karpenter-test_1234567890123456789

To ensure that instances that are using this instance profile are able to safely terminate, we now enforce that any v1beta1/NodeClaim that is using the EC2NodeClass must be removed before the EC2NodeClass will remove the instance profile and terminate. You can view this through the eventing logic like

karpenter git:(v1beta1-testing) k describe ec2nodeclasses default
...
Events:
  Type    Reason                        Age   From       Message
  ----    ------                        ----  ----       -------
  Normal  WaitingOnNodeClaimTermination  18s   karpenter  Waiting on NodeClaim termination for default-8l2tz, default-frz5j, default-bfwnx, default-kzwhq, default-jp8dn and 5 other(s)

How was this change tested?

make presubmit

Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: #
  • No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@netlify
Copy link

netlify bot commented Sep 6, 2023

Deploy Preview for karpenter-docs-prod canceled.

Name Link
🔨 Latest commit edf76d8
🔍 Latest deploy log https://app.netlify.com/sites/karpenter-docs-prod/deploys/650decf6edf7060008970e90

@jonathan-innis jonathan-innis force-pushed the add-role-support branch 11 times, most recently from 3e9e39a to fd2e401 Compare September 19, 2023 17:00
@jonathan-innis jonathan-innis marked this pull request as ready for review September 19, 2023 17:02
@jonathan-innis jonathan-innis requested a review from a team as a code owner September 19, 2023 17:02
Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

Looks good. I have some questions about how we're planning on managing these instance profiles now.

pkg/apis/v1beta1/labels.go Show resolved Hide resolved
pkg/controllers/nodeclass/controller.go Outdated Show resolved Hide resolved
pkg/test/environment.go Show resolved Hide resolved
pkg/providers/instanceprofile/instanceprofile.go Outdated Show resolved Hide resolved
pkg/operator/suite_test.go Show resolved Hide resolved
@jonathan-innis jonathan-innis force-pushed the add-role-support branch 13 times, most recently from 0c44b43 to b8c45d6 Compare September 20, 2023 17:01
@jonathan-innis jonathan-innis force-pushed the add-role-support branch 3 times, most recently from f0d20e5 to 09132d8 Compare September 22, 2023 07:18
@jonathan-innis jonathan-innis force-pushed the add-role-support branch 9 times, most recently from aa181d0 to a7c4fad Compare September 22, 2023 18:37
@jonathan-innis jonathan-innis merged commit a2e85b5 into aws:main Sep 22, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants