tacker/roles/setup-default-vim/tasks/main.yaml
Naoaki Horie fe46bd2612 Add a k8s cluster for the k8s related FT in zuul
This patch add a kubernetes cluster for the kubernetes related
functional tests of the VNF LCM in the zuul environment.

There is no impact to the existing jobs because this patch only
add a new job, however we may need to watch the load on the Zuul
environment due to its parallel jobs.

A new node-set consists of four nodes;

  * Controller: Keystone, Nova, Neutron, Glance, Cinder, Octavia,
                MySQL, MQ, ETCD
  * Controller-tacker: Tacker, Tacker-conductor
  * Controller-k8s: kuryr-k8s, kuryr-CNI, k8s-api, kubelet
  * Compute: Nova-compute

All kubernetes resources are created on the controller-k8s node.

This patch includes the following changes:

  * Added a execution command for the functional test of related
    k8s for the VNF LCM in tox.ini.
  * Registered a vim of the `kubernetes` type by ansible. Also
    added related materials.
  * Moved the functional test files for k8s to other new directory.
  * Fixed a minor invalid definition in the definition file used
    for functional testing.

Change-Id: I1621b904450e94d6793b4c524de6785520f2e805
2021-02-08 13:11:16 +00:00

146 lines
4.5 KiB
YAML

- block:
- name: Copy tools/test-setup-default-vim.sh
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tools/test-setup-default-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
mode=0755
- name: Copy test vim file
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
- name: Check if project's tools/test-setup-default-vim.sh exists
stat:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
register: p
- fail:
msg: >
{{ zuul_work_dir }}/tools/test-setup-default-vim.sh doesn't exists
or it doesn't have execute permission.
when: p.stat.exists != True or p.stat.executable != True
- name: Get stackenv from devstack environment
slurp:
src: "{{ devstack_base_dir }}/devstack/.stackenv"
register: stackenv
- name: Set a keystone authentication uri
set_fact:
auth_uri: "{{
stackenv.content
| b64decode
| regex_replace('\n', ' ')
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
}}"
when:
- p.stat.exists
- name: Replace auth uri in test-setup-default-vim.sh and local-vim.yaml
replace:
path: "{{ item }}"
regexp: "http://127.0.0.1/identity"
replace: "{{ auth_uri }}"
with_items:
- "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when:
- p.stat.exists
- name: Replace the config file path in the test-setup-default-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
- name: Run tools/test-setup-default-vim.sh
command: tools/test-setup-default-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- p.stat.exists
- p.stat.executable
when:
- inventory_hostname == 'controller-tacker'
- block:
- name: Copy tools/test-setup-k8s-vim.sh
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tools/test-setup-k8s-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh
mode=0755
- name: Copy test k8s vim file
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-k8s-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-k8s-vim.yaml
- name: Check if project's tools/test-setup-k8s-vim.sh exists
stat:
path: "{{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh"
register: p
- fail:
msg: >
{{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh doesn't exists
or it doesn't have execute permission.
when: p.stat.exists != True or p.stat.executable != True
- name: Get stackenv from devstack environment
slurp:
src: "{{ devstack_base_dir }}/devstack/.stackenv"
register: stackenv
- name: Set a keystone authentication uri
set_fact:
auth_uri: "{{
stackenv.content
| b64decode
| regex_replace('\n', ' ')
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
}}"
when:
- p.stat.exists
- name: Replace keystone auth uri in test-setup-k8s-vim.sh
replace:
path: "{{ item }}"
regexp: "http://127.0.0.1/identity"
replace: "{{ auth_uri }}"
with_items:
- "{{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh"
when:
- p.stat.exists
- name: Replace k8s auth uri in local-k8s-vim.yaml
replace:
path: "{{ item }}"
regexp: "https://127.0.0.1:6443"
replace: "{{ kuryr_k8s_api_url }}"
with_items:
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-k8s-vim.yaml"
when:
- p.stat.exists
- name: Replace the config file path in the test-setup-k8s-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-k8s-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-k8s-vim.yaml"
- name: Run tools/test-setup-k8s-vim.sh
command: tools/test-setup-k8s-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- p.stat.exists
- p.stat.executable
when:
- inventory_hostname == 'controller-tacker'
- kuryr_k8s_api_url is defined