Move helm setup before ceph. Fix argument errors in demo_deploy. 39/45839/1
authorBryan Sullivan <bryan.sullivan@att.com>
Thu, 19 Oct 2017 15:30:25 +0000 (08:30 -0700)
committerBryan Sullivan <bryan.sullivan@att.com>
Thu, 19 Oct 2017 15:30:25 +0000 (08:30 -0700)
JIRA: MODELS-23

Change-Id: I1e51a603f13a672b7fc345daf93c28fd57126a90
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
tools/kubernetes/ceph-helm.sh
tools/kubernetes/demo_deploy.sh
tools/kubernetes/k8s-cluster.sh

index 038c438..6c92fb0 100644 (file)
@@ -48,27 +48,21 @@ function setup_ceph() {
 
   kubedns=$(kubectl get service -o json --namespace kube-system kube-dns | \
     jq -r '.spec.clusterIP')
-  case "$dev" in
-    sda)
-    sdb)
-      for node in $nodes; do
-        echo "${FUNCNAME[0]}: setup resolv.conf for $node"
-        echo <<EOF | sudo tee -a /etc/resolv/.conf
+
+  for node in $nodes; do
+    echo "${FUNCNAME[0]}: setup resolv.conf for $node"
+    echo <<EOF | sudo tee -a /etc/resolv.conf
 nameserver $kubedns
 search ceph.svc.cluster.local svc.cluster.local cluster.local 
 EOF
-        echo "${FUNCNAME[0]}: Zap disk $dev at $node"
-        ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
-          ubuntu@$node ceph-disk zap $dev
-        echo "${FUNCNAME[0]}: Run ceph-osd at $node"
-        name=$(ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
-          ubuntu@$node hostname)
-        ./helm-install-ceph-osd.sh $name /dev/$dev
-      done
-      ;;
-      *)
-      ;;
-  esac
+    echo "${FUNCNAME[0]}: Zap disk $dev at $node"
+    ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
+      ubuntu@$node ceph-disk zap $dev
+    echo "${FUNCNAME[0]}: Run ceph-osd at $node"
+    name=$(ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
+      ubuntu@$node hostname)
+    ./helm-install-ceph-osd.sh $name /dev/$dev
+  done
 
   echo "${FUNCNAME[0]}: Activate Ceph for namespace 'default'"
   ./activate-namespace.sh default
index 04dfacb..8d5cbd2 100644 (file)
@@ -30,7 +30,7 @@
 #. Usage: on the MAAS server
 #. $ git clone https://gerrit.opnfv.org/gerrit/models ~/models
 #. $ bash ~/models/tools/kubernetes/demo_deploy.sh <key> "<hosts>" <master>
-#.     "<workers>" <pub-net> <priv-net> <ceph-mode> [<extras>]
+#.     "<workers>" <pub-net> <priv-net> <ceph-mode> <ceph-dev> [<extras>]
 #. <key>: name of private key for cluster node ssh (in current folder)
 #. <hosts>: space separated list of hostnames managed by MAAS
 #. <master>: IP of cluster master node
@@ -38,6 +38,7 @@
 #. <pub-net>: CID formatted public network
 #. <priv-net>: CIDR formatted private network (may be same as pub-net)
 #. <ceph-mode>: "helm" or "baremetal"
+#. <ceph-dev>: disk (e.g. sda, sdb) or folder (e.g. "/ceph")
 #. <extras>: optional name of script for extra setup functions as needed
 
 key=$1
@@ -47,9 +48,10 @@ workers="$4"
 priv_net=$5
 pub_net=$6
 ceph_mode=$7
-extras=$8
+ceph_dev=$8
+extras=$9
 
-source ~/models/tools/maas/deploy.sh $1 "$2" $8
+source ~/models/tools/maas/deploy.sh $1 "$2" $9
 eval `ssh-agent`
 ssh-add $key
 if [[ "x$extras" != "x" ]]; then source $extras; fi
@@ -60,7 +62,7 @@ scp -r -o StrictHostKeyChecking=no ~/models/tools/kubernetes/* \
 ssh -x -o StrictHostKeyChecking=no ubuntu@$master <<EOF
 exec ssh-agent bash
 ssh-add $key
-bash k8s-cluster.sh all "$workers" $priv_net $pub_net $ceph_mode
+bash k8s-cluster.sh all "$workers" $priv_net $pub_net $ceph_mode $ceph_dev
 EOF
 # TODO: Figure this out... Have to break the setup into two steps as something
 # causes the ssh session to end before the prometheus setup, if both scripts
index fc40b65..0047527 100644 (file)
@@ -70,7 +70,7 @@ sudo apt-get update
 sudo apt-get -y install ceph-common
 sudo apt-get -y install --allow-downgrades kubectl=${KUBE_VERSION}-00 kubelet=${KUBE_VERSION}-00 kubeadm=${KUBE_VERSION}-00
 # Needed for ceph setup etc
-sudo apt-get -y jq
+sudo apt-get -y install jq
 EOG
 }
 
@@ -276,8 +276,8 @@ case "$1" in
   all)
     setup_k8s_master
     setup_k8s_agents "$2"
-    setup_ceph "$2" $3 $4 $5 $6
     setup_helm
+    setup_ceph "$2" $3 $4 $5 $6
     demo_chart dokuwiki
     ;;
   clean)