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: Modify workflow to use new eks models - Release 0.7.0 #78

Merged
merged 17 commits into from
Mar 17, 2023

Conversation

mbeacom
Copy link
Contributor

@mbeacom mbeacom commented Mar 1, 2023

Summary

Resolves: #69 #36

Changes

This PR modifies the current eksupgrade tool workflows to use the new model-based implementation. This leans on the AWS API to perform the majority of upgrade steps when possible (cluster, addons, managed node groups), instead of manually handling them through custom logic.

User experience

The user experience is altered as a result of this PR. The user can now totally disable validation checks via --disable-checks and install the latest add-ons during upgrade via --latest-addons in order to update addons beyond the default to the latest available.

Additionally, these changes now employ boto3 waiters to intelligently poll for resource status updates, as opposed to hand rolling the waiters or minimally sleeping throughout the workflows.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@mbeacom mbeacom requested a review from bryantbiggs March 1, 2023 21:48
@mbeacom mbeacom self-assigned this Mar 1, 2023
@mbeacom mbeacom requested a review from a team March 1, 2023 22:49
@mbeacom mbeacom changed the title wip: Modify workflow to use new eks models fix: WIP -Modify workflow to use new eks models Mar 1, 2023
@mbeacom mbeacom changed the title fix: WIP -Modify workflow to use new eks models feature: WIP -Modify workflow to use new eks models Mar 1, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2023

Codecov Report

Patch coverage: 44.59% and project coverage change: +6.36 🎉

Comparison is base (1deec99) 21.03% compared to head (652bfb5) 27.40%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
+ Coverage   21.03%   27.40%   +6.36%     
==========================================
  Files          12       13       +1     
  Lines        1740     1927     +187     
==========================================
+ Hits          366      528     +162     
- Misses       1374     1399      +25     
Impacted Files Coverage Δ
eksupgrade/src/boto_aws.py 10.84% <ø> (+0.64%) ⬆️
eksupgrade/src/k8s_client.py 28.50% <ø> (+6.39%) ⬆️
eksupgrade/src/self_managed.py 16.00% <ø> (+1.00%) ⬆️
eksupgrade/starter.py 13.33% <5.88%> (+2.16%) ⬆️
eksupgrade/src/preflight_module.py 4.62% <33.33%> (+0.40%) ⬆️
eksupgrade/models/eks.py 60.29% <48.56%> (-26.13%) ⬇️
eksupgrade/models/base.py 82.22% <55.55%> (-17.78%) ⬇️
eksupgrade/__init__.py 100.00% <100.00%> (ø)
eksupgrade/cli.py 92.85% <100.00%> (+0.54%) ⬆️
eksupgrade/exceptions.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mbeacom mbeacom changed the title feature: WIP -Modify workflow to use new eks models fix: WIP -Modify workflow to use new eks models Mar 2, 2023
@onabison
Copy link

onabison commented Mar 16, 2023

Hello @mbeacom
I just ran an upgrade from 1.22 to 1.23 on a POC cluster, I noticed that the add-on is still not quite there yet and I then noticed you have this PR that should resolve it?

INFO:eksupgrade.src.preflight_module:Checking if kube-proxy target version: 1.22.6 is equal to the current version: 1.22.11

AND

INFO:eksupgrade.src.k8s_client:aws-node-24fnl Current Version = v1.12.2-eksbuild.1 Updating To = v1.10.4-eksbuild.1
INFO:eksupgrade.src.k8s_client:Updating the EKS cluster's vpc-cni add-on version via the EKS API...
ERROR:eksupgrade.src.k8s_client:Exception encountered while attempting to update the addons - Error: An error occurred (InvalidParameterException) when calling the UpdateAddon operation: Updating VPC-CNI can only go up or down 1 minor version at a time
ERROR:eksupgrade.starter:Exception encountered in main method - Error: An error occurred (InvalidParameterException) when calling the UpdateAddon operation: Updating VPC-CNI can only go up or down 1 minor version at a time

Any idea when this PR will be merged? I'll wait to upgrade from 1.23 to 1.24 to see if the add-ons portion has a new behavior then.

Thanks again for all your efforts in making this tool AMAZING!

@mbeacom mbeacom marked this pull request as ready for review March 16, 2023 21:13
@mbeacom mbeacom changed the title fix: WIP -Modify workflow to use new eks models fix: Modify workflow to use new eks models Mar 16, 2023
@mbeacom mbeacom changed the title fix: Modify workflow to use new eks models fix: Modify workflow to use new eks models - Release 0.7.0 Mar 16, 2023
@mbeacom
Copy link
Contributor Author

mbeacom commented Mar 16, 2023

@onabison Thanks for the kind words! Yes, this PR does indeed resolve the mentioned issue. This should be merged (barring any major issues discovered in review) today or tomorrow.

@quixoticmonk
Copy link
Contributor

quixoticmonk commented Mar 17, 2023

v0.7.0

  • upgrade held good from 1.22 -> 1.23 -> 1.24 -> 1.25
  • vpc-cni issue issue of minor version error/warning is fixed
  • Ran an existing 1.25 cluster with a --latest-addons flag updated addons to the latest versions.

eksupgrade/starter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@quixoticmonk quixoticmonk left a comment

Choose a reason for hiding this comment

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

The question around import is a nit . Approved to merge.

eksupgrade/cli.py Outdated Show resolved Hide resolved
eksupgrade/cli.py Outdated Show resolved Hide resolved
@@ -97,23 +401,26 @@ class ClusterAddon(EksResource):
product_id: str = ""
product_url: str = ""
configuration_values: str = ""
cluster: Cluster = field(default_factory=lambda: Cluster(arn=""))
cluster: Cluster = field(default_factory=lambda: Cluster(arn="", version="1.24"))
Copy link
Member

Choose a reason for hiding this comment

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

is this default version necessary/required? is there any possibility of someone updating a cluster and this is used instead of the control plane's current version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will adjust the init workflow for this to eliminate the requirement. It shouldn't ever occur within the scripted workflow, but (to your point) could absolutely cause version confusion if used programmatically (and in other custom workflows).
I will modify the version parsing so this shortcut isn't required in my follow-up PR with parallel execs.

upgrade_details[addon.name] = _update_responses
return upgrade_details

def upgrade_nodegroups(self, wait: bool = False) -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a parallel flag should be propagated down to here. some customers have a nodegroup per team which results in several (up to 100 - yes some are at that limit) nodegroups. on one hand it speeds things up, but on the other, it could be asking for trouble depending on how many nodes in the cluster are churning at once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're describing my current stash against this branch 😂 -- added parallel propagation through to the nodegroup updates that trigger collection of all the futures and subsequently gather results, but figured I should wait until the next release to introduce it. Happy to include it here, if desired.

Copy link
Member

Choose a reason for hiding this comment

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

ya I think a follow up PR is fine

"""Upgrade all cluster addons."""
logger.info("The add-ons update has been initiated...")
upgrade_details: Dict[str, Any] = {}
for addon in self.upgradable_addons:
Copy link
Member

Choose a reason for hiding this comment

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

these can definitely be done in parallel FYI

Copy link
Member

Choose a reason for hiding this comment

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

parallel, async, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 I was likely going to throw them into a PoolExecutor and execute them concurrently and gather results off of the pool.

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

looks amazing - left a few comments/nits, but nothing that is blocking if you want to follow up in a later PR

@mbeacom mbeacom merged commit a88f478 into aws-samples:main Mar 17, 2023
@mbeacom mbeacom deleted the modified-workflow branch March 17, 2023 13:33
@mbeacom
Copy link
Contributor Author

mbeacom commented Mar 17, 2023

@onabison 0.7.0 is now available and includes the outlined changes discussed here.

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.

Feature: Allow users to opt in to selecting the latest addon version when upgrading
5 participants