Commit 00347570 authored by garciadeblas's avatar garciadeblas
Browse files

Merge branch 'master' into poc-osm-ltv

parents 680369af c29571ff
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
## Setting up Participant VMs

First, check the common-vars for the following:

```
APT_PROXY=http://172.21.1.1.3142
FLAVOR=test_flavor_fix
KEY_NAME=hackfest
NETWORK=osm-ext
FOCAL=ubuntu20.04
```

APT_PROXY: the address of a caching web proxy for installing packages
FLAVOR: the flavour of the new VM to launch.  Must have at least 4 CPUs, 8 GB RAM and 60 GB Disk.
KEY_NAME: Key to connect VMs
NETWORK: IP addresses will be allocated from this network, this network is management network of OSM instance
FOCAL: Image to install VMs

### Create VMs
This script creates the VMs in required project

```
./run-create-openstack-vms.sh
```


### Initial Configuration
This script updates apt, upgrades the system to the latest 20.04 and installs remote desktop software

```
./run-vm-initial-setup.sh
```


### Install OSM

This script downloads the installer and runs it.  It also sets the OSM admin password to `hackfest`.
```
./run-install-osm.sh
```

### Add VIM and K8s Cluster
Add VIM and ks8cluster to OSM instance
```
./run-osm-vim-k8scluster-add.sh
```

## Full Flow

```
./run-create-openstack-vms.sh
./run-vm-initial-setup.sh
./run-install-osm.sh
./run-osm-vim-k8scluster-add.sh
```
+194 −0
Original line number Diff line number Diff line
# Copyright 2020 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.
name: osm
bundle: kubernetes
docs: https://discourse.charmhub.io/t/osm-docs-index/8806
description: |
  **Single instance Charmed OSM**

  Charmed OSM is an OSM distribution, developed and maintained by Canonical, which uses
  Juju charms to simplify its deployments and operations. This bundle distribution refers
  to the development stack for OSM and allows you to deploy a single instance OSM bundle
  that is fast, reliable, and a complete solution with MicroStack and MicroK8s.

  - Industry‐aligned and fully compliant with upstream
  - Predictable release cadence and upgrade path
  - Simplified deployments and operations
  - Stable and secure
  - Supported with Ubuntu Advantage
  - Availability of managed services
applications:
  zookeeper:
    charm: zookeeper-k8s
    channel: latest/stable
    scale: 1
    storage:
      data: 100M
  kafka:
    charm: kafka-k8s
    channel: latest/stable
    scale: 1
    trust: true
    storage:
      data: 100M
  mariadb:
    charm: charmed-osm-mariadb-k8s
    scale: 1
    series: kubernetes
    storage:
      database: 50M
    options:
      password: manopw
      root_password: osm4u
      user: mano
  mongodb:
    charm: mongodb-k8s
    channel: 5/edge
    scale: 1
    series: kubernetes
    storage:
      db: 50M
  nbi:
    charm: osm-nbi
    channel: latest/beta
    trust: true
    scale: 1
    options:
      database-commonkey: osm
      log-level: DEBUG
    resources:
      nbi-image: opensourcemano/nbi:testing-daily
  ro:
    charm: osm-ro
    channel: latest/beta
    trust: true
    scale: 1
    options:
      log-level: DEBUG
    resources:
      ro-image: opensourcemano/ro:testing-daily
  ng-ui:
    charm: osm-ng-ui
    channel: latest/beta
    trust: true
    scale: 1
    resources:
      ng-ui-image: opensourcemano/ng-ui:testing-daily
  lcm:
    charm: osm-lcm
    channel: latest/beta
    scale: 1
    options:
      database-commonkey: osm
      log-level: DEBUG
    resources:
      lcm-image: opensourcemano/lcm:testing-daily
  mon:
    charm: osm-mon
    channel: latest/beta
    trust: true
    scale: 1
    options:
      database-commonkey: osm
      log-level: DEBUG
      keystone-enabled: true
    resources:
      mon-image: opensourcemano/mon:testing-daily
  pol:
    charm: osm-pol
    channel: latest/beta
    scale: 1
    options:
      log-level: DEBUG
    resources:
      pol-image: gatici/pol:testing-daily
  vca:
    charm: osm-vca-integrator
    channel: latest/beta
    scale: 1
  ingress:
    charm: nginx-ingress-integrator
    channel: latest/stable
    scale: 1
  prometheus:
    charm: osm-prometheus
    channel: latest/stable
    scale: 1
    series: kubernetes
    storage:
      data: 50M
    options:
      default-target: "mon:8000"
  grafana:
    charm: osm-grafana
    channel: latest/stable
    scale: 1
    series: kubernetes
  keystone:
    charm: osm-keystone
    channel: latest/beta
    scale: 1
    resources:
      keystone-image: opensourcemano/keystone:testing-daily
relations:
  - - grafana:prometheus
    - prometheus:prometheus
  - - kafka:zookeeper
    - zookeeper:zookeeper
  - - keystone:db
    - mariadb:mysql
  - - lcm:kafka
    - kafka:kafka
  - - lcm:mongodb
    - mongodb:database
  - - lcm:vca
    - vca:vca
  - - ro:ro
    - lcm:ro
  - - ro:kafka
    - kafka:kafka
  - - ro:mongodb
    - mongodb:database
  - - pol:kafka
    - kafka:kafka
  - - pol:mongodb
    - mongodb:database
  - - mon:mongodb
    - mongodb:database
  - - mon:kafka
    - kafka:kafka
  - - mon:vca
    - vca:vca
  - - nbi:mongodb
    - mongodb:database
  - - nbi:kafka
    - kafka:kafka
  - - nbi:ingress
    - ingress:ingress
  - - nbi:prometheus
    - prometheus:prometheus
  - - nbi:keystone
    - keystone:keystone
  - - mon:prometheus
    - prometheus:prometheus
  - - ng-ui:nbi
    - nbi:nbi
  - - ng-ui:ingress
    - ingress:ingress
  - - mon:keystone
    - keystone:keystone
  - - mariadb:mysql
    - pol:mysql
  - - grafana:db
    - mariadb:mysql
 No newline at end of file
+35 −0
Original line number Diff line number Diff line
cleanup() {
    # kill all processes whose parent is this process
    pkill -P $$
}

for sig in INT QUIT HUP TERM; do
  trap "
    cleanup
    trap - $sig EXIT
    kill -s $sig "'"$$"' "$sig"
done
trap cleanup EXIT

if [ ! -z ${DEBUG} ]; then
    set -x
fi

START=6
MAX=10

if [ ! -z $2 ] ; then
    START=$1
    MAX=$2
elif [ ! -z $1 ] ; then
    START=$1
    MAX=$1
fi

# ETSI VIM ADMIN_DOMAIN=default
APT_PROXY=http://172.21.1.1.3142
FLAVOR=osm.sanity
KEY_NAME=hackfest
NETWORK=osm-ext
FOCAL=ubuntu20.04
+31 −0
Original line number Diff line number Diff line
#!/bin/bash
echo $0 started at $(date)

PARTICIPANT=${1}
. ./common-vars
. ./main_credentials.rc

VM_NAME=`expr charmedosm-${PARTICIPANT}`
echo "Creating public port"
# This port gets created as the admin
openstack port create --disable-port-security --enable --network $NETWORK $VM_NAME
wait

echo "Creating Keypair"
openstack keypair create --public-key ./hackfest_rsa.pub ${KEY_NAME} &
wait

echo "Launching OSM VM"
openstack server create --key-name ${KEY_NAME} --flavor ${FLAVOR} --image ${FOCAL} --nic port-id=$VM_NAME --user-data ./osm-cloud-init.yaml $VM_NAME &
wait

echo "Waiting for OSM VM to be ready"
IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
while [ 1 ] ; do
    sleep 10
    ALIVE=$(ssh -T -o ConnectTimeout=5 -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} "cloud-init status --wait" | tail -1 2> /dev/null)
    echo $ALIVE
    if [ "${ALIVE}" == "status: done" ] ; then break ; fi
done

echo $0 $@ complete at $(date)
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
#!/bin/bash
echo $0 started at $(date)

. ./common-vars
. ./main_credentials.rc


PROJECT_ID=`openstack project list | grep "${PROJECT} " | awk '{print $2}'`
if [ "${PROJECT_ID}" != "" ]; then
    echo "Removing Router Ports"
    for ROUTER in $(openstack router list -f value -c ID); do
        openstack router unset --external-gateway ${ROUTER}
        PORT=$(openstack router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r)
        while [ "${PORT}" != "null" -a "${PORT}" != "" ] ; do
            openstack router remove port ${ROUTER} ${PORT}
            PORT=$(openstack router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r)
        done
    done

    echo "Removing VMs"
    openstack server list -f value -c ID | xargs openstack server delete
    echo "Removing Routers"
    openstack router list -f value -c ID | xargs openstack router delete
    echo "Removing Ports"
    openstack port list -f value -c ID   | xargs openstack port delete
fi


echo $0 $@ complete at $(date)
 No newline at end of file
Loading