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

[ENH] - Include "--attempt-fixes" flag from Nebari upgrade CLI in upgrade steps logic #2839

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

smokestacklightnin
Copy link

Reference Issues or PRs

This resloves #2761 by passing the attempt_fixes variable from the command line option to the upgrade methods.

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

How to test this PR?

Run nebari upgrade --attempt-fixes and verify that the upgrade is successful without prompts from the user.

Any other comments?

@smokestacklightnin smokestacklightnin force-pushed the commands/upgrade/attempt-fix-logic branch 4 times, most recently from 2b5260e to d053d04 Compare November 11, 2024 01:18
@@ -640,11 +685,11 @@ def _version_specific_upgrade(
""
)

continue_ = Prompt.ask(
continue_ = attempt_fixes or Confirm.ask(
Copy link
Author

Choose a reason for hiding this comment

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

Is there a way to automate the deletion of Argo Workflow CRDs? Otherwise, we are just assuming that the deletion already took place if attempt_fixes == true.

The same type of question applies to more changes below in the upgrade.py.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, there is. @marcelovilla did it for the Prometheus operator upgrade. See

if run_commands == "y":
for a reference.

Copy link
Member

Choose a reason for hiding this comment

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

@smokestacklightnin did you see the approach I implemented? You'd need to add the logic to automatically delete the relevant CRDs here if the attempt_fixes is passed. We would need an extra step or we would need to reframe the question, though.

@smokestacklightnin smokestacklightnin marked this pull request as ready for review November 11, 2024 01:43
@dcmcand
Copy link
Contributor

dcmcand commented Nov 11, 2024

This should probably be a draft PR if you still have questions about the implementation

@dcmcand dcmcand marked this pull request as draft November 11, 2024 08:59
src/_nebari/upgrade.py Outdated Show resolved Hide resolved
src/_nebari/upgrade.py Show resolved Hide resolved
src/_nebari/upgrade.py Outdated Show resolved Hide resolved
@@ -640,11 +685,11 @@ def _version_specific_upgrade(
""
)

continue_ = Prompt.ask(
continue_ = attempt_fixes or Confirm.ask(
Copy link
Member

Choose a reason for hiding this comment

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

@smokestacklightnin did you see the approach I implemented? You'd need to add the logic to automatically delete the relevant CRDs here if the attempt_fixes is passed. We would need an extra step or we would need to reframe the question, though.

src/_nebari/upgrade.py Outdated Show resolved Hide resolved
src/_nebari/upgrade.py Outdated Show resolved Hide resolved
src/_nebari/upgrade.py Outdated Show resolved Hide resolved
@marcelovilla
Copy link
Member

@smokestacklightnin can you also make sure the tests are passing?

Comment on lines +675 to +706
for crd in argo_crds:
api_instance = kubernetes.client.ApiextensionsV1Api()
try:
api_instance.delete_custom_resource_definition(
name=crd,
)
except kubernetes.client.exceptions.ApiException as e:
if e.status == 404:
rich.print(f"CRD [yellow]{crd}[/yellow] not found. Ignoring.")
else:
raise e
else:
rich.print(f"Successfully removed CRD [green]{crd}[/green]")

for sa in argo_sa:
api_instance = kubernetes.client.CoreV1Api()
try:
api_instance.delete_namespaced_service_account(
sa,
namespace,
)
except kubernetes.client.exceptions.ApiException as e:
if e.status == 404:
rich.print(
f"Service account [yellow]{sa}[/yellow] not found. Ignoring."
)
else:
raise e
else:
rich.print(
f"Successfully removed service account [green]{sa}[/green]"
)
Copy link
Author

Choose a reason for hiding this comment

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

@marcelovilla I was able to adapt what you did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Changes requested 🧱
Development

Successfully merging this pull request may close these issues.

3 participants