Skip to content

Commit

Permalink
dev: Add lm-update.sh script
Browse files Browse the repository at this point in the history
Signed-off-by: Sheng Yang <sheng.yang@rancher.com>
  • Loading branch information
yasker committed Oct 10, 2019
1 parent 071a465 commit 8385749
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions dev/scripts/lm-update.sh
@@ -0,0 +1,43 @@
#!/bin/bash

#set -x
set -e

username=$1

if [ "$username" == "" ]
then
echo DockerHub username is required
exit 1
fi

update=$2

project="longhorn-manager"
base="${GOPATH}/src/github.com/longhorn/longhorn-manager"
yaml=${base}"/deploy/install/02-components/01-manager.yaml"
driver_yaml=${base}"/deploy/install/02-components/04-driver.yaml"

latest=`cat ${base}/bin/latest_image`
private=`sed "s/longhornio/${username}/g" ${base}/bin/latest_image`

echo Latest image ${latest}
echo Latest private image ${private}
docker tag ${latest} ${private}
docker push ${private}

escaped_private=${private//\//\\\/}
sed -i "s/image\:\ .*\/${project}:.*/image\:\ ${escaped_private}/g" $yaml
sed -i "s/-\ .*\/${project}:.*/-\ ${escaped_private}/g" $yaml
sed -i "s/image\:\ .*\/${project}:.*/image\:\ ${escaped_private}/g" $driver_yaml
sed -i "s/-\ .*\/${project}:.*/-\ ${escaped_private}/g" $driver_yaml

set +e

if [ "$update" == "" ]
then
kubectl delete -f $yaml
kubectl create -f $yaml
kubectl delete -f $driver_yaml
kubectl create -f $driver_yaml
fi

0 comments on commit 8385749

Please sign in to comment.