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

fix: spurious logging from the ssm invalidation controller #7698

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

jmdeal
Copy link
Contributor

@jmdeal jmdeal commented Feb 5, 2025

Fixes #N/A

Description

The SSM invalidation controller uses the AMI provider to periodically check the AMIs provided by SSM parameters for deprecation. To do so, it creates dummy NodeClasses with the AMI IDs discovered from SSM parameters, and passes them to the provider. This causes spurious logging from the AMI providers change monitor, as it keeps discovering new AMIs for the EC2NodeClass with the name "":

if p.cm.HasChanged(fmt.Sprintf("amis/%s", nodeClass.Name), uniqueAMIs) {
log.FromContext(ctx).WithValues(
"ids", uniqueAMIs).V(1).Info("discovered amis")
}

Example Logs:

karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T16:11:25.875Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"d5b15907-2aa8-496d-a995-22ae61c7e6e3","ids":["ami-064765ed688898ddd"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T16:41:25.970Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"82bdcbdd-cc69-4b7e-a9b9-3964939310d6","ids":["ami-0e028c106b154cbaf"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T16:41:26.037Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"82bdcbdd-cc69-4b7e-a9b9-3964939310d6","ids":["ami-043ad4c51368cde81"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T16:41:26.105Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"82bdcbdd-cc69-4b7e-a9b9-3964939310d6","ids":["ami-086b44042794ec3a1"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T17:11:26.234Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"4088985e-2558-4855-aa45-b5181c90de85","ids":["ami-064765ed688898ddd"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T17:11:26.291Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"4088985e-2558-4855-aa45-b5181c90de85","ids":["ami-0e028c106b154cbaf"]}
karpenter-7d45fc984d-x95n9 controller {"level":"DEBUG","time":"2025-02-05T17:11:26.360Z","logger":"controller","caller":"invalidation/controller.go:74","message":"discovered amis","commit":"12c5748-dirty","controller":"providers.ssm.invalidation","namespace":"","name":"","reconcileID":"4088985e-2558-4855-aa45-b5181c90de85","ids":["ami-043ad4c51368cde81"]}

This PR moves that change monitor from the AMI provider to the NodeClass AMI reconciler. There are other ways to go about this (e.g. passing a no-op logger to the ami provider from the ssm invalidation controller), but IMO it makes more sense for the change monitor to be on the reconciler which is actually updating the resource anyway.

How was this change tested?
make test

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.

@jmdeal jmdeal requested a review from a team as a code owner February 5, 2025 17:46
@jmdeal jmdeal requested a review from rschalo February 5, 2025 17:46
Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for karpenter-docs-prod ready!

Name Link
🔨 Latest commit 55685ad
🔍 Latest deploy log https://app.netlify.com/sites/karpenter-docs-prod/deploys/67a3a409c3ac0000089369d6
😎 Deploy Preview https://deploy-preview-7698--karpenter-docs-prod.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13163410256

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 64.878%

Totals Coverage Status
Change from base Build 13141718725: 0.02%
Covered Lines: 5802
Relevant Lines: 8943

💛 - Coveralls

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 🚀

@jmdeal jmdeal merged commit cf530be into aws:main Feb 5, 2025
18 checks passed
edibble21 pushed a commit to edibble21/karpenter-provider-aws that referenced this pull request Feb 19, 2025
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