Commit 90c08a9c authored by Francisco-Javier Ramon Salguero's avatar Francisco-Javier Ramon Salguero
Browse files

Merge branch 'upgrade_osm' into 'master'

Procedure in 03-installing-osm.md to upgrade OSM when using K8s

See merge request !19
parents bb108076 c864507e
Loading
Loading
Loading
Loading
+206 −18
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ chmod +x install_osm.sh
./install_osm.sh -c k8s
```

In addition, you can use the option `--k8s\_monitor` to install an add-on to monitor the K8s cluster and OSM running on top of it.
In addition, you can use the option `--k8s_monitor` to install an add-on to monitor the K8s cluster and OSM running on top of it.

 ```bash
./install_osm.sh -c k8s --k8s_monitor
@@ -287,7 +287,9 @@ For additional remote access options, see `osm --help` for more info.

## How to upgrade OSM

### Upgrading the complete OSM platform
### How to upgrade OSM when using docker swarm as container framework (default)

#### Upgrading the complete OSM platform

Due to the new architecture and dockerized components introduced in OSM since Release FOUR, OSM platform upgrade is quite easy. Upgrading to the latest minor version is as simple as running again the installer:

@@ -299,16 +301,9 @@ chmod +x install_osm.sh

You will be asked if you want to proceed with the installation and configuration of LXD, juju, docker CE and the initialization of a local docker swarm, as pre-requirements. Please answer `y`.

Then, some dialog messages related to LXD configuration will be shown. This is what you have to answer:

- `Do you want to configure the LXD bridge?` **Yes**
- `Do you want to setup an IPv4 subnet?` **Yes**
- _<< **Default values** apply for next questions >>_
- `Do you want to setup an IPv6 subnet?` **No**

That's all. You will have the newest OSM version installed.

### Upgrading the OSM platform from docker images (advanced users)
#### Upgrading the OSM platform from docker images (advanced users)

**Upgrading to the latest daily docker image might lead to potential issues.** Moreover, every new re-deployment of the stack will involve a download of a new docker daily image if it exists. Unless you are really sure about what you are doing, please use this procedure with caution.

@@ -355,7 +350,7 @@ sudo apt-get install python3-osmclient
dpkg -l |grep python3-osmclient   #to check the installed version
```

### Upgrading only a specific component (advanced users)
#### Upgrading only a specific component (advanced users)

**Upgrading a specific OSM component without upgrading the others accordingly may lead to potential inconsistencies.** Unless you are really sure about what you are doing, please use this procedure with caution.

@@ -363,7 +358,7 @@ One of the commonest reasons for this type of upgrade is using your own cloned r

The procedure below involves building manually some docker images. The developer environment might require updating manually the MTU of the docker default "bridge" network following the procedure in this link: <https://docs.docker.com/network/bridge/>

#### Upgrading RO
##### Upgrading RO

This involves upgrading (`ro` and `ro-db`):

@@ -381,7 +376,7 @@ docker service update osm_ro --force --image opensourcemano/ro:develop
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

#### Upgrading LCM
##### Upgrading LCM

```bash
git clone https://osm.etsi.org/gerrit/osm/LCM
@@ -396,7 +391,7 @@ docker service update osm_lcm --force --image opensourcemano/lcm:develop
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

#### Upgrading MON
##### Upgrading MON

```bash
git clone https://osm.etsi.org/gerrit/osm/MON
@@ -411,7 +406,7 @@ docker service update osm_mon --force --image opensourcemano/mon:develop
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

#### Upgrading POL
##### Upgrading POL

```bash
git clone https://osm.etsi.org/gerrit/osm/POL
@@ -426,7 +421,7 @@ docker service update osm_pol --force --image opensourcemano/pol:develop
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

#### Upgrading NBI
##### Upgrading NBI

```bash
git clone https://osm.etsi.org/gerrit/osm/NBI
@@ -441,7 +436,7 @@ docker service update osm_nbi --force --image opensourcemano/nbi:develop
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

#### Upgrading light UI
##### Upgrading light UI

```bash
git clone https://osm.etsi.org/gerrit/osm/LW-UI
@@ -456,7 +451,7 @@ docker service update osm_light-ui --force --image opensourcemano/light-ui:devel
# docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm
```

### Upgrading only a specific component from source code (advanced users)
#### Upgrading only a specific component from source code (advanced users)

**FIXME:** The procedure described here needs revision, as it may work differently in the latest OSM release.

@@ -491,3 +486,196 @@ Or to use an old version of MON:
```bash
./install_osm.sh -m MON -b tags/v6.0.3
```

### How to upgrade OSM when using K8s as container framework

#### Upgrading the complete OSM platform

Upgrading to the latest minor version is as simple as running again the installer:

```bash
wget https://osm-download.etsi.org/ftp/osm-7.0-seven/install_osm.sh
chmod +x install_osm.sh
./install_osm.sh -c k8s
```

You will be asked if you want to proceed with the installation and configuration of LXD, juju, docker CE, kubelet, kubectl and the initialization of a local single-node K8s cluster, as pre-requirements. Please answer `y`.

That's all. You will have the newest OSM version installed.

#### Upgrading the OSM platform from docker images (advanced users)

**Upgrading to the latest daily docker image might lead to potential issues.** Moreover, every new re-deployment of the stack will involve a download of a new docker daily image if it exists. Unless you are really sure about what you are doing, please use this procedure with caution.

The commonest reason for this procedure is using the latest daily testing docker image or a specific tag.

You can use option `-t` in the installer to specify a specific docker tag to be used by the installer.

To install the latest daily images:

```bash
./install_osm.sh -c k8s -t releaseseven-daily
```

To install a previous version e.g. v6.0.3:

```bash
./install_osm.sh -c k8s -t v6.0.3
```

The previous commands will do the installation and deployment of the whole platform in the namespace `osm`.

Another option is to change directly the K8s Manifest YAML files located in `/etc/osm/docker/osm_pods`. Below an example to update them to use `releaseseven-daily` tag:

```bash
sudo sed -i "s/opensourcemano\/ro:.*/opensourcemano\/ro:releaseseven-daily/g" /etc/osm/docker/osm_pods/ro.yaml
sudo sed -i "s/opensourcemano\/lcm:.*/opensourcemano\/lcm:releaseseven-daily/g" /etc/osm/docker/osm_pods/lcm.yaml
sudo sed -i "s/opensourcemano\/mon:.*/opensourcemano\/mon:releaseseven-daily/g" /etc/osm/docker/osm_pods/mon.yaml
sudo sed -i "s/opensourcemano\/pol:.*/opensourcemano\/pol:releaseseven-daily/g" /etc/osm/docker/osm_pods/pol.yaml
sudo sed -i "s/opensourcemano\/nbi:.*/opensourcemano\/nbi:releaseseven-daily/g" /etc/osm/docker/osm_pods/nbi.yaml
sudo sed -i "s/opensourcemano\/light-ui:.*/opensourcemano\/light-ui:releaseseven-daily/g" /etc/osm/docker/osm_pods/light-ui.yaml
sudo sed -i "s/opensourcemano\/keystone:.*/opensourcemano\/keystone:releaseseven-daily/g" /etc/osm/docker/osm_pods/keystone.yaml
kubectl -n osm apply -f /etc/osm/docker/osm_pods
```

The OSM Client will have to be updated independently. In order to use the latest "testing" OSM Client, you will have to update the debian repo to use the testing repo, remove the previous debian package and install the one from the new repo as follows:

```bash
sudo apt-get remove python-osmclient
sudo apt-get remove pytho3-osmclient
# Clean the previous repos that might exist
sudo sed -i "/osm-download.etsi.org/d" /etc/apt/sources.list
sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseSEVEN-daily testing osmclient"
sudo apt-get update
sudo apt-get install python3-osmclient
dpkg -l |grep python3-osmclient   #to check the installed version
```

#### Upgrading only a specific component (advanced users)

**Upgrading a specific OSM component without upgrading the others accordingly may lead to potential inconsistencies.** Unless you are really sure about what you are doing, please use this procedure with caution.

One of the commonest reasons for this type of upgrade is using your own cloned repo of a module for development purposes.

##### Upgrading RO

This involves upgrading (`ro` and `ro-db`):

```bash
docker pull mysql:5
git clone https://osm.etsi.org/gerrit/osm/RO
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build RO -f RO/Dockerfile-local -t opensourcemano/ro:develop --no-cache
kubectl -n osm patch deployment ro --patch '{"spec": {"template": {"spec": {"containers": [{"name": "ro", "image": "opensourcemano/ro:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/ro.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/ro:.*/opensourcemano\/ro:develop/g" /etc/osm/docker/osm_pods/ro.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/ro.yaml
```

##### Upgrading LCM

```bash
git clone https://osm.etsi.org/gerrit/osm/LCM
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build LCM -f LCM/Dockerfile.local -t opensourcemano/lcm:develop --no-cache
kubectl -n osm patch deployment lcm --patch '{"spec": {"template": {"spec": {"containers": [{"name": "lcm", "image": "opensourcemano/lcm:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/lcm.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/lcm:.*/opensourcemano\/lcm:develop/g" /etc/osm/docker/osm_pods/lcm.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/lcm.yaml
```

##### Upgrading MON

```bash
git clone https://osm.etsi.org/gerrit/osm/MON
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build MON -f MON/docker/Dockerfile -t opensourcemano/mon:develop --no-cache
kubectl -n osm patch deployment mon --patch '{"spec": {"template": {"spec": {"containers": [{"name": "mon", "image": "opensourcemano/mon:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/mon.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/mon:.*/opensourcemano\/mon:develop/g" /etc/osm/docker/osm_pods/mon.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/mon.yaml
```

##### Upgrading POL

```bash
git clone https://osm.etsi.org/gerrit/osm/POL
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build POL -f POL/docker/Dockerfile -t opensourcemano/pol:develop --no-cache
kubectl -n osm patch deployment pol --patch '{"spec": {"template": {"spec": {"containers": [{"name": "pol", "image": "opensourcemano/pol:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/pol.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/pol:.*/opensourcemano\/pol:develop/g" /etc/osm/docker/osm_pods/pol.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/pol.yaml
```

##### Upgrading NBI

```bash
git clone https://osm.etsi.org/gerrit/osm/NBI
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build NBI -f NBI/Dockerfile.local -t opensourcemano/nbi:develop --no-cache
kubectl -n osm patch deployment nbi --patch '{"spec": {"template": {"spec": {"containers": [{"name": "nbi", "image": "opensourcemano/nbi:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/nbi.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/nbi:.*/opensourcemano\/nbi:develop/g" /etc/osm/docker/osm_pods/nbi.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/nbi.yaml
```

##### Upgrading light UI

```bash
git clone https://osm.etsi.org/gerrit/osm/LW-UI
#you can then work in the cloned repo, apply patches with git pull, etc.
docker build LW-UI -f LW-UI/docker/Dockerfile -t opensourcemano/light-ui:develop --no-cache
kubectl -n osm patch deployment light-ui --patch '{"spec": {"template": {"spec": {"containers": [{"name": "light-ui", "image": "opensourcemano/light-ui:develop"}]}}}}'
# In order to make this change persistent after reboots,
# you will have to update the file /etc/osm/docker/osm_pods/light-ui.yaml to reflect the change
# in the docker image, for instance:
# sudo sed -i "s/opensourcemano\/light-ui:.*/opensourcemano\/light-ui:develop/g" /etc/osm/docker/osm_pods/light-ui.yaml
# kubectl -n osm apply -f /etc/osm/docker/osm_pods/light-ui.yaml
```

#### Upgrading only a specific component from source code (advanced users)

**FIXME:** The procedure described here needs revision, as it may work differently in the latest OSM release.

**Upgrading a specific OSM component without upgrading the others accordingly may lead to potential inconsistencies.** Unless you are really sure about what you are doing, please use this procedure with caution.

This procedure is useful to use the master branch or an old version for development purposes.

For this purpose, you can use options `-b` and `-m` in the installer:

```bash
./install_osm.sh --help
usage: ./install_osm.sh [OPTIONS]
Install OSM from binaries or source code (by default, from binaries)
 OPTIONS
...
    -b <refspec>:   install OSM from source code using a specific branch (master, v2.0, ...) or tag
                    -b master          (main dev branch)
                    -b v2.0            (v2.0 branch)
                    -b tags/v1.1.0     (a specific tag)
                    ...
    -m <MODULE>:    install OSM but only rebuild the specified docker images (LW-UI, NBI, LCM, RO, MON, POL, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)
```

Or to use master branch in LCM:

```bash
./install_osm.sh -c k8s -m LCM -b master
```

Or to use an old version of MON:

```bash
./install_osm.sh -c k8s -m MON -b tags/v6.0.3
```