Migrate to new NBI charm, and change in NGUI charm
- Fixes bug 1365
- Changes in the installer:
- use site_url config to expose both NBI and NG-UI
- use resources for images
- Changes in the NBI: some minor fixes
- Changes in the NG-UI: follow the same pattern as in the new set of
charms
Change-Id: I6a11009ddf9cd22689602b2a53ecf67f376830cb
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh
index 095c04f..16d6d73 100755
--- a/installers/charmed_install.sh
+++ b/installers/charmed_install.sh
@@ -22,6 +22,8 @@
IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
PATH=/snap/bin:${PATH}
+MODEL_NAME=osm
+
function check_arguments(){
while [ $# -gt 0 ] ; do
case $1 in
@@ -224,9 +226,9 @@
create_overlay
echo "Creating OSM model"
if [ -v KUBECFG ]; then
- juju add-model osm $K8S_CLOUD_NAME
+ juju add-model $MODEL_NAME $K8S_CLOUD_NAME
else
- sg ${KUBEGRP} -c "juju add-model osm $K8S_CLOUD_NAME"
+ sg ${KUBEGRP} -c "juju add-model $MODEL_NAME $K8S_CLOUD_NAME"
fi
echo "Deploying OSM with charms"
images_overlay=""
@@ -236,9 +238,9 @@
[ -v TAG ] && generate_images_overlay && images_overlay="--overlay $IMAGES_OVERLAY_FILE"
if [ -v BUNDLE ]; then
- juju deploy $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay
+ juju deploy -m $MODEL_NAME $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay
else
- juju deploy cs:osm-52 --overlay ~/.osm/vca-overlay.yaml $images_overlay
+ juju deploy -m $MODEL_NAME cs:osm-53 --overlay ~/.osm/vca-overlay.yaml $images_overlay
fi
echo "Waiting for deployment to finish..."
@@ -256,29 +258,21 @@
fi
# Expose OSM services
+ # Expose NBI
+ juju config -m $MODEL_NAME nbi site_url=https://nbi.${API_SERVER}.xip.io
+ juju config -m $MODEL_NAME ng-ui site_url=https://ui.${API_SERVER}.xip.io
+
# Expose Grafana
- juju config grafana-k8s juju-external-hostname=grafana.${API_SERVER}.xip.io
- juju expose grafana-k8s
+ juju config -m $MODEL_NAME grafana-k8s juju-external-hostname=grafana.${API_SERVER}.xip.io
+ juju expose -m $MODEL_NAME grafana-k8s
wait_for_port grafana-k8s 0
- # Expose NBI
- juju config nbi-k8s juju-external-hostname=nbi.${API_SERVER}.xip.io
- juju expose nbi-k8s
- wait_for_port nbi-k8s 1
-
- # Expose NG UI
- juju config ng-ui juju-external-hostname=ui.${API_SERVER}.xip.io
- juju expose ng-ui
- wait_for_port ng-ui 2
-
# Expose Prometheus
- juju config prometheus-k8s juju-external-hostname=prometheus.${API_SERVER}.xip.io
- juju expose prometheus-k8s
- wait_for_port prometheus-k8s 3
+ juju config -m $MODEL_NAME prometheus-k8s juju-external-hostname=prometheus.${API_SERVER}.xip.io
+ juju expose -m $MODEL_NAME prometheus-k8s
+ wait_for_port prometheus-k8s 1
# Apply annotations
- sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/backend-protocol=HTTPS -n osm -l juju-app=nbi-k8s"
- sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/proxy-body-size=0 -n osm -l juju-app=nbi-k8s"
sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/proxy-body-size=0 -n osm -l juju-app=ng-ui"
}
@@ -289,7 +283,7 @@
previous_count=0
while true
do
- service_count=$(juju status | grep kubernetes | grep active | wc -l)
+ service_count=$(juju status -m $MODEL_NAME | grep kubernetes | grep active | wc -l)
echo "$service_count / $total_service_count services active"
if [ $service_count -eq $total_service_count ]; then
break
@@ -350,6 +344,12 @@
}
function generate_images_overlay(){
+ cat << EOF > /tmp/nbi_registry.yaml
+registrypath: ${REGISTRY_URL}opensourcemano/nbi:$TAG
+EOF
+ cat << EOF > /tmp/ng_ui_registry.yaml
+registrypath: ${REGISTRY_URL}opensourcemano/ng-ui:$TAG
+EOF
if [ ! -z "$REGISTRY_USERNAME" ] ; then
REGISTRY_CREDENTIALS=$(cat <<EOF
@@ -357,6 +357,10 @@
image_password: $REGISTRY_PASSWORD
EOF
);
+ echo username: $REGISTRY_USERNAME >> /tmp/nbi_registry.yaml
+ echo password: $REGISTRY_PASSWORD >> /tmp/nbi_registry.yaml
+ echo username: $REGISTRY_USERNAME >> /tmp/ng_ui_registry.yaml
+ echo password: $REGISTRY_PASSWORD >> /tmp/ng_ui_registry.yaml
fi
cat << EOF > /tmp/images-overlay.yaml
@@ -370,9 +374,9 @@
ro-k8s:
options:
image: ${REGISTRY_URL}opensourcemano/ro:$TAG ${REGISTRY_CREDENTIALS}
- nbi-k8s:
- options:
- image: ${REGISTRY_URL}opensourcemano/nbi:$TAG ${REGISTRY_CREDENTIALS}
+ nbi:
+ resources:
+ image: /tmp/nbi_registry.yaml
pol-k8s:
options:
image: ${REGISTRY_URL}opensourcemano/pol:$TAG ${REGISTRY_CREDENTIALS}
@@ -380,8 +384,8 @@
options:
image: ${REGISTRY_URL}opensourcemano/pla:$TAG ${REGISTRY_CREDENTIALS}
ng-ui:
- options:
- image: ${REGISTRY_URL}opensourcemano/ng-ui:$TAG ${REGISTRY_CREDENTIALS}
+ resources:
+ image: /tmp/ng_ui_registry.yaml
keystone:
options:
image: ${REGISTRY_URL}opensourcemano/keystone:$TAG ${REGISTRY_CREDENTIALS}
@@ -407,7 +411,7 @@
ubuntu1604
ssh-keygen -t rsa -N "" -f ~/.ssh/microstack
microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack
- export OSM_HOSTNAME=`juju status --format json | jq -rc '.applications."nbi-k8s".address'`
+ export OSM_HOSTNAME=`juju status --format json | jq -rc '.applications."nbi".address'`
osm vim-create --name microstack-site \
--user admin \
--password keystone \
@@ -437,7 +441,7 @@
install_microstack
fi
-OSM_HOSTNAME=$(juju config nbi-k8s juju-external-hostname):443
+OSM_HOSTNAME=$(juju config nbi site_url | sed "s/http.*\?:\/\///"):443
echo "Your installation is now complete, follow these steps for configuring the osmclient:"
echo