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 -Ei 's/("registry-mirrors".*\[)(.*)\]/\1\2, \"'"${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 cat << EOF > /etc/docker/daemon.json
{
"registry-mirrors": ["${DOCKER_PROXY_URL}"]
}
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"
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;
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^^}"
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
wget -q -O /dev/null $url
}
+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.6
UNINSTALL=""
DEVELOP=""
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"