Adding scripts for running RC2 testcases
[kuberef.git] / functions.sh
index 4e06523..8d206bf 100755 (executable)
@@ -235,6 +235,21 @@ ${ansible_cmd}
 EOF
 }
 
+# Copy kubeconfig to the appropriate location needed by functest containers
+copy_k8s_config() {
+# TODO Use Kubespray variables in BMRA to simplify this
+    MASTER_IP=$(get_host_pxe_ip "nodes[0]")
+    # shellcheck disable=SC2087
+    ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << EOF
+scp -q root@$MASTER_IP:/root/.kube/config ${PROJECT_ROOT}/kubeconfig
+EOF
+
+# Copy kubeconfig from Jump VM to appropriate location in Jump Host
+# Direct scp to the specified location doesn't work due to permission/ssh-keys
+    scp "$USERNAME"@"$(get_vm_ip)":"${PROJECT_ROOT}"/kubeconfig kubeconfig
+    sudo cp kubeconfig /home/opnfv/functest-kubernetes/config
+}
+
 # Executes a specific Ansible playbook
 run_playbook() {
     ansible_cmd="$(command -v ansible-playbook)"