setup-cni: Fix typo, allow absolute exec 12/412/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Fri, 22 Feb 2019 14:23:10 +0000 (15:23 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Fri, 22 Feb 2019 14:23:10 +0000 (15:23 +0100)
The `setup-cni.sh` script should be able to run with a different
current working directory, so use absolute paths where appropiate.

Change-Id: Ic19cbe0c8d1098f8c4a0f547ceeeed442182d28d
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
scripts/setup-cni.sh

index c824033..8b9730c 100755 (executable)
@@ -9,17 +9,19 @@ if [ "$(uname -m)" == 'aarch64' ]; then
   ETCD_YAML=etcd-arm64.yaml
 else
   ETCD_YAML=etcd-amd64.yaml
   ETCD_YAML=etcd-arm64.yaml
 else
   ETCD_YAML=etcd-amd64.yaml
-if
+fi
 
 
-sed -i "s/10.96.232.136/${CLUSTER_IP}/" "cni/calico/${ETCD_YAML}"
-kubectl apply -f "cni/calico/${ETCD_YAML}"
+SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
+
+sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
+kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}"
 
 # Install the RBAC Roles required for Calico
 
 # Install the RBAC Roles required for Calico
-kubectl apply -f "cni/calico/rbac.yaml"
+kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml"
 
 # Install Calico to system
 
 # Install Calico to system
-sed -i "s/10.96.232.136/${CLUSTER_IP}/" cni/calico/calico.yaml
-kubectl apply -f cni/calico/calico.yaml
+sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/calico.yaml"
+kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml"
 
 # Remove the taints on master node
 kubectl taint nodes --all node-role.kubernetes.io/master- || true
 
 # Remove the taints on master node
 kubectl taint nodes --all node-role.kubernetes.io/master- || true