Make PLA optional in charmed installer
[osm/devops.git] / installers / charmed_install.sh
1 #! /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 #
15
16 # set -eux
17
18 LXD_VERSION=4.0
19 JUJU_VERSION=2.9
20 JUJU_AGENT_VERSION=2.9.33
21 K8S_CLOUD_NAME="k8s-cloud"
22 KUBECTL="microk8s.kubectl"
23 MICROK8S_VERSION=1.23
24 OSMCLIENT_VERSION=latest
25 IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
26 PASSWORD_OVERLAY_FILE=~/.osm/password-overlay.yaml
27 PATH=/snap/bin:${PATH}
28 OSM_DEVOPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. &> /dev/null && pwd )"
29 INSTALL_PLA=""
30 PLA_OVERLAY_FILE=~/.osm/pla-overlay.yaml
31
32 if [ -f ${OSM_DEVOPS}/common/all_funcs ] ; then
33 source ${OSM_DEVOPS}/common/all_funcs
34 else
35 function track(){
36 true
37 }
38 function FATAL_TRACK(){
39 exit 1
40 }
41 fi
42
43 MODEL_NAME=osm
44
45 OSM_BUNDLE=ch:osm
46 OSM_HA_BUNDLE=ch:osm-ha
47 CHARMHUB_CHANNEL=latest/beta
48 unset TAG
49
50 function check_arguments(){
51 while [ $# -gt 0 ] ; do
52 case $1 in
53 --bundle) BUNDLE="$2" ;;
54 --overlay) OVERLAY="$2" ;;
55 --k8s) KUBECFG="$2" ;;
56 --vca) CONTROLLER="$2" ;;
57 --small-profile) INSTALL_NOLXD=y;;
58 --lxd) LXD_CLOUD="$2" ;;
59 --lxd-cred) LXD_CREDENTIALS="$2" ;;
60 --microstack) MICROSTACK=y ;;
61 --ha) BUNDLE=$OSM_HA_BUNDLE ;;
62 --tag) TAG="$2" ;;
63 --registry) REGISTRY_INFO="$2" ;;
64 --only-vca) ONLY_VCA=y ;;
65 --pla) INSTALL_PLA=y ;;
66 esac
67 shift
68 done
69
70 # echo $BUNDLE $KUBECONFIG $LXDENDPOINT
71 }
72
73 function install_snaps(){
74 if [ ! -v KUBECFG ]; then
75 KUBEGRP="microk8s"
76 sudo snap install microk8s --classic --channel=${MICROK8S_VERSION}/stable ||
77 FATAL_TRACK k8scluster "snap install microk8s ${MICROK8S_VERSION}/stable failed"
78 sudo usermod -a -G microk8s `whoami`
79 sudo cat /var/snap/microk8s/current/args/kube-apiserver | grep advertise-address || (
80 echo "--advertise-address $DEFAULT_IP" | sudo tee -a /var/snap/microk8s/current/args/kube-apiserver
81 sg ${KUBEGRP} -c microk8s.stop
82 sg ${KUBEGRP} -c microk8s.start
83 )
84 mkdir -p ~/.kube
85 sudo chown -f -R `whoami` ~/.kube
86 sg ${KUBEGRP} -c "microk8s status --wait-ready"
87 KUBECONFIG=~/.osm/microk8s-config.yaml
88 sg ${KUBEGRP} -c "microk8s config" | tee ${KUBECONFIG}
89 track k8scluster k8scluster_ok
90 else
91 KUBECTL="kubectl"
92 sudo snap install kubectl --classic
93 export KUBECONFIG=${KUBECFG}
94 KUBEGRP=$(id -g -n)
95 fi
96 sudo snap install juju --classic --channel=$JUJU_VERSION/stable ||
97 FATAL_TRACK juju "snap install juju ${JUJU_VERSION}/stable failed"
98 track juju juju_ok
99 }
100
101 function bootstrap_k8s_lxd(){
102 [ -v CONTROLLER ] && ADD_K8S_OPTS="--controller ${CONTROLLER}" && CONTROLLER_NAME=$CONTROLLER
103 [ ! -v CONTROLLER ] && ADD_K8S_OPTS="--client" && BOOTSTRAP_NEEDED="yes" && CONTROLLER_NAME="osm-vca"
104
105 if [ -v BOOTSTRAP_NEEDED ]; then
106 CONTROLLER_PRESENT=$(juju controllers 2>/dev/null| grep ${CONTROLLER_NAME} | wc -l)
107 if [ $CONTROLLER_PRESENT -ge 1 ]; then
108 cat << EOF
109 Threre is already a VCA present with the installer reserved name of "${CONTROLLER_NAME}".
110 You may either explicitly use this VCA with the "--vca ${CONTROLLER_NAME}" option, or remove it
111 using this command:
112
113 juju destroy-controller --release-storage --destroy-all-models -y ${CONTROLLER_NAME}
114
115 Please retry the installation once this conflict has been resolved.
116 EOF
117 FATAL_TRACK bootstrap_k8s "VCA already present"
118 fi
119 else
120 CONTROLLER_PRESENT=$(juju controllers 2>/dev/null| grep ${CONTROLLER_NAME} | wc -l)
121 if [ $CONTROLLER_PRESENT -le 0 ]; then
122 cat << EOF
123 Threre is no VCA present with the name "${CONTROLLER_NAME}". Please specify a VCA
124 that exists, or remove the --vca ${CONTROLLER_NAME} option.
125
126 Please retry the installation with one of the solutions applied.
127 EOF
128 FATAL_TRACK bootstrap_k8s "Requested VCA not present"
129 fi
130 fi
131
132 if [ -v KUBECFG ]; then
133 cat $KUBECFG | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
134 [ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME \
135 --config controller-service-type=loadbalancer \
136 --agent-version=$JUJU_AGENT_VERSION
137 else
138 sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
139 sg ${KUBEGRP} -c "microk8s.enable ingress"
140 sg ${KUBEGRP} -c "microk8s.enable storage dns"
141 TIME_TO_WAIT=30
142 start_time="$(date -u +%s)"
143 while true
144 do
145 now="$(date -u +%s)"
146 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
147 echo "Microk8s storage failed to enable"
148 sg ${KUBEGRP} -c "microk8s.status"
149 FATAL_TRACK bootstrap_k8s "Microk8s storage failed to enable"
150 fi
151 storage_status=`sg ${KUBEGRP} -c "microk8s.status -a storage"`
152 if [[ $storage_status == "enabled" ]]; then
153 break
154 fi
155 sleep 1
156 done
157
158 [ ! -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "microk8s.config" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
159 [ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c \
160 "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer --agent-version=$JUJU_AGENT_VERSION" \
161 && K8S_CLOUD_NAME=microk8s
162 fi
163 track bootstrap_k8s bootstrap_k8s_ok
164
165 if [ ! -v INSTALL_NOLXD ]; then
166 if [ -v LXD_CLOUD ]; then
167 if [ ! -v LXD_CREDENTIALS ]; then
168 echo "The installer needs the LXD server certificate if the LXD is external"
169 FATAL_TRACK bootstrap_lxd "No LXD certificate supplied"
170 fi
171 else
172 LXDENDPOINT=$DEFAULT_IP
173 LXD_CLOUD=~/.osm/lxd-cloud.yaml
174 LXD_CREDENTIALS=~/.osm/lxd-credentials.yaml
175 # Apply sysctl production values for optimal performance
176 sudo cp /usr/share/osm-devops/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
177 sudo sysctl --system
178 # Install LXD snap
179 sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client
180 sudo snap install lxd --channel $LXD_VERSION/stable
181 # Configure LXD
182 sudo usermod -a -G lxd `whoami`
183 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"
184 sg lxd -c "lxd waitready"
185 DEFAULT_MTU=$(ip addr show $DEFAULT_IF | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
186 sg lxd -c "lxc profile device set default eth0 mtu $DEFAULT_MTU"
187 sg lxd -c "lxc network set lxdbr0 bridge.mtu $DEFAULT_MTU"
188
189 cat << EOF > $LXD_CLOUD
190 clouds:
191 lxd-cloud:
192 type: lxd
193 auth-types: [certificate]
194 endpoint: "https://$LXDENDPOINT:8443"
195 config:
196 ssl-hostname-verification: false
197 EOF
198 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"
199 cat << EOF > $LXD_CREDENTIALS
200 credentials:
201 lxd-cloud:
202 lxd-cloud:
203 auth-type: certificate
204 server-cert: /var/snap/lxd/common/lxd/server.crt
205 client-cert: ~/.osm/client.crt
206 client-key: ~/.osm/client.key
207 EOF
208 lxc config trust add local: ~/.osm/client.crt
209 fi
210
211 juju add-cloud -c $CONTROLLER_NAME lxd-cloud $LXD_CLOUD --force
212 juju add-credential -c $CONTROLLER_NAME lxd-cloud -f $LXD_CREDENTIALS
213 sg lxd -c "lxd waitready"
214 juju controller-config features=[k8s-operators]
215 track bootstrap_lxd bootstrap_lxd_ok
216 fi
217 }
218
219 function deploy_charmed_osm(){
220 if [ -v REGISTRY_INFO ] ; then
221 registry_parts=(${REGISTRY_INFO//@/ })
222 if [ ${#registry_parts[@]} -eq 1 ] ; then
223 # No credentials supplied
224 REGISTRY_USERNAME=""
225 REGISTRY_PASSWORD=""
226 REGISTRY_URL=${registry_parts[0]}
227 else
228 credentials=${registry_parts[0]}
229 credential_parts=(${credentials//:/ })
230 REGISTRY_USERNAME=${credential_parts[0]}
231 REGISTRY_PASSWORD=${credential_parts[1]}
232 REGISTRY_URL=${registry_parts[1]}
233 fi
234 # Ensure the URL ends with a /
235 case $REGISTRY_URL in
236 */) ;;
237 *) REGISTRY_URL=${REGISTRY_URL}/
238 esac
239 fi
240
241 echo "Creating OSM model"
242 if [ -v KUBECFG ]; then
243 juju add-model $MODEL_NAME $K8S_CLOUD_NAME
244 else
245 sg ${KUBEGRP} -c "juju add-model $MODEL_NAME $K8S_CLOUD_NAME"
246 fi
247 echo "Deploying OSM with charms"
248 images_overlay=""
249 if [ -v REGISTRY_URL ]; then
250 [ ! -v TAG ] && TAG='latest'
251 fi
252 [ -v TAG ] && generate_images_overlay && images_overlay="--overlay $IMAGES_OVERLAY_FILE"
253
254 if [ -v OVERLAY ]; then
255 extra_overlay="--overlay $OVERLAY"
256 fi
257 echo "Creating Password Overlay"
258
259 generate_password_overlay && secret_overlay="--overlay $PASSWORD_OVERLAY_FILE"
260
261 [ -n "$INSTALL_PLA" ] && create_pla_overlay && pla_overlay="--overlay $PLA_OVERLAY_FILE"
262
263 if [ -v BUNDLE ]; then
264 juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $BUNDLE $images_overlay $extra_overlay $secret_overlay $pla_overlay
265 else
266 juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $OSM_BUNDLE $images_overlay $extra_overlay $secret_overlay $pla_overlay
267 fi
268
269 if [ ! -v KUBECFG ]; then
270 API_SERVER=${DEFAULT_IP}
271 else
272 API_SERVER=$(kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " ")
273 proto="$(echo $API_SERVER | grep :// | sed -e's,^\(.*://\).*,\1,g')"
274 url="$(echo ${API_SERVER/$proto/})"
275 user="$(echo $url | grep @ | cut -d@ -f1)"
276 hostport="$(echo ${url/$user@/} | cut -d/ -f1)"
277 API_SERVER="$(echo $hostport | sed -e 's,:.*,,g')"
278 fi
279 # Configure VCA Integrator
280 juju config vca \
281 k8s-cloud=microk8s \
282 lxd-cloud=lxd-cloud:lxd-cloud \
283 controllers="`cat ~/.local/share/juju/controllers.yaml`" \
284 accounts="`cat ~/.local/share/juju/accounts.yaml`" \
285 public-key="`cat ~/.local/share/juju/ssh/juju_id_rsa.pub`"
286 # Expose OSM services
287 juju config -m $MODEL_NAME nbi external-hostname=nbi.${API_SERVER}.nip.io
288 juju config -m $MODEL_NAME ng-ui external-hostname=ui.${API_SERVER}.nip.io
289 juju config -m $MODEL_NAME grafana site_url=https://grafana.${API_SERVER}.nip.io
290 juju config -m $MODEL_NAME prometheus site_url=https://prometheus.${API_SERVER}.nip.io
291
292 echo "Waiting for deployment to finish..."
293 check_osm_deployed
294 grafana_leader=`juju status -m $MODEL_NAME grafana | grep "*" | cut -d "*" -f 1`
295 grafana_admin_password=`juju run -m $MODEL_NAME --unit $grafana_leader "echo \\$GF_SECURITY_ADMIN_PASSWORD"`
296 juju config -m $MODEL_NAME mon grafana-password=$grafana_admin_password
297 check_osm_deployed
298 echo "OSM with charms deployed"
299 }
300
301 function check_osm_deployed() {
302 TIME_TO_WAIT=600
303 start_time="$(date -u +%s)"
304 total_service_count=15
305 [ -n "$INSTALL_PLA" ] && total_service_count=$((total_service_count + 1))
306 previous_count=0
307 while true
308 do
309 service_count=$(juju status --format json -m $MODEL_NAME | jq '.applications[]."application-status".current' | grep active | wc -l)
310 echo "$service_count / $total_service_count services active"
311 if [ $service_count -eq $total_service_count ]; then
312 break
313 fi
314 if [ $service_count -ne $previous_count ]; then
315 previous_count=$service_count
316 start_time="$(date -u +%s)"
317 fi
318 now="$(date -u +%s)"
319 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
320 echo "Timed out waiting for OSM services to become ready"
321 FATAL_TRACK deploy_osm "Timed out waiting for services to become ready"
322 fi
323 sleep 10
324 done
325 }
326
327 function generate_password_overlay() {
328 # prometheus
329 web_config_password=`openssl rand -hex 16`
330 # keystone
331 keystone_db_password=`openssl rand -hex 16`
332 keystone_admin_password=`openssl rand -hex 16`
333 keystone_service_password=`openssl rand -hex 16`
334 # mariadb
335 mariadb_password=`openssl rand -hex 16`
336 mariadb_root_password=`openssl rand -hex 16`
337 cat << EOF > /tmp/password-overlay.yaml
338 applications:
339 prometheus:
340 options:
341 web_config_password: $web_config_password
342 keystone:
343 options:
344 keystone-db-password: $keystone_db_password
345 admin-password: $keystone_admin_password
346 service-password: $keystone_service_password
347 mariadb:
348 options:
349 password: $mariadb_password
350 root_password: $mariadb_root_password
351 EOF
352 mv /tmp/password-overlay.yaml $PASSWORD_OVERLAY_FILE
353 }
354
355 function create_pla_overlay(){
356 echo "Creating PLA Overlay"
357 [ $BUNDLE == $OSM_HA_BUNDLE ] && scale=3 || scale=1
358 cat << EOF > /tmp/pla-overlay.yaml
359 applications:
360 pla:
361 charm: osm-pla
362 channel: latest/stable
363 scale: $scale
364 series: kubernetes
365 options:
366 log_level: DEBUG
367 resources:
368 image: opensourcemano/pla:testing-daily
369 relations:
370 - - pla:kafka
371 - kafka:kafka
372 - - pla:mongodb
373 - mongodb:database
374 EOF
375 mv /tmp/pla-overlay.yaml $PLA_OVERLAY_FILE
376 }
377
378 function generate_images_overlay(){
379 echo "applications:" > /tmp/images-overlay.yaml
380
381 charms_with_resources="nbi lcm mon pol ng-ui ro"
382 [ -n "$INSTALL_PLA" ] && charms_with_resources+=" pla"
383 for charm in $charms_with_resources; do
384 cat << EOF > /tmp/${charm}_registry.yaml
385 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
386 EOF
387 if [ ! -z "$REGISTRY_USERNAME" ] ; then
388 echo username: $REGISTRY_USERNAME >> /tmp/${charm}_registry.yaml
389 echo password: $REGISTRY_PASSWORD >> /tmp/${charm}_registry.yaml
390 fi
391
392 cat << EOF >> /tmp/images-overlay.yaml
393 ${charm}:
394 resources:
395 image: /tmp/${charm}_registry.yaml
396
397 EOF
398 done
399 ch_charms_with_resources="keystone"
400 for charm in $ch_charms_with_resources; do
401 cat << EOF > /tmp/${charm}_registry.yaml
402 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
403 EOF
404 if [ ! -z "$REGISTRY_USERNAME" ] ; then
405 echo username: $REGISTRY_USERNAME >> /tmp/${charm}_registry.yaml
406 echo password: $REGISTRY_PASSWORD >> /tmp/${charm}_registry.yaml
407 fi
408
409 cat << EOF >> /tmp/images-overlay.yaml
410 ${charm}:
411 resources:
412 ${charm}-image: /tmp/${charm}_registry.yaml
413
414 EOF
415 done
416
417 mv /tmp/images-overlay.yaml $IMAGES_OVERLAY_FILE
418 }
419
420 function refresh_osmclient_snap() {
421 osmclient_snap_install_refresh refresh
422 }
423
424 function install_osm_client_snap() {
425 osmclient_snap_install_refresh install
426 }
427
428 function osmclient_snap_install_refresh() {
429 channel_preference="stable candidate beta edge"
430 for channel in $channel_preference; do
431 echo "Trying to install osmclient from channel $OSMCLIENT_VERSION/$channel"
432 sudo snap $1 osmclient --channel $OSMCLIENT_VERSION/$channel 2> /dev/null && echo osmclient snap installed && break
433 done
434 }
435 function install_osmclient() {
436 snap info osmclient | grep -E ^installed: && refresh_osmclient_snap || install_osm_client_snap
437 }
438
439 function add_local_k8scluster() {
440 osm --all-projects vim-create \
441 --name _system-osm-vim \
442 --account_type dummy \
443 --auth_url http://dummy \
444 --user osm --password osm --tenant osm \
445 --description "dummy" \
446 --config '{management_network_name: mgmt}'
447 tmpfile=$(mktemp --tmpdir=${HOME})
448 cp ${KUBECONFIG} ${tmpfile}
449 osm --all-projects k8scluster-add \
450 --creds ${tmpfile} \
451 --vim _system-osm-vim \
452 --k8s-nets '{"net1": null}' \
453 --version '1.19' \
454 --description "OSM Internal Cluster" \
455 _system-osm-k8s
456 rm -f ${tmpfile}
457 }
458
459 function install_microstack() {
460 sudo snap install microstack --beta --devmode
461
462 CHECK=$(microstack.openstack server list)
463 if [ $? -ne 0 ] ; then
464 if [[ $CHECK == *"not initialized"* ]]; then
465 echo "Setting MicroStack dashboard to listen to port 8080"
466 sudo snap set microstack config.network.ports.dashboard=8080
467 echo "Initializing MicroStack. This can take several minutes"
468 sudo microstack.init --auto --control
469 fi
470 fi
471
472 sudo snap alias microstack.openstack openstack
473
474 echo "Updating default security group in MicroStack to allow all access"
475
476 for i in $(microstack.openstack security group list | awk '/default/{ print $2 }'); do
477 for PROTO in icmp tcp udp ; do
478 echo " $PROTO ingress"
479 CHECK=$(microstack.openstack security group rule create $i --protocol $PROTO --remote-ip 0.0.0.0/0 2>&1)
480 if [ $? -ne 0 ] ; then
481 if [[ $CHECK != *"409"* ]]; then
482 echo "Error creating ingress rule for $PROTO"
483 echo $CHECK
484 fi
485 fi
486 done
487 done
488
489 microstack.openstack network show osm-ext &>/dev/null
490 if [ $? -ne 0 ]; then
491 echo "Creating osm-ext network with router to bridge to MicroStack external network"
492 microstack.openstack network create --enable --no-share osm-ext
493 microstack.openstack subnet create osm-ext-subnet --network osm-ext --dns-nameserver 8.8.8.8 \
494 --subnet-range 172.30.0.0/24
495 microstack.openstack router create external-router
496 microstack.openstack router add subnet external-router osm-ext-subnet
497 microstack.openstack router set --external-gateway external external-router
498 fi
499
500 microstack.openstack image list | grep ubuntu20.04 &> /dev/null
501 if [ $? -ne 0 ] ; then
502 echo "Fetching Ubuntu 20.04 image and upLoading to MicroStack"
503 wget -q -O- https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img \
504 | microstack.openstack image create --public --container-format=bare \
505 --disk-format=qcow2 ubuntu20.04 | grep status
506 fi
507
508 if [ ! -f ~/.ssh/microstack ]; then
509 ssh-keygen -t rsa -N "" -f ~/.ssh/microstack
510 microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack
511 fi
512
513 echo "Creating VIM microstack-site in OSM"
514 . /var/snap/microstack/common/etc/microstack.rc
515
516 osm vim-create \
517 --name microstack-site \
518 --user "$OS_USERNAME" \
519 --password "$OS_PASSWORD" \
520 --auth_url "$OS_AUTH_URL" \
521 --tenant "$OS_USERNAME" \
522 --account_type openstack \
523 --config='{use_floating_ip: True,
524 insecure: True,
525 keypair: microstack,
526 management_network_name: osm-ext}'
527 }
528
529 DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5; exit}'`
530 DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]; exit}'`
531
532 check_arguments $@
533 mkdir -p ~/.osm
534 install_snaps
535 bootstrap_k8s_lxd
536 if [ -v ONLY_VCA ]; then
537 HOME=/home/$USER
538 k8scloud=microk8s
539 lxdcloud=lxd-cloud:lxd-cloud
540 controllers="`cat $HOME/.local/share/juju/controllers.yaml`"
541 accounts="`cat $HOME/.local/share/juju/accounts.yaml`"
542 publickey="`cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub`"
543 echo "Use the following command to register the installed VCA to your OSM VCA integrator charm"
544 echo -e " juju config vca \\\n k8s-cloud=$k8scloud \\\n lxd-cloud=$lxdcloud \\\n controllers=$controllers \\\n accounts=$accounts \\\n public-key=$publickey"
545 track deploy_osm deploy_vca_only_ok
546 else
547 deploy_charmed_osm
548 track deploy_osm deploy_osm_services_k8s_ok
549 install_osmclient
550 track osmclient osmclient_ok
551 export OSM_HOSTNAME=$(juju config -m $MODEL_NAME nbi external-hostname):443
552 export OSM_PASSWORD=$keystone_admin_password
553 sleep 10
554 add_local_k8scluster
555 track final_ops add_local_k8scluster_ok
556 if [ -v MICROSTACK ]; then
557 install_microstack
558 track final_ops install_microstack_ok
559 fi
560
561 echo "Your installation is now complete, follow these steps for configuring the osmclient:"
562 echo
563 echo "1. Create the OSM_HOSTNAME environment variable with the NBI IP"
564 echo
565 echo "export OSM_HOSTNAME=$OSM_HOSTNAME"
566 echo "export OSM_PASSWORD=$OSM_PASSWORD"
567 echo
568 echo "2. Add the previous commands to your .bashrc for other Shell sessions"
569 echo
570 echo "echo \"export OSM_HOSTNAME=$OSM_HOSTNAME\" >> ~/.bashrc"
571 echo "echo \"export OSM_PASSWORD=$OSM_PASSWORD\" >> ~/.bashrc"
572 echo
573 echo "3. Login OSM GUI by using admin password: $OSM_PASSWORD"
574 echo
575 echo "DONE"
576 track end
577 fi
578