From b903c69fac95e797532288d4e6f60530faf1db94 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Jan 2023 15:31:48 +0330 Subject: [PATCH] fix: respect RUN_MYSQL on k8s maple upgrade During the maple -> nutmeg upgrade on k8s, only wait for mysql when RUN_MYSQL is true. --- ...109_100009_codewithemad_upgrade_mysql_issue.md | 1 + tutor/commands/upgrade/k8s.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 changelog.d/20230109_100009_codewithemad_upgrade_mysql_issue.md diff --git a/changelog.d/20230109_100009_codewithemad_upgrade_mysql_issue.md b/changelog.d/20230109_100009_codewithemad_upgrade_mysql_issue.md new file mode 100644 index 0000000000..279deb9c9b --- /dev/null +++ b/changelog.d/20230109_100009_codewithemad_upgrade_mysql_issue.md @@ -0,0 +1 @@ +[Bugfix] Running `tutor k8s upgrade --from=maple` won't apply and won't wait for the MySQL deployment to be ready if `RUN_MYSQL: false` (When you host your MySQL somewhere else like RDS) (by @CodeWithEmad) \ No newline at end of file diff --git a/tutor/commands/upgrade/k8s.py b/tutor/commands/upgrade/k8s.py index a31109731a..7d9d94a070 100644 --- a/tutor/commands/upgrade/k8s.py +++ b/tutor/commands/upgrade/k8s.py @@ -120,13 +120,14 @@ def upgrade_from_maple(context: Context, config: Config) -> None: # The environment needs to be updated because the backpopulate/backfill commands are from Nutmeg tutor_env.save(context.root, config) - # Start mysql - k8s.kubectl_apply( - context.root, - "--selector", - "app.kubernetes.io/name=mysql", - ) - k8s.wait_for_deployment_ready(config, "mysql") + if config["RUN_MYSQL"]: + # Start mysql + k8s.kubectl_apply( + context.root, + "--selector", + "app.kubernetes.io/name=mysql", + ) + k8s.wait_for_deployment_ready(config, "mysql") # lms upgrade k8s.kubectl_apply(