blob: d4f0b8f7d1dfa4502194a1a27a1704b16e65563e [file] [log] [blame]
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +01001#! /bin/bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
David Garcia42375212020-04-27 19:07:49 +020015
16# set -eux
17
18K8S_CLOUD_NAME="k8s-cloud"
beierlmdfd42882020-07-02 14:21:09 -040019KUBECTL="microk8s.kubectl"
David Garcia69388c22020-05-07 12:14:19 +020020IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010021function check_arguments(){
22 while [ $# -gt 0 ] ; do
David Garcia42375212020-04-27 19:07:49 +020023 case $1 in
24 --bundle) BUNDLE="$2" ;;
Dominik Fleischmann7a97a4c2020-06-04 10:52:05 +020025 --k8s) KUBECFG="$2" ;;
26 --vca) CONTROLLER="$2" ;;
27 --lxd) LXD_CLOUD="$2" ;;
28 --lxd-cred) LXD_CREDENTIALS="$2" ;;
David Garcia69388c22020-05-07 12:14:19 +020029 --microstack) MICROSTACK=y ;;
Dominik Fleischmannc57296f2020-06-09 11:45:08 +020030 --ha) BUNDLE="osm-ha" ;;
David Garcia69388c22020-05-07 12:14:19 +020031 --tag) TAG="$2" ;;
David Garcia42375212020-04-27 19:07:49 +020032 esac
33 shift
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010034 done
35
David Garcia42375212020-04-27 19:07:49 +020036 # echo $BUNDLE $KUBECONFIG $LXDENDPOINT
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010037}
beierlm838e3fd2020-07-28 09:21:07 -040038
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010039function install_snaps(){
beierlm838e3fd2020-07-28 09:21:07 -040040 if [ ! -v KUBECFG ]; then
41 sudo snap install microk8s --classic
42 sudo usermod -a -G microk8s `whoami`
43 mkdir -p ~/.kube
44 sudo chown -f -R `whoami` ~/.kube
45 KUBEGRP="microk8s"
46 else
47 KUBECTL="kubectl"
48 sudo snap install kubectl --classic
49 export KUBECONFIG=${KUBECFG}
50 KUBEGRP=$(id -g -n)
51 fi
Dominik Fleischmann71997c12020-06-30 14:25:19 +020052 sudo snap install juju --classic --channel=2.8/stable
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010053}
54
55function bootstrap_k8s_lxd(){
David Garcia42375212020-04-27 19:07:49 +020056 [ -v CONTROLLER ] && ADD_K8S_OPTS="--controller ${CONTROLLER}" && CONTROLLER_NAME=$CONTROLLER
beierlm9425dd22020-07-16 16:57:09 -040057 [ ! -v CONTROLLER ] && ADD_K8S_OPTS="--client" && BOOTSTRAP_NEEDED="yes" && CONTROLLER_NAME="osm-vca"
58
59 if [ -v BOOTSTRAP_NEEDED ]; then
60 CONTROLLER_PRESENT=$(juju controllers 2>/dev/null| grep ${CONTROLLER_NAME} | wc -l)
61 if [ $CONTROLLER_PRESENT -ge 1 ]; then
62 cat << EOF
63Threre is already a VCA present with the installer reserved name of "${CONTROLLER_NAME}".
64You may either explicitly use this VCA with the "--vca ${CONTROLLER_NAME}" option, or remove it
65using this command:
66
67 juju destroy-controller --release-storage --destroy-all-models -y ${CONTROLLER_NAME}
68
69Please retry the installation once this conflict has been resolved.
70EOF
71 exit 1
72 fi
73 fi
David Garcia42375212020-04-27 19:07:49 +020074
75 if [ -v KUBECFG ]; then
76 cat $KUBECFG | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
beierlm62e60442020-09-15 16:00:34 -040077 [ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME \
78 --config controller-service-type=loadbalancer \
79 --agent-version=2.8.1
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +010080 else
beierlm838e3fd2020-07-28 09:21:07 -040081 sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
82 sg ${KUBEGRP} -c "microk8s.enable storage dns"
beierlm9425dd22020-07-16 16:57:09 -040083 TIME_TO_WAIT=30
84 start_time="$(date -u +%s)"
Dominik Fleischmannc57296f2020-06-09 11:45:08 +020085 while true
86 do
beierlm9425dd22020-07-16 16:57:09 -040087 now="$(date -u +%s)"
88 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
89 echo "Microk8s storage failed to enable"
beierlm838e3fd2020-07-28 09:21:07 -040090 sg ${KUBEGRP} -c "microk8s.status"
beierlm9425dd22020-07-16 16:57:09 -040091 exit 1
92 fi
calvinosanc1698b5b32020-08-21 12:12:52 +020093 storage_status=`sg ${KUBEGRP} -c "microk8s.status -a storage"`
94 if [[ $storage_status == "enabled" ]]; then
Dominik Fleischmannc57296f2020-06-09 11:45:08 +020095 break
96 fi
97 sleep 1
98 done
David Garcia42375212020-04-27 19:07:49 +020099
beierlm838e3fd2020-07-28 09:21:07 -0400100 [ ! -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "microk8s.config" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
beierlm62e60442020-09-15 16:00:34 -0400101 [ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c \
102 "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer --agent-version=2.8.1" \
103 && K8S_CLOUD_NAME=microk8s
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100104 fi
105
David Garcia42375212020-04-27 19:07:49 +0200106 if [ -v LXD_CLOUD ]; then
107 if [ ! -v LXD_CREDENTIALS ]; then
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100108 echo "The installer needs the LXD server certificate if the LXD is external"
109 exit 1
110 fi
111 else
112 LXDENDPOINT=$DEFAULT_IP
David Garcia42375212020-04-27 19:07:49 +0200113 LXD_CLOUD=~/.osm/lxd-cloud.yaml
114 LXD_CREDENTIALS=~/.osm/lxd-credentials.yaml
115 # Apply sysctl production values for optimal performance
116 sudo cp /usr/share/osm-devops/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
117 sudo sysctl --system
118 # Install LXD snap
119 sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client
120 sudo snap install lxd
121 sudo apt-get install zfsutils-linux -y
122 # Configure LXD
123 sudo usermod -a -G lxd `whoami`
124 cat /usr/share/osm-devops/installers/lxd-preseed.conf | sed 's/^config: {}/config:\n core.https_address: '$LXDENDPOINT':8443/' | sg lxd -c "lxd init --preseed"
125 sg lxd -c "lxd waitready"
126 DEFAULT_MTU=$(ip addr show $DEFAULT_IF | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
127 sg lxd -c "lxc profile device set default eth0 mtu $DEFAULT_MTU"
David Garciad00e49c2020-06-19 10:33:37 +0200128 sg lxd -c "lxc network set lxdbr0 bridge.mtu $DEFAULT_MTU"
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100129
David Garcia42375212020-04-27 19:07:49 +0200130 cat << EOF > $LXD_CLOUD
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100131clouds:
132 lxd-cloud:
133 type: lxd
134 auth-types: [certificate]
135 endpoint: "https://$LXDENDPOINT:8443"
136 config:
137 ssl-hostname-verification: false
138EOF
David Garcia42375212020-04-27 19:07:49 +0200139 openssl req -nodes -new -x509 -keyout ~/.osm/client.key -out ~/.osm/client.crt -days 365 -subj "/C=FR/ST=Nice/L=Nice/O=ETSI/OU=OSM/CN=osm.etsi.org"
140 local server_cert=`cat /var/snap/lxd/common/lxd/server.crt | sed 's/^/ /'`
141 local client_cert=`cat ~/.osm/client.crt | sed 's/^/ /'`
142 local client_key=`cat ~/.osm/client.key | sed 's/^/ /'`
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100143
David Garcia42375212020-04-27 19:07:49 +0200144 cat << EOF > $LXD_CREDENTIALS
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100145credentials:
146 lxd-cloud:
David Garcia42375212020-04-27 19:07:49 +0200147 lxd-cloud:
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100148 auth-type: certificate
149 server-cert: |
150$server_cert
151 client-cert: |
152$client_cert
153 client-key: |
154$client_key
155EOF
David Garcia42375212020-04-27 19:07:49 +0200156 lxc config trust add local: ~/.osm/client.crt
157 fi
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100158
David Garcia42375212020-04-27 19:07:49 +0200159 juju add-cloud -c $CONTROLLER_NAME lxd-cloud $LXD_CLOUD --force
160 juju add-credential -c $CONTROLLER_NAME lxd-cloud -f $LXD_CREDENTIALS
161 sg lxd -c "lxd waitready"
beierlm9425dd22020-07-16 16:57:09 -0400162 #juju add-model test lxd-cloud || true
Dominik Fleischmann71997c12020-06-30 14:25:19 +0200163 juju controller-config features=[k8s-operators]
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100164}
165
beierlm838e3fd2020-07-28 09:21:07 -0400166function wait_for_port(){
167 SERVICE=$1
168 INDEX=$2
169 TIME_TO_WAIT=30
170 start_time="$(date -u +%s)"
171 while true
172 do
173 now="$(date -u +%s)"
174 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
175 echo "Failed to expose external ${SERVICE} interface port"
176 exit 1
177 fi
178
179 if [ $(sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq -r '.items[$INDEX].metadata.name'") == ${SERVICE} ] ; then
180 break
181 fi
182 sleep 1
183 done
184}
185
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100186function deploy_charmed_osm(){
187 create_overlay
188 echo "Creating OSM model"
David Garcia42375212020-04-27 19:07:49 +0200189 if [ -v KUBECFG ]; then
190 juju add-model osm $K8S_CLOUD_NAME
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100191 else
beierlm838e3fd2020-07-28 09:21:07 -0400192 sg ${KUBEGRP} -c "juju add-model osm $K8S_CLOUD_NAME"
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100193 fi
194 echo "Deploying OSM with charms"
beierlmb5332cf2020-07-08 11:43:59 -0400195 images_overlay=""
196 [ -v TAG ] && generate_images_overlay && images_overlay="--overlay $IMAGES_OVERLAY_FILE"
David Garcia42375212020-04-27 19:07:49 +0200197 if [ -v BUNDLE ]; then
beierlmb5332cf2020-07-08 11:43:59 -0400198 juju deploy $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100199 else
David Garcia69388c22020-05-07 12:14:19 +0200200 juju deploy osm --overlay ~/.osm/vca-overlay.yaml $images_overlay
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100201 fi
beierlm51b71282020-08-14 09:26:27 -0400202
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100203 echo "Waiting for deployment to finish..."
beierlm51b71282020-08-14 09:26:27 -0400204 check_osm_deployed
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100205 echo "OSM with charms deployed"
beierlm838e3fd2020-07-28 09:21:07 -0400206 if [ ! -v KUBECFG ]; then
207 sg ${KUBEGRP} -c "microk8s.enable ingress"
208 API_SERVER=${DEFAULT_IP}
209 else
210 API_SERVER=$(kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " ")
211 proto="$(echo $API_SERVER | grep :// | sed -e's,^\(.*://\).*,\1,g')"
212 url="$(echo ${API_SERVER/$proto/})"
213 user="$(echo $url | grep @ | cut -d@ -f1)"
214 hostport="$(echo ${url/$user@/} | cut -d/ -f1)"
215 API_SERVER="$(echo $hostport | sed -e 's,:.*,,g')"
216 fi
217
218 juju config nbi-k8s juju-external-hostname=nbi.${API_SERVER}.xip.io
219 juju expose nbi-k8s
220
221 wait_for_port nbi-k8s 0
222 sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[0].metadata.annotations += {\"nginx.ingress.kubernetes.io/backend-protocol\": \"HTTPS\"}' | ${KUBECTL} --validate=false replace -f -"
223 sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[0].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} replace -f -"
224
beierlm51b71282020-08-14 09:26:27 -0400225 juju config ng-ui juju-external-hostname=ui.${API_SERVER}.xip.io
beierlm838e3fd2020-07-28 09:21:07 -0400226 juju expose ng-ui
227
228 wait_for_port ng-ui 1
beierlm51b71282020-08-14 09:26:27 -0400229 sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[2].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} --validate=false replace -f -"
beierlm838e3fd2020-07-28 09:21:07 -0400230
231 juju config ui-k8s juju-external-hostname=osm.${API_SERVER}.xip.io
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100232 juju expose ui-k8s
beierlm838e3fd2020-07-28 09:21:07 -0400233
234 wait_for_port ui-k8s 2
beierlm51b71282020-08-14 09:26:27 -0400235 sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[1].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} --validate=false replace -f -"
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100236}
237
238function check_osm_deployed() {
beierlm51b71282020-08-14 09:26:27 -0400239 TIME_TO_WAIT=600
beierlm838e3fd2020-07-28 09:21:07 -0400240 start_time="$(date -u +%s)"
beierlm51b71282020-08-14 09:26:27 -0400241 total_service_count=14
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100242 while true
243 do
beierlm51b71282020-08-14 09:26:27 -0400244 service_count=$(juju status | grep kubernetes | grep active | wc -l)
245 echo "$service_count / $total_service_count services active"
246 if [ $service_count -eq $total_service_count ]; then
247 break
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100248 fi
beierlm838e3fd2020-07-28 09:21:07 -0400249 now="$(date -u +%s)"
250 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
beierlm51b71282020-08-14 09:26:27 -0400251 echo "Timed out waiting for OSM services to become ready"
beierlm838e3fd2020-07-28 09:21:07 -0400252 exit 1
253 fi
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100254 sleep 10
255 done
256}
257
258function create_overlay() {
David Garcia42375212020-04-27 19:07:49 +0200259 sudo snap install jq
260 sudo apt install python3-pip -y
261 python3 -m pip install yq
262 PATH=$PATH:$HOME/.local/bin # make yq command available
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100263 local HOME=/home/$USER
David Garcia42375212020-04-27 19:07:49 +0200264 local vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME].user')
265 local vca_password=$(cat $HOME/.local/share/juju/accounts.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME].password')
beierlmdfd42882020-07-02 14:21:09 -0400266 local vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME]["api-endpoints"][0]' --raw-output | cut -d ":" -f 1)
267 local vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME]["api-endpoints"][0]' --raw-output | cut -d ":" -f 2)
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100268 local vca_pubkey=\"$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub)\"
269 local vca_cloud="lxd-cloud"
270 # Get the VCA Certificate
beierlmdfd42882020-07-02 14:21:09 -0400271 local vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME]["ca-cert"]' --raw-output | base64 | tr -d \\n)
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100272
273 # Calculate the default route of this machine
Dominik Fleischmannc57296f2020-06-09 11:45:08 +0200274 local DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100275
276 # Generate a new overlay.yaml, overriding any existing one
David Garcia42375212020-04-27 19:07:49 +0200277 cat << EOF > /tmp/vca-overlay.yaml
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100278applications:
279 lcm-k8s:
280 options:
281 vca_user: $vca_user
282 vca_password: $vca_password
283 vca_host: $vca_host
284 vca_port: $vca_port
285 vca_pubkey: $vca_pubkey
286 vca_cacert: $vca_cacert
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100287 vca_cloud: $vca_cloud
Dominik Fleischmann71997c12020-06-30 14:25:19 +0200288 vca_k8s_cloud: $K8S_CLOUD_NAME
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100289 mon-k8s:
290 options:
291 vca_user: $vca_user
292 vca_password: $vca_password
293 vca_host: $vca_host
294 vca_cacert: $vca_cacert
295EOF
David Garcia42375212020-04-27 19:07:49 +0200296 mv /tmp/vca-overlay.yaml ~/.osm/
297 OSM_VCA_HOST=$vca_host
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100298}
299
David Garcia69388c22020-05-07 12:14:19 +0200300function generate_images_overlay(){
301 cat << EOF > /tmp/images-overlay.yaml
302applications:
303 lcm-k8s:
304 options:
305 image: opensourcemano/lcm:$TAG
306 mon-k8s:
307 options:
308 image: opensourcemano/mon:$TAG
309 ro-k8s:
310 options:
311 image: opensourcemano/ro:$TAG
312 nbi-k8s:
313 options:
314 image: opensourcemano/nbi:$TAG
315 pol-k8s:
316 options:
317 image: opensourcemano/pol:$TAG
318 ui-k8s:
319 options:
320 image: opensourcemano/light-ui:$TAG
David Garcia5863d3e2020-07-09 13:14:13 +0200321 pla:
322 options:
323 image: opensourcemano/pla:$TAG
David Garciafa55bd72020-07-07 11:14:19 +0200324 ng-ui:
325 options:
326 image: opensourcemano/ng-ui:$TAG
David Garcia69388c22020-05-07 12:14:19 +0200327
328EOF
329 mv /tmp/images-overlay.yaml $IMAGES_OVERLAY_FILE
330}
331
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100332function install_osmclient() {
333 sudo snap install osmclient
334 sudo snap alias osmclient.osm osm
335}
336
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100337
338function install_microstack() {
339 sudo snap install microstack --classic --beta
340 sudo microstack.init --auto
341 wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img -P ~/.osm/
342 microstack.openstack image create \
David Garcia42375212020-04-27 19:07:49 +0200343 --public \
344 --disk-format qcow2 \
345 --container-format bare \
346 --file ~/.osm/ubuntu-16.04-server-cloudimg-amd64-disk1.img \
347 ubuntu1604
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100348 ssh-keygen -t rsa -N "" -f ~/.ssh/microstack
349 microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack
Dominik Fleischmannc57296f2020-06-09 11:45:08 +0200350 export OSM_HOSTNAME=`juju status --format json | jq -rc '.applications."nbi-k8s".address'`
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100351 osm vim-create --name microstack-site \
David Garcia42375212020-04-27 19:07:49 +0200352 --user admin \
353 --password keystone \
354 --auth_url http://10.20.20.1:5000/v3 \
355 --tenant admin \
356 --account_type openstack \
357 --config='{security_groups: default,
358 keypair: microstack,
359 project_name: admin,
360 user_domain_name: default,
361 region_name: microstack,
362 insecure: True,
363 availability_zone: nova,
364 version: 3}'
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100365}
366
Dominik Fleischmannc57296f2020-06-09 11:45:08 +0200367DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100368DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'`
369
370check_arguments $@
David Garcia42375212020-04-27 19:07:49 +0200371mkdir -p ~/.osm
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100372install_snaps
373bootstrap_k8s_lxd
374deploy_charmed_osm
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100375install_osmclient
David Garcia42375212020-04-27 19:07:49 +0200376if [ -v MICROSTACK ]; then
Dominik Fleischmann5e4a7512020-03-06 14:05:06 +0100377 install_microstack
378fi
beierlm9425dd22020-07-16 16:57:09 -0400379
380echo "Your installation is now complete, follow these steps for configuring the osmclient:"
381echo
beierlm838e3fd2020-07-28 09:21:07 -0400382echo "1. Create the OSM_HOSTNAME environment variable with the NBI IP"
beierlm9425dd22020-07-16 16:57:09 -0400383echo
beierlm838e3fd2020-07-28 09:21:07 -0400384echo "export OSM_HOSTNAME=nbi.$API_SERVER.xip.io:443"
beierlm9425dd22020-07-16 16:57:09 -0400385echo
beierlm838e3fd2020-07-28 09:21:07 -0400386echo "2. Add the previous command to your .bashrc for other Shell sessions"
beierlm9425dd22020-07-16 16:57:09 -0400387echo
beierlm838e3fd2020-07-28 09:21:07 -0400388echo "echo \"export OSM_HOSTNAME=nbi.$API_SERVER.xip.io:443\" >> ~/.bashrc"
beierlm9425dd22020-07-16 16:57:09 -0400389echo
390echo "DONE"