From 2ff30120fe2d373d8b9b2acf59a48245944884b5 Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 7 May 2024 14:41:37 -0500 Subject: [PATCH 1/6] change default gcp instances to cost optimized e2 family instances --- src/_nebari/stages/infrastructure/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_nebari/stages/infrastructure/__init__.py b/src/_nebari/stages/infrastructure/__init__.py index f430c4912..170e23ca5 100644 --- a/src/_nebari/stages/infrastructure/__init__.py +++ b/src/_nebari/stages/infrastructure/__init__.py @@ -314,9 +314,9 @@ class GCPNodeGroup(schema.Base): DEFAULT_GCP_NODE_GROUPS = { - "general": GCPNodeGroup(instance="n1-standard-8", min_nodes=1, max_nodes=1), - "user": GCPNodeGroup(instance="n1-standard-4", min_nodes=0, max_nodes=5), - "worker": GCPNodeGroup(instance="n1-standard-4", min_nodes=0, max_nodes=5), + "general": GCPNodeGroup(instance="e2-highmem-4", min_nodes=1, max_nodes=1), + "user": GCPNodeGroup(instance="e2-standard-4", min_nodes=0, max_nodes=5), + "worker": GCPNodeGroup(instance="e2-standard-4", min_nodes=0, max_nodes=5), } From 6bbb3b70f598b253ca720935b23341c604095745 Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 14 May 2024 11:43:11 -0500 Subject: [PATCH 2/6] add upgrade message --- src/_nebari/upgrade.py | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index 2a98ff6f4..f53377c0a 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -784,6 +784,53 @@ def _version_specific_upgrade( return config +class Upgrade_2024_6_1(UpgradeStep): + version = "2024.6.1" + + def _version_specific_upgrade( + self, config, start_version, config_filename: Path, *args, **kwargs + ): + if provider := config.get("provider", ""): + if provider == ProviderEnum.gcp.value: + provider_full_name = provider_enum_name_map[provider] + if not config.get(provider_full_name, {}).get("node_groups", {}): + try: + continue_ = Prompt.ask( + f"""The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. + This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. + + As always, make sure to [backup data](https://www.nebari.dev/docs/how-tos/manual-backup/) before upgrading. + + Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]? + If not, select "N" and the old default node groups will be added to the nebari config file. + """, + choices=["y", "N"], + default="y", + ) + if continue_ == "N": + config[provider_full_name]["node_groups"] = { + "general": { + "instance": "n1-standard-8", + "min_nodes": 1, + "max_nodes": 1, + }, + "user": { + "instance": "n1-standard-4", + "min_nodes": 0, + "max_nodes": 5, + }, + "worker": { + "instance": "n1-standard-4", + "min_nodes": 0, + "max_nodes": 5, + }, + } + except KeyError: + pass + + return config + + __rounded_version__ = str(rounded_ver_parse(__version__)) # Manually-added upgrade steps must go above this line From 75270ba13d5d1e58f106787f1bc28f8fb1f0290f Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 14 May 2024 11:57:29 -0500 Subject: [PATCH 3/6] make upgrade step 2024.5.2 --- src/_nebari/upgrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index f53377c0a..11d14d3ad 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -784,8 +784,8 @@ def _version_specific_upgrade( return config -class Upgrade_2024_6_1(UpgradeStep): - version = "2024.6.1" +class Upgrade_2024_5_2(UpgradeStep): + version = "2024.5.2" def _version_specific_upgrade( self, config, start_version, config_filename: Path, *args, **kwargs From c45b0832a5e8418bc28abef3007930401f5a60c1 Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 14 May 2024 12:57:25 -0500 Subject: [PATCH 4/6] add upgrade message --- src/_nebari/upgrade.py | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index 11d14d3ad..df3ae66c1 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -3,6 +3,7 @@ import re import secrets import string +import textwrap from abc import ABC from pathlib import Path from typing import Any, ClassVar, Dict @@ -787,6 +788,10 @@ def _version_specific_upgrade( class Upgrade_2024_5_2(UpgradeStep): version = "2024.5.2" + @staticmethod + def _wrap(s): + return "\n".join("\n".join(textwrap.wrap(x)) for x in s.splitlines()) + def _version_specific_upgrade( self, config, start_version, config_filename: Path, *args, **kwargs ): @@ -795,15 +800,18 @@ def _version_specific_upgrade( provider_full_name = provider_enum_name_map[provider] if not config.get(provider_full_name, {}).get("node_groups", {}): try: - continue_ = Prompt.ask( - f"""The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. - This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. + text = f""" +The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. \ +This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. - As always, make sure to [backup data](https://www.nebari.dev/docs/how-tos/manual-backup/) before upgrading. +As always, make sure to [link=https://www.nebari.dev/docs/how-tos/manual-backup]backup data[/link] before upgrading. - Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]? - If not, select "N" and the old default node groups will be added to the nebari config file. - """, +Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]? +If not, select "N" and the old default node groups will be added to the nebari config file. +""".rstrip() + wrapped_text = self._wrap(text) + continue_ = Prompt.ask( + wrapped_text, choices=["y", "N"], default="y", ) @@ -827,7 +835,22 @@ def _version_specific_upgrade( } except KeyError: pass + else: + text = f""" +The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. +Consider upgrading your node group instance types to the new default configuration. + +Upgrading your general node will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. + +As always, make sure to [link=https://www.nebari.dev/docs/how-tos/manual-backup]backup data[/link] before upgrading. + +The new default node groups instances are: +{json.dumps({'general': {'instance': 'e2-highmem-4'}, 'user': {'instance': 'e2-standard-4'}, 'worker': {'instance': 'e2-standard-4'}}, indent=4)} +Hit enter to continue +""".rstrip() + wrapped_text = self._wrap(text) + Prompt.ask(wrapped_text) return config From 647104851d340a1b413c9b63e026a017b43f37bf Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 14 May 2024 13:05:52 -0500 Subject: [PATCH 5/6] add link --- src/_nebari/upgrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index df3ae66c1..013bf3f64 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -804,7 +804,7 @@ def _version_specific_upgrade( The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. \ This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. -As always, make sure to [link=https://www.nebari.dev/docs/how-tos/manual-backup]backup data[/link] before upgrading. +As always, make sure to backup data before upgrading. See https://www.nebari.dev/docs/how-tos/manual-backup for more information. Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]? If not, select "N" and the old default node groups will be added to the nebari config file. @@ -842,7 +842,7 @@ def _version_specific_upgrade( Upgrading your general node will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. -As always, make sure to [link=https://www.nebari.dev/docs/how-tos/manual-backup]backup data[/link] before upgrading. +As always, make sure to backup data before upgrading. See https://www.nebari.dev/docs/how-tos/manual-backup for more information. The new default node groups instances are: {json.dumps({'general': {'instance': 'e2-highmem-4'}, 'user': {'instance': 'e2-standard-4'}, 'worker': {'instance': 'e2-standard-4'}}, indent=4)} From 58e05c4c0528c0426504cd14db121bbdba650aa1 Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 14 May 2024 13:09:41 -0500 Subject: [PATCH 6/6] remove upgrade step --- src/_nebari/upgrade.py | 70 ------------------------------------------ 1 file changed, 70 deletions(-) diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index 013bf3f64..2a98ff6f4 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -3,7 +3,6 @@ import re import secrets import string -import textwrap from abc import ABC from pathlib import Path from typing import Any, ClassVar, Dict @@ -785,75 +784,6 @@ def _version_specific_upgrade( return config -class Upgrade_2024_5_2(UpgradeStep): - version = "2024.5.2" - - @staticmethod - def _wrap(s): - return "\n".join("\n".join(textwrap.wrap(x)) for x in s.splitlines()) - - def _version_specific_upgrade( - self, config, start_version, config_filename: Path, *args, **kwargs - ): - if provider := config.get("provider", ""): - if provider == ProviderEnum.gcp.value: - provider_full_name = provider_enum_name_map[provider] - if not config.get(provider_full_name, {}).get("node_groups", {}): - try: - text = f""" -The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. \ -This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. - -As always, make sure to backup data before upgrading. See https://www.nebari.dev/docs/how-tos/manual-backup for more information. - -Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]? -If not, select "N" and the old default node groups will be added to the nebari config file. -""".rstrip() - wrapped_text = self._wrap(text) - continue_ = Prompt.ask( - wrapped_text, - choices=["y", "N"], - default="y", - ) - if continue_ == "N": - config[provider_full_name]["node_groups"] = { - "general": { - "instance": "n1-standard-8", - "min_nodes": 1, - "max_nodes": 1, - }, - "user": { - "instance": "n1-standard-4", - "min_nodes": 0, - "max_nodes": 5, - }, - "worker": { - "instance": "n1-standard-4", - "min_nodes": 0, - "max_nodes": 5, - }, - } - except KeyError: - pass - else: - text = f""" -The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%. -Consider upgrading your node group instance types to the new default configuration. - -Upgrading your general node will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss. - -As always, make sure to backup data before upgrading. See https://www.nebari.dev/docs/how-tos/manual-backup for more information. - -The new default node groups instances are: -{json.dumps({'general': {'instance': 'e2-highmem-4'}, 'user': {'instance': 'e2-standard-4'}, 'worker': {'instance': 'e2-standard-4'}}, indent=4)} - -Hit enter to continue -""".rstrip() - wrapped_text = self._wrap(text) - Prompt.ask(wrapped_text) - return config - - __rounded_version__ = str(rounded_ver_parse(__version__)) # Manually-added upgrade steps must go above this line