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: instance tagging controller #4611

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Conversation

jmdeal
Copy link
Contributor

@jmdeal jmdeal commented Sep 11, 2023

Fixes #3342

Description
This PR introduces a new controller for v1beta1 responsible for tagging ec2 instances with their in-cluster name. This replaces the previous behavior where each instance's name corresponded to it's Provisioner (e.g. karpenter.sh/provisioner/default). It is not possible to do this as part of the CreateFleet call since the node name is not yet known. Instead, this controller observes NodeClaims, waiting for their node name to be populated.

Additionally, while this PR does not introduce custom dynamic tags, it does open up a path for them in the future (see issues #2783 and #4228).

How was this change tested?

make test and make e2e

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 11, 2023

Deploy Preview for karpenter-docs-prod canceled.

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

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.

Overall, super solid! Most of my comments have to do with looking around for existing functions and frameworks that do a lot of the same stuff that you are doing so that we stay DRY in the codebase. Great work 🎉

pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
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.

/karpenter snapshot

@jmdeal jmdeal force-pushed the node-label-controller branch 2 times, most recently from 2c2b9d3 to e23622b Compare September 12, 2023 18:01
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.

/karpenter snapshot

@github-actions
Copy link
Contributor

Snapshot successfully published to oci://public.ecr.aws/karpenter/karpenter:v0-e23622bcf28fd4ffe79704688fbd0e0d11cf60b1. Find the image tag and installation instructions at https://gallery.ecr.aws/karpenter/karpenter/

pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Show resolved Hide resolved
pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
@jmdeal jmdeal force-pushed the node-label-controller branch 2 times, most recently from 6b56735 to f408054 Compare September 15, 2023 22:59
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.

This looks really good to me! Just the functional testing in here and this looks good to go!

pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
@jmdeal jmdeal marked this pull request as ready for review September 19, 2023 00:48
@jmdeal jmdeal requested a review from a team as a code owner September 19, 2023 00:48
@jmdeal jmdeal force-pushed the node-label-controller branch 3 times, most recently from f789db9 to 6238527 Compare September 19, 2023 01:05
Copy link
Contributor Author

@jmdeal jmdeal 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

@github-actions
Copy link
Contributor

Snapshot successfully published to oci://public.ecr.aws/karpenter/karpenter:v0-62385275fee4f653934354f27885d47ce2423656. Find the image tag and installation instructions at https://gallery.ecr.aws/karpenter/karpenter/

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.

Really nice testing coverage 🎉 Just a few comments!

pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/suite_test.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/suite_test.go Outdated Show resolved Hide resolved
pkg/fake/ec2api.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
test/suites/integration/instance_tag_test.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Outdated Show resolved Hide resolved
pkg/providers/instance/instance.go Show resolved Hide resolved
@jmdeal jmdeal changed the title feat: ec2 instance tagging controller feat: instance tagging controller Sep 20, 2023
Copy link
Contributor Author

@jmdeal jmdeal 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

@github-actions
Copy link
Contributor

Snapshot successfully published to oci://public.ecr.aws/karpenter/karpenter:v0-7d052f89976c03b3bea4efe677036c80830a7501. Find the image tag and installation instructions at https://gallery.ecr.aws/karpenter/karpenter/

pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/controller.go Outdated Show resolved Hide resolved
pkg/controllers/nodeclaim/tagging/suite_test.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@jmdeal jmdeal 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

@github-actions
Copy link
Contributor

Snapshot successfully published to oci://public.ecr.aws/karpenter/karpenter:v0-ce426349b3dba37d0423ac842e6b5e427bfb2817. Find the image tag and installation instructions at https://gallery.ecr.aws/karpenter/karpenter/

Co-authored-by: Jonathan Innis <jonathan.innis.ji@gmail.com>
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 🚀 Nice work!

@jmdeal jmdeal enabled auto-merge (squash) September 21, 2023 18:48
@jmdeal jmdeal merged commit 5ab60b2 into aws:main Sep 21, 2023
11 checks passed
@jmdeal jmdeal deleted the node-label-controller branch September 27, 2023 19:00
@aws aws locked and limited conversation to collaborators Oct 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to remove "name" tag or customize it dynamically?
3 participants