Skip to content

Conversation

aoshi2000
Copy link
Contributor

Add exact match check to use specified addon versions

Description

The current addon version selection logic uses partial string matching to find the latest version among all matching candidates. This causes unexpected behavior when users specify exact versions.

For example, when a user runs:

eksctl update addon --cluster my-cluster --name coredns --version v1.0.0-eksbuild.2

The current implementation incorrectly selects v1.0.0-eksbuild.20 instead of the specified v1.0.0-eksbuild.2 , because strings.Contains("v1.0.0-eksbuild.20", "v1.0.0-eksbuild.2") returns true.

This Pull Request adds an exact match check before the partial matching logic in getLatestMatchingVersion().

Manual Test Results

before

eksctl update addon --name coredns --version v1.11.4-eksbuild.1 --cluster <cluster-name> --force
2025-08-24 10:29:50 [!]  no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=<cluster-name>'
2025-08-24 10:29:50 [ℹ]  Kubernetes version "1.33" in use by cluster "<cluster-name>"
2025-08-24 10:29:50 [ℹ]  new version provided v1.11.4-eksbuild.14
2025-08-24 10:29:50 [ℹ]  updating addon

after

./eksctl update addon --name coredns --version v1.11.4-eksbuild.1 --cluster <cluster-name> --force
2025-08-24 10:27:27 [!]  no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=<cluster-name>'
2025-08-24 10:27:27 [ℹ]  Kubernetes version "1.33" in use by cluster "<cluster-name>"
2025-08-24 10:27:28 [ℹ]  new version provided v1.11.4-eksbuild.1
2025-08-24 10:27:28 [ℹ]  updating addon

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
    => I think no documentation changes are required as the modified behavior aligns with existing documentation expectations.
The addon version can be set to latest. Alternatively, the version can be set with the EKS build tag specified, such as v1.7.5-eksbuild.1 or v1.7.5-eksbuild.2. It can also be set to the release version of the addon, such as v1.7.5 or 1.7.5, and the eksbuild suffix tag will be discovered and set for you.

https://eksctl.io/usage/addons/

  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes
  • (Core team) Added labels for change area (e.g. area/nodegroup) and kind (e.g. kind/improvement)

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

Add exact match check before partial matching to prevent v1.7.7-eksbuild.2 from incorrectly matching v1.7.7-eksbuild.20.
Include test case with multi-digit version suffix.
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello aoshi2000 👋 Thank you for opening a Pull Request in eksctl project. The team will review the Pull Request and aim to respond within 1-10 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines here. You can find out more information about eksctl on our website

Copy link
Contributor

@sapphirew sapphirew left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for submitting this fix!

@sapphirew sapphirew merged commit 4af29b0 into eksctl-io:main Aug 26, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants