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: Fix pointer mutation causing incorrect maxPods values #7020

Merged

Conversation

jonathan-innis
Copy link
Contributor

@jonathan-innis jonathan-innis commented Sep 16, 2024

Fixes #7011
Fixes #6890
Fixes #6979

Description

This PR fixes a bug where both GetKubeletConfigurationWithNodeClaim and GetKubeletConfigurationWithNodePool were returning the nodeClass.Spec.Kubelet back to the caller when Kubelet was specified and there was no Kubelet compatibility annotation.

This would be fine; however, this call returned back the original pointer for the Kubelet data -- meaning that any caller could then mutate the original data for other callers without knowing it. In this case, the launch template resolver was inadvertently mutating the maxPods data across instance type combinations, leading to incorrect maxPods values being specified sometimes.

How was this change tested?

  • make presubmit
  • Print-lining and validating that we are no longer seeing inconsistent maxPods when using the production data.

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.

@jonathan-innis jonathan-innis requested a review from a team as a code owner September 16, 2024 16:24
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10887984482

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 79.396%

Totals Coverage Status
Change from base Build 10838271515: 0.02%
Covered Lines: 5942
Relevant Lines: 7484

💛 - Coveralls

Copy link
Contributor Author

@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

Copy link
Contributor

Snapshot successfully published to oci://021119463062.dkr.ecr.us-east-1.amazonaws.com/karpenter/snapshot/karpenter:0-cd04d65077eaed45e212e2140c0081768f3de547.
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-cd04d65077eaed45e212e2140c0081768f3de547" --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

@jonathan-innis jonathan-innis enabled auto-merge (squash) September 16, 2024 20:16
@michaelkorofiverr
Copy link

In which release can we expect this fix?

jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 23, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 23, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 23, 2024
cnmcavoy pushed a commit to cnmcavoy/karpenter-provider-aws that referenced this pull request Sep 23, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 24, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 24, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 25, 2024
jonathan-innis added a commit to jonathan-innis/karpenter-provider-aws that referenced this pull request Sep 25, 2024
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.

4 participants