X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=ebf2e03a6e8ba2b7735575ff67ebe9f5820babd0;hb=d15e054d353f83a343cbe089e053b4636a0e641f;hp=be2aed4389fb1c06ae0b2a8c4ff71316eb72dd86;hpb=9aee09f002e7cd17f0e0e147a9aacc6d2f4f74c1;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index be2aed43..ebf2e03a 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -402,20 +402,20 @@ function install_docker_ce() { echo "... restarted Docker service" if [ -n "${DOCKER_PROXY_URL}" ]; then echo "Configuring docker proxy ..." - if [ -f daemon.json ]; then - if grep -q registry-mirrors daemon.json; then - sudo sed -Ei 's/("registry-mirrors".*\[)(.*)\]/\1\2, \"'"${DOCKER_PROXY_URL}"'\"\]/' daemon.json + if [ -f /etc/docker/daemon.json ]; then + if grep -q registry-mirrors /etc/docker/daemon.json; then + sudo sed -i "s|registry-mirrors.*|registry-mirrors\": [\"${DOCKER_PROXY_URL}\"] |" /etc/docker/daemon.json else - sudo sed -i 's/{/{\n "registry-mirrors": [\"'"${DOCKER_PROXY_URL}"'\"]",/' daemon.json + sudo sed -i "s|{|{\n \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"],|" /etc/docker/daemon.json fi else - sudo cat << EOF > daemon.json + sudo bash -c "cat << EOF > /etc/docker/daemon.json { - "registry-mirrors": ["${DOCKER_PROXY_URL}"] + \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"] } -EOF +EOF" fi - sudo systemctl daemon-reload + sudo systemctl daemon-reload sudo service docker restart echo "... restarted Docker service again" fi @@ -513,8 +513,14 @@ function juju_createproxy() { fi } +function docker_login() { + echo "Docker login" + sg docker -c "docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASSWORD}" +} + function generate_docker_images() { echo "Pulling and generating docker images" + [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login echo "Pulling docker images" @@ -948,7 +954,7 @@ function install_helm() { kubectl --namespace kube-system create serviceaccount tiller kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller # HELM initialization - helm init --service-account tiller + helm init --stable-repo-url https://charts.helm.sh/stable --service-account tiller # Wait for Tiller to be up and running. If timeout expires, continue installing tiller_timeout=120; @@ -973,17 +979,21 @@ function parse_yaml() { if [ "$module" == "pla" ]; then if [ -n "$INSTALL_PLA" ]; then echo "Updating K8s manifest file from opensourcemano\/${module}:.* to ${DOCKER_REGISTRY_URL}${DOCKER_USER}\/${module}:${TAG}" - $WORKDIR_SUDO sed -i "s/opensourcemano\/pla:.*/${DOCKER_REGISTRY_URL}${DOCKER_USER}\/\/pla:${OSM_DOCKER_TAG}/g" ${OSM_DOCKER_WORK_DIR}/osm_pla/pla.yaml + $WORKDIR_SUDO sed -i "s#opensourcemano/pla:.*#${DOCKER_REGISTRY_URL}${DOCKER_USER}/pla:${TAG}#g" ${OSM_DOCKER_WORK_DIR}/osm_pla/pla.yaml fi else echo "Updating K8s manifest file from opensourcemano\/${module}:.* to ${DOCKER_REGISTRY_URL}${DOCKER_USER}\/${module}:${TAG}" - $WORKDIR_SUDO sed -i "s/opensourcemano\/${module}:.*/${DOCKER_REGISTRY_URL}${DOCKER_USER}\/${module}:${TAG}/g" ${OSM_K8S_WORK_DIR}/${module}.yaml + $WORKDIR_SUDO sed -i "s#opensourcemano/${module}:.*#${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${TAG}#g" ${OSM_K8S_WORK_DIR}/${module}.yaml fi done } function update_manifest_files() { - osm_services="nbi lcm ro pol mon light-ui ng-ui keystone pla" + if [ -n "$NGUI" ]; then + osm_services="nbi lcm ro pol mon ng-ui keystone pla" + else + osm_services="nbi lcm ro pol mon light-ui keystone pla" + fi list_of_services="" for module in $osm_services; do module_upper="${module^^}" @@ -995,7 +1005,7 @@ function update_manifest_files() { fi done list_of_services_to_rebuild=$(echo ${TO_REBUILD,,} |sed "s/lw-ui/light-ui/g") - if [ ! "$OSM_DOCKER_TAG" == "8" ]; then + if [ ! "$OSM_DOCKER_TAG" == "9" ]; then parse_yaml $OSM_DOCKER_TAG $list_of_services fi if [ -n "$MODULE_DOCKER_TAG" ]; then @@ -1532,7 +1542,13 @@ function track(){ wget -q -O /dev/null $url } -JUJU_AGENT_VERSION=2.8.6 +function parse_docker_registry_url() { + DOCKER_REGISTRY_USER=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[1]}') + DOCKER_REGISTRY_PASSWORD=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[2]}') + DOCKER_REGISTRY_URL=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); print a[2]}') +} + +JUJU_AGENT_VERSION=2.8.8 UNINSTALL="" DEVELOP="" UPDATE="" @@ -1775,6 +1791,7 @@ while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:d:p:T:-: hy" o; do esac done +[ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options" [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" == " PLA" ] && [ -z "$INSTALL_PLA" ] && FATAL "Incompatible option: -m PLA cannot be used without --pla option"