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

Set the version of an addon with a numeric version that has no prefix or suffix #3646

Merged
merged 21 commits into from
May 5, 2021

Conversation

nikimanoledaki
Copy link
Contributor

@nikimanoledaki nikimanoledaki commented Apr 29, 2021

Description

Closes #3574.

The current behaviour for setting the version of an addon when creating or updating it is to specify the full version, such as v1.7.5-eksbuild.2 or v1.7.5-eksbuild.1, or set to latest, which will list and select the latest version available for this addon.

This PR lets the user specify a shortened form of the version such as v1.7.5 or 1.7.5 that does not have an eksbuild-1 or eksbuild-2 suffix, whether it does or does not have a v prefix. It then finds the latest build for this numeric version using the same logic as when latest lists and selects the latest version for an addon.

Demo

  1. Create an addon with version 1.7.5
$ ./eksctl create addon --name vpc-cni --version 1.7.5 --cluster "ridiculous-party-1619777406"

2021-04-30 11:31:07 [!]  no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=ridiculous-party-1619777406'
2021-04-30 11:31:07 [ℹ]  Kubernetes version "1.19" in use by cluster "ridiculous-party-1619777406"
2021-04-30 11:31:07 [ℹ]  when creating an addon to replace an existing application, e.g. CoreDNS, kube-proxy & VPC-CNI the --force flag will ensure the currently deployed configuration is replaced
2021-04-30 11:31:07 [!]  OIDC is disabled but policies are required/specified for this addon. Users are responsible for attaching the policies to all nodegroup roles
2021-04-30 11:31:08 [ℹ]  creating addon
2021-04-30 11:31:09 [ℹ]  successfully created addon
  1. Get addon to check that it was set to latest build
./eksctl get addon --name vpc-cni --cluster "ridiculous-party-1619777406"

2021-04-30 11:32:56 [ℹ]  eksctl version 0.48.0-dev+625febb8.2021-04-30T10:49:48Z
2021-04-30 11:32:56 [ℹ]  using region us-west-2
2021-04-30 11:32:57 [ℹ]  Kubernetes version "1.19" in use by cluster "ridiculous-party-1619777406"
2021-04-30 11:32:58 [ℹ]  to see issues for an addon run `eksctl get addon --name <addon-name> --cluster <cluster-name>`
NAME    VERSION                 STATUS  ISSUES  IAMROLE UPDATE AVAILABLE
vpc-cni v1.7.5-eksbuild.2       ACTIVE  0               v1.7.10-eksbuild.1,v1.7.9-eksbuild.2,v1.7.9-eksbuild.1,v1.7.6-eksbuild.2,v1.7.6-eksbuild.1
  1. Update addon to 1.7.7
$ ./eksctl update addon --name vpc-cni --version 1.7.9 --cluster "ridiculous-party-1619777406"

2021-04-30 12:09:31 [!]  no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=ridiculous-party-1619777406'
2021-04-30 12:09:31 [ℹ]  Kubernetes version "1.19" in use by cluster "ridiculous-party-1619777406"
2021-04-30 12:09:32 [ℹ]  new version provided v1.7.9-eksbuild.2
2021-04-30 12:09:32 [ℹ]  updating addon
  1. Case where version was not found
$ ./eksctl update addon --name vpc-cni --version 1.7.8 --cluster "ridiculous-party-1619777406"

2021-04-30 12:08:39 [!]  no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=ridiculous-party-1619777406'
2021-04-30 12:08:39 [ℹ]  Kubernetes version "1.19" in use by cluster "ridiculous-party-1619777406"
Error: failed to fetch addon version: version 1.7.8 not available for "vpc-cni"

Also:

  • Updated user docs on the available options when setting addon versions.
  • Added a test for the edge case where the set version was not found when creating or updating the addon.
  • Updated the unit tests for creating and updating an addon to use the full version of the addon, unless of course the purpose of the test is to check the logic of setting a short form of the version. This is to minimize what the other tests are testing (as in, the default API functionality rather than eksctl logic).
  • Filled in some missing unit tests for updating an addon in pkg/actions/addon/update_test.go, such as for when the version is not set and eksctl preserves the version (but may suggest a more updated version).
  • Refactored the update unit tests to remove repeating code.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • 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 🌟

@nikimanoledaki nikimanoledaki changed the title Find latest version when creating or updating an addon with a numeric version Find latest version when creating or updating an addon with the short form of that version Apr 29, 2021
@nikimanoledaki nikimanoledaki changed the title Find latest version when creating or updating an addon with the short form of that version Set the version of an addon with a numeric version that has no prefix or suffix Apr 29, 2021
@nikimanoledaki nikimanoledaki marked this pull request as ready for review April 30, 2021 11:11
@Callisto13 Callisto13 added the kind/feature New feature or request label Apr 30, 2021
Copy link
Contributor

@Callisto13 Callisto13 left a comment

Choose a reason for hiding this comment

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

very tidy! just a couple of questions right now

pkg/actions/addon/update.go Outdated Show resolved Hide resolved
userdocs/src/usage/addons.md Outdated Show resolved Hide resolved
userdocs/src/usage/addons.md Outdated Show resolved Hide resolved
Copy link
Contributor

@Callisto13 Callisto13 left a comment

Choose a reason for hiding this comment

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

LGTM, but leaving to @aclevername to approve since he knows the area better 🎉

Copy link
Contributor

@aclevername aclevername left a comment

Choose a reason for hiding this comment

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

🎉

@nikimanoledaki nikimanoledaki merged commit 42b6634 into eksctl-io:main May 5, 2021
@nikimanoledaki nikimanoledaki deleted the addon-version branch May 5, 2021 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eksctl addons supports pattern matching the version
3 participants