diff options
-rw-r--r-- | ci/README.md | 7 | ||||
-rwxr-xr-x | xci/installer/kubespray/deploy.sh | 5 | ||||
-rw-r--r-- | xci/installer/kubespray/playbooks/configure-kubenet.yml | 50 | ||||
-rw-r--r-- | xci/installer/kubespray/playbooks/configure-opnfvhost.yml | 5 | ||||
-rw-r--r-- | xci/installer/osa/playbooks/configure-opnfvhost.yml | 3 | ||||
-rw-r--r-- | xci/playbooks/bootstrap-scenarios.yml | 4 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 | 10 | ||||
-rw-r--r-- | xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/files/k8s-cluster.yml (renamed from xci/installer/kubespray/files/k8s-cluster.yml) | 2 | ||||
-rw-r--r-- | xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/tasks/main.yml | 14 |
9 files changed, 90 insertions, 10 deletions
diff --git a/ci/README.md b/ci/README.md new file mode 100644 index 00000000..c0873dad --- /dev/null +++ b/ci/README.md @@ -0,0 +1,7 @@ +The scripts located in this folder are used by OPNFV XCI/Jenkins +and they are not supposed to be used by users and developers. + +The scripts are executed by Jenkins jobs directly in execute-shell +or by simple wrappers so the most of the XCI specific logic is +developed and maintained for XCI CI gets verified like the rest of +XCI scripts. diff --git a/xci/installer/kubespray/deploy.sh b/xci/installer/kubespray/deploy.sh index 59d11055..1a0b34bc 100755 --- a/xci/installer/kubespray/deploy.sh +++ b/xci/installer/kubespray/deploy.sh @@ -79,6 +79,11 @@ ssh root@$OPNFV_HOST_IP "set -o pipefail; cd releng-xci/.cache/repos/kubespray;\ -i opnfv_inventory/inventory.cfg cluster.yml -b | tee setup-kubernetes.log" scp root@$OPNFV_HOST_IP:~/releng-xci/.cache/repos/kubespray/setup-kubernetes.log \ $LOG_PATH/setup-kubernetes.log + +cd $K8_XCI_PLAYBOOKS +ansible-playbook ${XCI_ANSIBLE_PARAMS} -e XCI_PATH="${XCI_PATH}" \ + -i ${XCI_FLAVOR_ANSIBLE_FILE_PATH}/inventory/inventory.cfg \ + configure-kubenet.yml echo echo "-----------------------------------------------------------------------" echo "Info: Kubernetes installation is successfully completed!" diff --git a/xci/installer/kubespray/playbooks/configure-kubenet.yml b/xci/installer/kubespray/playbooks/configure-kubenet.yml new file mode 100644 index 00000000..1c3740b2 --- /dev/null +++ b/xci/installer/kubespray/playbooks/configure-kubenet.yml @@ -0,0 +1,50 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE LINUX GmbH and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# NOTE(hwoarang) Kubenet expects networking to be prepared by the administrator so it's necessary +# to do that as part of the node configuration. All we need is to add static routes on every node +# so cbr0 interfaces can talk to each other. +- name: Prepare networking for kubenet + hosts: k8s-cluster + gather_facts: True + become: yes + vars_files: + - "{{ xci_path }}/xci/var/opnfv.yml" + tasks: + - name: Configure static routes + block: + - name: Collect cbr0 information from the nodes + set_fact: + kubenet_xci_static_routes: |- + {% set static_routes = [] %} + {% for host in groups['k8s-cluster']|select("ne", inventory_hostname) %} + {%- set _ = static_routes.append( + {'network': (hostvars[host]['ansible_cbr0']['ipv4']['network']+'/'+ + hostvars[host]['ansible_cbr0']['ipv4']['netmask'])|ipaddr('net'), + 'gateway': hostvars[host]['ansible_default_ipv4']['address']}) -%} + {% endfor %} + {{ static_routes }} + + - name: Add static routes on each node + shell: "ip route show | grep -q {{ item.network }} || ip route add {{ item.network }} via {{ item.gateway }}" + with_items: "{{ kubenet_xci_static_routes }}" + loop_control: + label: "{{ item.network }}" + when: deploy_scenario == 'k8-nosdn-nofeature' + + - name: Ensure rp_filter is disabled on localhost + sysctl: + name: net.ipv4.conf.all.rp_filter + sysctl_set: yes + state: present + value: "{{ deploy_scenario == 'k8-nosdn-nofeature' | ternary(0, 1) }}" + reload: yes + delegate_to: localhost + run_once: True diff --git a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml index 9f74892c..ac8988da 100644 --- a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml +++ b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml @@ -43,11 +43,6 @@ file: path: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/group_vars" state: directory - - name: copy k8s_cluster.yml - command: "cp -rf {{ remote_xci_path }}/xci/installer/kubespray/files/k8s-cluster.yml \ - {{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/group_vars" - args: - creates: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/group_vars/k8s-cluster.yml" - include: "{{ xci_path }}/xci/playbooks/bootstrap-scenarios.yml" - name: Install required packages package: diff --git a/xci/installer/osa/playbooks/configure-opnfvhost.yml b/xci/installer/osa/playbooks/configure-opnfvhost.yml index f12f831c..82b14d1c 100644 --- a/xci/installer/osa/playbooks/configure-opnfvhost.yml +++ b/xci/installer/osa/playbooks/configure-opnfvhost.yml @@ -115,9 +115,6 @@ args: creates: "/usr/local/bin/openstack-ansible" - changed_when: True - args: - chdir: "{{openstack_osa_path}}" - name: install opnfv pip required packages pip: name: "{{ item }}" diff --git a/xci/playbooks/bootstrap-scenarios.yml b/xci/playbooks/bootstrap-scenarios.yml index c09d58a6..d1331252 100644 --- a/xci/playbooks/bootstrap-scenarios.yml +++ b/xci/playbooks/bootstrap-scenarios.yml @@ -37,3 +37,7 @@ include_role: name: "k8-flannel-nofeature" when: deploy_scenario == 'k8-flannel-nofeature' +- name: Prepare everything to run the k8-nosdn-nofeature scenario + include_role: + name: "k8-nosdn-nofeature" + when: deploy_scenario == 'k8-nosdn-nofeature' diff --git a/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 b/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 index 0f97c3b4..7856cb0e 100644 --- a/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 +++ b/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 @@ -43,7 +43,15 @@ openstack --insecure subnet create --network {{ external_network }} \ --subnet-range {{ subnet_cidr }} --gateway {{ gateway_ip }} \ --no-dhcp {{ subnet_name }} -mkdir ~/images && cd ~/images && wget -q http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img && cd ~ +# the needed images differ between the suites so avoid downloading unnecessary images +if [[ "$FUNCTEST_SUITE_NAME" =~ "healthcheck" ]]; then + mkdir ~/images && cd ~/images && wget -q http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img && cd ~ +elif [[ "$FUNCTEST_SUITE_NAME" =~ "smoke" ]]; then + mkdir -p images && wget -q -O- https://git.opnfv.org/functest/plain/functest/ci/download_images.sh | bash -s -- images && ls -1 images/* +else + echo "Unsupported test suite for functest" + exit 1 +fi # docker image to use will be different for healthcheck and smoke test DOCKER_IMAGE_NAME="opnfv/functest-${FUNCTEST_SUITE_NAME}" diff --git a/xci/installer/kubespray/files/k8s-cluster.yml b/xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/files/k8s-cluster.yml index 20d3091d..614d784e 100644 --- a/xci/installer/kubespray/files/k8s-cluster.yml +++ b/xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/files/k8s-cluster.yml @@ -174,7 +174,7 @@ kube_basic_auth: true # Choose network plugin (calico, contiv, weave or flannel) # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing -kube_network_plugin: calico +kube_network_plugin: cloud # weave's network password for encryption # if null then no network encryption diff --git a/xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/tasks/main.yml b/xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/tasks/main.yml new file mode 100644 index 00000000..5b2939f1 --- /dev/null +++ b/xci/scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature/tasks/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- + +- name: copy k8s-cluster.yml + copy: + src: "k8s-cluster.yml" + dest: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/group_vars/k8s-cluster.yml" |