From 3d065ca0fc472f274415295bbaf1166c6961c617 Mon Sep 17 00:00:00 2001 From: beierlm Date: Fri, 3 Jun 2022 09:54:03 +0000 Subject: [PATCH 1/2] Upgrade procedure for 10.1.0 -> 10.1.1 --- 19-lts-upgrade.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 1153235..6269e37 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -4,6 +4,66 @@ Starting with version 10.1.0 of OSM, every even numbered release will receive two years of community support. This document covers the steps needed for upgrading OSM. Depending on the installation method, there are two methods for upgrading OSM to an LTS version. +## Upgrade of 10.1.0 to 10.1.1 LTS + +This procedure covers both the upgrade of 10.1.0 to 10.1.1 LTS. There are two installation methods, each with its own set of procedures: + +* [Kubernetes Installation Option](#kubernetes-installation-to-1011) +* [Charmed Installation Option](#charmed-installation-to-1011) + + +### Kubernetes Installation to 10.1.1 + +### Charmed Installation to 10.1.1 + +#### Back up the Databases + +If desired, the databases can be backed up using the following commands: + +```bash +mariadb_unit=$(juju status | grep -i mariadb | tail -1 | awk -F" " '{print $1}' | tr -d '[*]') +mariadb_pod=$(microk8s.kubectl get pod -n osm | grep -i mariadb | tail -1 | awk -F" " '{print $1}') +juju run-action $mariadb_unit backup --wait -m osm +microk8s.kubectl cp osm/$mariadb_pod:/var/lib/mysql/backup.sql.gz backup.sql.gz + +mongodb_unit=$(juju status | grep -i mongodb | tail -1 | awk -F" " '{print $1}'| tr -d '[*]') +mongodb_pod=$(microk8s.kubectl get pod -n osm | grep -i mongodb | tail -1 | awk -F" " '{print $1}') +microk8s.kubectl exec -n osm -it $mongodb_pod -- mongodump --gzip --archive=/data/backup.archive +microk8s.kubectl cp osm/$mongodb_pod:/data/backup.archive backup.archive +``` + +#### Upgrade Juju + +The following commands will upgrade the OSM controller. + +```bash +sudo snap refresh juju --channel 2.9/stable +juju upgrade-controller +``` + +Next, for any native or proxy charms, upgrade each model. + +```bash +for model in $(juju models --format json | jq .models[].name | tr -d \") ; do + juju switch $model + juju upgrade-model +done +``` + +#### Upgrade OSM Application + +```bash +juju attach-resource -m osm lcm image=opensourcemano/lcm:10.1.1 +juju attach-resource -m osm mon image=opensourcemano/mon:10.1.1 +juju attach-resource -m osm nbi image=opensourcemano/nbi:10.1.1 +juju attach-resource -m osm ng-ui image=opensourcemano/ng-ui:10.1.1 +juju attach-resource -m osm pla image=opensourcemano/pla:10.1.1 +juju attach-resource -m osm pol image=opensourcemano/pol:10.1.1 +juju attach-resource -m osm ro image=opensourcemano/ro:10.1.1 +``` + +At this point, OSM has been upgraded. + ## Upgrade of Pre-LTS to 10.1.0 LTS This procedure covers both upgrade from 9.1.5 or 10.0.3 to 10.1.0 LTS. Where necessary, additional steps for 9.1.5 are shown. There are two installation methods, each with its own set of procedures: -- GitLab From 4ed9e9517244760fb17e136aaf5b71bbffdd4d6f Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 6 Jun 2022 14:34:21 +0000 Subject: [PATCH 2/2] Update 19-lts-upgrade.md --- 19-lts-upgrade.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 6269e37..119064c 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -11,9 +11,61 @@ This procedure covers both the upgrade of 10.1.0 to 10.1.1 LTS. There are two i * [Kubernetes Installation Option](#kubernetes-installation-to-1011) * [Charmed Installation Option](#charmed-installation-to-1011) - ### Kubernetes Installation to 10.1.1 +#### Back up the Databases + +If desired, the databases can be backed up using the following commands: + +```bash +mysql_pod=$(kubectl get pod -n osm | grep -i mysql | tail -1 | awk -F" " '{print $1}') +kubectl exec -n osm -it $mysql_pod -- bash -c \ + 'mysqldump -u root -p$MYSQL_ROOT_PASSWORD --single-transaction --all-databases' \ + | gzip > backup.sql.gz + +mongodb_unit=$(juju status | grep -i mongodb | tail -1 | awk -F" " '{print $1}'| tr -d '[*]') +mongodb_pod=$(kubectl get pod -n osm | grep -i mongodb | grep -v operator | tail -1 | awk -F" " '{print $1}') +juju run-action $mongodb_unit backup --wait -m osm +kubectl cp osm/$mongodb_pod:/data/backup.archive backup.archive +``` + +#### Upgrade Juju + +The following commands will upgrade the OSM controller. + +```bash +sudo snap refresh juju --channel 2.9/stable +juju upgrade-controller +``` + +Next, for any native or proxy charms, upgrade each model. + +```bash +for model in $(juju models --format json | jq .models[].name | tr -d \") ; do + juju switch $model + juju upgrade-model +done +``` + +#### Upgrade OSM Application + +```bash +OSM_VERSION="10.1.1" +for module in lcm mon nbi ng-ui pla pol ro; do + kubectl -n osm patch deployment ${module} --patch '{"spec": {"template": {"spec": {"containers": [{"name": "${module}", "image": "opensourcemano/${module}:${OSM_VERSION}"}]}}}}' + kubectl -n osm scale deployment ${module} --replicas=0 + kubectl -n osm scale deployment ${module} --replicas=1 +done +# In order to make this change persistent after reboots, +# you will have to update the files under /etc/osm/docker/osm_pods to reflect the changes +for module in lcm mon nbi ng-ui pol ro; do + sudo sed -i "s/opensourcemano\/${module}:.*/opensourcemano\/${module}:${OSM_VERSION}/g" /etc/osm/docker/osm_pods/${module}.yaml +done +sudo sed -i "s/opensourcemano\/pla:.*/opensourcemano\/pla:${OSM_VERSION}/g" /etc/osm/docker/osm_pods/osm_pla/${module}.yaml +``` + +At this point, OSM has been upgraded. + ### Charmed Installation to 10.1.1 #### Back up the Databases -- GitLab