aboutsummaryrefslogtreecommitdiffstats
path: root/kud
diff options
context:
space:
mode:
Diffstat (limited to 'kud')
-rw-r--r--kud/README.md10
-rw-r--r--kud/deployment_infra/playbooks/configure-multus.yml38
-rwxr-xr-xkud/tests/_functions.sh34
3 files changed, 52 insertions, 30 deletions
diff --git a/kud/README.md b/kud/README.md
index 99805c3c..caa731dc 100644
--- a/kud/README.md
+++ b/kud/README.md
@@ -30,8 +30,8 @@ Apache-2.0
[1]: https://git.onap.org/multicloud/k8s
[2]: https://github.com/kubernetes-incubator/kubespray
-[3]: playbooks/configure-ovn4nfv.yml
-[4]: playbooks/configure-virtlet.yml
-[5]: playbooks/configure-multus.yml
-[6]: playbooks/configure-nfd.yml
-[7]: playbooks/configure-istio.yml
+[3]: deployment_infra/playbooks/configure-ovn4nfv.yml
+[4]: deployment_infra/playbooks/configure-virtlet.yml
+[5]: deployment_infra/playbooks/configure-multus.yml
+[6]: deployment_infra/playbooks/configure-nfd.yml
+[7]: deployment_infra/playbooks/configure-istio.yml
diff --git a/kud/deployment_infra/playbooks/configure-multus.yml b/kud/deployment_infra/playbooks/configure-multus.yml
index 9cca54d1..47109162 100644
--- a/kud/deployment_infra/playbooks/configure-multus.yml
+++ b/kud/deployment_infra/playbooks/configure-multus.yml
@@ -62,27 +62,25 @@
mode: 0755
when: multus_source_type == "tarball"
- name: create multus configuration file
- blockinfile:
- marker: ""
- path: /etc/cni/net.d/00-multus.conf
- create: yes
- block: |
- {
- "type": "multus",
- "name": "multus-cni",
- "cniVersion": "0.3.1",
- "kubeconfig": "/etc/kubernetes/admin.conf",
- "delegates": [
- {
- "type": "flannel",
+ copy:
+ dest: /etc/cni/net.d/00-multus.conf
+ content: |
+ {
+ "type": "multus",
+ "name": "multus-cni",
"cniVersion": "0.3.1",
- "masterplugin": true,
- "delegate": {
- "isDefaultGateway": true
- }
- }
- ]
- }
+ "kubeconfig": "/etc/kubernetes/admin.conf",
+ "delegates": [
+ {
+ "type": "flannel",
+ "cniVersion": "0.3.1",
+ "masterplugin": true,
+ "delegate": {
+ "isDefaultGateway": true
+ }
+ }
+ ]
+ }
- hosts: localhost
pre_tasks:
diff --git a/kud/tests/_functions.sh b/kud/tests/_functions.sh
index 483aed5c..86636ccd 100755
--- a/kud/tests/_functions.sh
+++ b/kud/tests/_functions.sh
@@ -25,12 +25,36 @@ function print_msg {
}
function get_ovn_central_address {
- ansible_ifconfig=$(ansible ovn-central[0] -i ${FUNCTIONS_DIR}/../hosting_providers/vagrant/inventory/hosts.ini -m shell -a "ifconfig ${OVN_CENTRAL_INTERFACE} |grep \"inet addr\" |awk '{print \$2}' |awk -F: '{print \$2}'")
- if [[ $ansible_ifconfig != *CHANGED* ]]; then
- echo "Fail to get the OVN central IP address from ${OVN_CENTRAL_INTERFACE} nic"
- exit
+ #Reuse OVN_CENTRAL_ADDRESS if available (bypassable by --force flag)
+ if [[ "${1:-}" != "--force" ]] && [[ -n "${OVN_CENTRAL_ADDRESS:-}" ]]; then
+ echo "${OVN_CENTRAL_ADDRESS}"
+ return 0
+ fi
+
+ local remote_command="ip address show dev $OVN_CENTRAL_INTERFACE primary"
+ declare -a ansible_command=(ansible ovn-central[0] -i \
+ "${FUNCTIONS_DIR}/../hosting_providers/vagrant/inventory/hosts.ini")
+ declare -a filter=(awk -F '[ \t/]+' \
+ 'BEGIN {r=1} {for (i=1; i<=NF; i++) if ($i == "inet") {print $(i+1); r=0}} END {exit r}')
+ local result
+
+ #Determine OVN_CENTRAL_INTERFACE address
+ if ! result="$("${ansible_command[@]}" -a "${remote_command}")"; then
+ echo "Ansible error for remote host ovn-central[0]" >&2
+ return 1
+ else
+ if [[ "${result}" != *CHANGED* ]]; then
+ echo "Failed to execute command on remote host ovn-central[0]" >&2
+ return 2
+ else
+ if ! result="$("${filter[@]}" <<< "${result}")"; then
+ echo "Failed to retrieve interface address from command output" >&2
+ return 3
+ else
+ echo "${result}:6641"
+ fi
+ fi
fi
- echo "$(echo ${ansible_ifconfig#*>>} | tr '\n' ':')6641"
}
function call_api {