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

BREAKING CHANGE: Refactor NodeClass controller #5949

Merged
merged 3 commits into from
Apr 13, 2024

Conversation

engedaam
Copy link
Contributor

@engedaam engedaam commented Apr 1, 2024

Fixes #N/A

Description

  • BREAKING CHANGE: the names for log keys produced by the NodeClass controller will change as such: nodeclass -> nodeclass.status, nodeclass.hash, nodeclass.termination
  • Refactored the NodeClass controller to be split into three controllers (termination, status, and hash)
  • This change will keep functionality of each controllers to one operation and easier to reason through
  • All logic of the NodeClass will remain consistent

How was this change tested?

  • make presubmit
  • /karpenter snapshot

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.

Copy link

netlify bot commented Apr 1, 2024

Deploy Preview for karpenter-docs-prod canceled.

Name Link
🔨 Latest commit 046f9bf
🔍 Latest deploy log https://app.netlify.com/sites/karpenter-docs-prod/deploys/661a1570a2c1f4000836ddfd

@coveralls
Copy link

coveralls commented Apr 1, 2024

Pull Request Test Coverage Report for Build 8671291017

Details

  • 187 of 253 (73.91%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 82.176%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/nodeclass/status/instanceprofile.go 9 11 81.82%
pkg/controllers/nodeclass/status/launchtemplate.go 7 9 77.78%
pkg/controllers/nodeclass/status/securitygroup.go 17 19 89.47%
pkg/controllers/nodeclass/status/subnet.go 19 21 90.48%
pkg/controllers/controllers.go 0 3 0.0%
pkg/controllers/nodeclass/status/ami.go 16 22 72.73%
pkg/controllers/nodeclass/status/controller.go 40 50 80.0%
pkg/controllers/nodeclass/hash/controller.go 44 58 75.86%
pkg/controllers/nodeclass/termination/controller.go 35 60 58.33%
Totals Coverage Status
Change from base Build 8671279743: 0.0%
Covered Lines: 5371
Relevant Lines: 6536

💛 - Coveralls

Copy link
Contributor Author

@engedaam engedaam left a comment

Choose a reason for hiding this comment

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

/karpenter snapshot

Copy link
Contributor

github-actions bot commented Apr 1, 2024

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-717e557142261aac1b225dd09c8640dee6826b55.
To install you must login to the ECR repo with an AWS account:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 021119463062.dkr.ecr.us-east-1.amazonaws.com

helm upgrade --install karpenter oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter --version "0-717e557142261aac1b225dd09c8640dee6826b55" --namespace "kube-system" --create-namespace \
  --set "settings.clusterName=${CLUSTER_NAME}" \
  --set "settings.interruptionQueue=${CLUSTER_NAME}" \
  --set controller.resources.requests.cpu=1 \
  --set controller.resources.requests.memory=1Gi \
  --set controller.resources.limits.cpu=1 \
  --set controller.resources.limits.memory=1Gi \
  --wait

@engedaam engedaam force-pushed the refactor-nodeclass branch 4 times, most recently from 481921f to 40f1b7c Compare April 5, 2024 22:33
@engedaam engedaam marked this pull request as ready for review April 5, 2024 22:34
@engedaam engedaam requested a review from a team as a code owner April 5, 2024 22:34
@engedaam engedaam requested a review from ljosyula April 5, 2024 22:34
Copy link
Contributor Author

@engedaam engedaam left a comment

Choose a reason for hiding this comment

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

/karpenter snapshot

Copy link
Contributor

github-actions bot commented Apr 5, 2024

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-40f1b7c09ae609b19dca5b20a80a8cf756ad5adf.
To install you must login to the ECR repo with an AWS account:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 021119463062.dkr.ecr.us-east-1.amazonaws.com

helm upgrade --install karpenter oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter --version "0-40f1b7c09ae609b19dca5b20a80a8cf756ad5adf" --namespace "kube-system" --create-namespace \
  --set "settings.clusterName=${CLUSTER_NAME}" \
  --set "settings.interruptionQueue=${CLUSTER_NAME}" \
  --set controller.resources.requests.cpu=1 \
  --set controller.resources.requests.memory=1Gi \
  --set controller.resources.limits.cpu=1 \
  --set controller.resources.limits.memory=1Gi \
  --wait

Copy link
Contributor

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

Nice refactor. I really like the changes! Assuming the logic is remaining consistent everywhere with the changes and the tests haven't changed, I like it.

Didn't look at the tests because I assumed that they were straight-copies from the different Context blocks inside of the nodeclass package suite_test.go. Let me know if this assumption doesn't hold and I can look at specific files.

pkg/controllers/controllers.go Outdated Show resolved Hide resolved
pkg/controllers/controllers.go Outdated Show resolved Hide resolved
pkg/controllers/controllers.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclass/hash/controller.go Show resolved Hide resolved
pkg/controllers/nodeclass/termination/controller.go Outdated Show resolved Hide resolved
pkg/operator/operator.go Outdated Show resolved Hide resolved
@engedaam engedaam changed the title chore: Refactor nodeclass controller BREAKING CHANGE: Refactor nodeclass controller Apr 8, 2024
@engedaam engedaam changed the title BREAKING CHANGE: Refactor nodeclass controller BREAKING CHANGE: Refactor NodeClass controller Apr 8, 2024
@engedaam engedaam force-pushed the refactor-nodeclass branch 3 times, most recently from 64f90a3 to 603ae99 Compare April 8, 2024 05:44
Copy link
Contributor Author

@engedaam engedaam left a comment

Choose a reason for hiding this comment

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

/karpenter snapshot

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-603ae99a0323d235a03d0f68fc4e4a654518b6db.
To install you must login to the ECR repo with an AWS account:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 021119463062.dkr.ecr.us-east-1.amazonaws.com

helm upgrade --install karpenter oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter --version "0-603ae99a0323d235a03d0f68fc4e4a654518b6db" --namespace "kube-system" --create-namespace \
  --set "settings.clusterName=${CLUSTER_NAME}" \
  --set "settings.interruptionQueue=${CLUSTER_NAME}" \
  --set controller.resources.requests.cpu=1 \
  --set controller.resources.requests.memory=1Gi \
  --set controller.resources.limits.cpu=1 \
  --set controller.resources.limits.memory=1Gi \
  --wait

@engedaam engedaam force-pushed the refactor-nodeclass branch 5 times, most recently from e8e3599 to 1d5d689 Compare April 11, 2024 16:19
Copy link
Contributor Author

@engedaam engedaam left a comment

Choose a reason for hiding this comment

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

/karpenter snapshot

Copy link
Contributor

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-1d5d6890c6330cdce724728e6f6a33521a2697fb.
To install you must login to the ECR repo with an AWS account:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 021119463062.dkr.ecr.us-east-1.amazonaws.com

helm upgrade --install karpenter oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter --version "0-1d5d6890c6330cdce724728e6f6a33521a2697fb" --namespace "kube-system" --create-namespace \
  --set "settings.clusterName=${CLUSTER_NAME}" \
  --set "settings.interruptionQueue=${CLUSTER_NAME}" \
  --set controller.resources.requests.cpu=1 \
  --set controller.resources.requests.memory=1Gi \
  --set controller.resources.limits.cpu=1 \
  --set controller.resources.limits.memory=1Gi \
  --wait

@engedaam engedaam force-pushed the refactor-nodeclass branch 2 times, most recently from d533366 to f361736 Compare April 12, 2024 17:07
@engedaam engedaam force-pushed the refactor-nodeclass branch 2 times, most recently from d72eee8 to 0e3ba57 Compare April 12, 2024 17:26
jonathan-innis
jonathan-innis previously approved these changes Apr 12, 2024
Copy link
Contributor

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Copy link
Contributor Author

@engedaam engedaam left a comment

Choose a reason for hiding this comment

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

/karpenter snapshot

Copy link
Contributor

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-0b41c5bad17767fc06164e537ce239a264f66044.
To install you must login to the ECR repo with an AWS account:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 021119463062.dkr.ecr.us-east-1.amazonaws.com

helm upgrade --install karpenter oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter --version "0-0b41c5bad17767fc06164e537ce239a264f66044" --namespace "kube-system" --create-namespace \
  --set "settings.clusterName=${CLUSTER_NAME}" \
  --set "settings.interruptionQueue=${CLUSTER_NAME}" \
  --set controller.resources.requests.cpu=1 \
  --set controller.resources.requests.memory=1Gi \
  --set controller.resources.limits.cpu=1 \
  --set controller.resources.limits.memory=1Gi \
  --wait

Copy link
Contributor

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@engedaam engedaam merged commit 9a07a6d into aws:main Apr 13, 2024
16 checks passed
@engedaam engedaam deleted the refactor-nodeclass branch April 14, 2024 01:37
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.

3 participants