Skip to content

fix: zonal shift changes shouldn't hit stale offerings cache#9131

Open
ryan-mist wants to merge 2 commits intoaws:mainfrom
ryan-mist:fix-zs-offering
Open

fix: zonal shift changes shouldn't hit stale offerings cache#9131
ryan-mist wants to merge 2 commits intoaws:mainfrom
ryan-mist:fix-zs-offering

Conversation

@ryan-mist
Copy link
Copy Markdown
Contributor

@ryan-mist ryan-mist commented May 1, 2026

Fixes #N/A

Description
Previously during a zonal shift, Karpenter would used cached offerings which could include outdated availability information (since zonal shift is reflected in availability). This could result in instance launches into the zone that is shifted away.

e.g.

  1. ListOfferings is called (during provisioning or consolidation) -> offerings cache is hydrated
  2. Zonal Shift is Triggered
  3. On attempt to provision new instances, offerings which should be marked unavailable due to the zonal shift stay available. This could result in instance launches into the impaired AZ.

This PR fixes that by reflected zonal shifts in the offerings cache key.

How was this change tested?

  • make presubmit and a unit tests which exercises caching path

Unit Test Before

InstanceTypeProvider should mark offerings as unavailable for zones shifted away from
/Users/ryanmist/desktop/karp/karpenter-provider-aws/pkg/providers/instancetype/suite_test.go:3043
  [FAILED] in [It] - /Users/ryanmist/desktop/karp/karpenter-provider-aws/pkg/providers/instancetype/suite_test.go:3073 @ 05/01/26 10:09:24.847
• [FAILED] [3.105 seconds]
InstanceTypeProvider [It] should mark offerings as unavailable for zones shifted away from
/Users/ryanmist/desktop/karp/karpenter-provider-aws/pkg/providers/instancetype/suite_test.go:3043

  [FAILED] Expected
      <cloudprovider.Offerings | len:6, cap:8>: [
          {
...
  to have length 4
  In [It] at: /Users/ryanmist/desktop/karp/karpenter-provider-aws/pkg/providers/instancetype/suite_test.go:3073 @ 05/01/26 10:09:24.847

Unit Test After

------------------------------
InstanceTypeProvider should mark offerings as unavailable for zones shifted away from
/Users/ryanmist/desktop/karp/karpenter-provider-aws/pkg/providers/instancetype/suite_test.go:3043
• [3.139 seconds]
------------------------------

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.

@ryan-mist ryan-mist requested a review from a team as a code owner May 1, 2026 17:14
@ryan-mist ryan-mist requested a review from azishabibi May 1, 2026 17:14
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.

1 participant