Skip to content

fix(pricing): resolve in-partition Pricing region for AWS European Sovereign Cloud (aws-eusc) - #9437

Open
mlopezr wants to merge 2 commits into
aws:mainfrom
mlopezr:fix-pricing-eusc-region
Open

fix(pricing): resolve in-partition Pricing region for AWS European Sovereign Cloud (aws-eusc)#9437
mlopezr wants to merge 2 commits into
aws:mainfrom
mlopezr:fix-pricing-eusc-region

Conversation

@mlopezr

@mlopezr mlopezr commented Jul 21, 2026

Copy link
Copy Markdown

fix(pricing): resolve in-partition Pricing region for AWS European Sovereign Cloud (aws-eusc)

Fixes / Description

On the European Sovereign Cloud region eusc-de-east-1, Karpenter's pricing
reconciler fails continuously with:

ERROR ... controller: providers.pricing ... Reconciler error ...
operation error Pricing: GetProducts, https response error StatusCode: 400,
api error UnrecognizedClientException: The security token included in the
request is invalid (aws-service-name=Pricing, aws-status-code=400)

Root cause

pkg/providers/pricing/pricing.go NewAPI selects the Pricing API region by
string-prefix matching the cluster region:

pricingAPIRegion := "us-east-1"
if strings.HasPrefix(cfg.Region, "ap-") {
    pricingAPIRegion = "ap-south-1"
} else if strings.HasPrefix(cfg.Region, "cn-") {
    pricingAPIRegion = "cn-northwest-1"
} else if strings.HasPrefix(cfg.Region, "eu-") {
    pricingAPIRegion = "eu-central-1"
}

eusc-de-east-1 starts with eusc-, not eu-, so it falls through to the
default us-east-1. Karpenter then signs the Pricing request for the commercial
aws partition while presenting an aws-eusc IAM token; the commercial
endpoint rejects the cross-partition token with 400 UnrecognizedClientException.

The Pricing API does exist in-partition at
api.pricing.eusc-de-east-1.amazonaws.eu — the bundled AWS SDK already knows
the aws-eusc partition and resolves it correctly once the region is right.

Fix

Add an eusc- branch mapping to eusc-de-east-1:

} else if strings.HasPrefix(cfg.Region, "eusc-") {
    pricingAPIRegion = "eusc-de-east-1"
}

Testing

Deployed Karpenter 1.14.0 into an EKS cluster in eusc-de-east-1 with no
AWS_ENDPOINT_URL_* overrides:

  • Before this change: EC2/EKS/SSM/IAM/SQS all resolve natively (EC2NodeClass
    and NodePool reach Ready=True); only pricing errors with the 400 above.
  • After this change: the pricing reconciler succeeds against
    api.pricing.eusc-de-east-1.amazonaws.eu.

This confirms the endpoint/partition support for the other services already
works via the vendored SDK — pricing's manual region-prefix table was the sole
remaining gap for aws-eusc.

Notes

  • Consider also making the pricing reconciler degrade gracefully (as the
    existing us-gov skip does) when the Pricing API is unreachable in a given
    partition, so unknown future partitions log once rather than error-looping.

The Pricing API region is selected by string-prefix matching the cluster
region. The European Sovereign Cloud region eusc-de-east-1 does not match
the eu- prefix (it starts with eusc-), so it fell through to the default
us-east-1 and Karpenter signed the request for the commercial partition
while presenting an aws-eusc IAM token, yielding a 400
UnrecognizedClientException.

The Pricing API is available in-partition at
api.pricing.eusc-de-east-1.amazonaws.eu, so map eusc- regions to
eusc-de-east-1.

Signed-off-by: Mario <mariolr@amazon.fr>
@mlopezr
mlopezr requested a review from a team as a code owner July 21, 2026 14:12
@mlopezr
mlopezr requested a review from tzneal July 21, 2026 14:12

@joshuakguo joshuakguo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@joshuakguo joshuakguo self-assigned this Jul 24, 2026
@mlopezr

mlopezr commented Jul 28, 2026

Copy link
Copy Markdown
Author

The two failing tests about LaunchTemplate Provider caching appear to be caused by an async-timing race.
In 1.30–1.33 + 1.35 all tests passed (a real regression would fail uniformly).
Could a maintainer please re-run the failed jobs? Thanks!

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