Pass kubeconfig path directly to sonobuoy role

This makes it possible to use the sonobuoy role to test the control
plane cluster as well as workload clusters.

Change-Id: Ia82ebe150774fbd694e74531c3392518887698fd
This commit is contained in:
Jonathan Rosser 2024-07-02 11:48:28 +01:00
parent c27aee8829
commit 14bbd0a81e
3 changed files with 18 additions and 16 deletions

View File

@ -31,6 +31,8 @@
functional_test_master_count: 1
functional_test_node_count: 1
functional_test_kubeconfig_file: "{{ '/root/' ~ 'kubeconfig-' ~ functional_test_cluster_name ~ '/config' }}"
functional_test_resources_network:
networks:
- name: 'public'
@ -135,11 +137,25 @@
environment:
OS_CLOUD: default
- name: Create dir to hold kubeconfig
ansible.builtin.file:
state: directory
path: "{{ functional_test_kubeconfig_file | dirname }}"
- name: Retrieve kubeconfig
vars:
ansible_python_interpreter: "{{ openstack_service_setup_host_python_interpreter }}"
ansible.builtin.command:
cmd: openstack coe cluster config --dir "{{ functional_test_kubeconfig_file | dirname }}" "{{ functional_test_cluster_name }}"
creates: "{{ functional_test_kubeconfig_file }}"
environment:
OS_CLOUD: default
- name: Run sonobuoy test
include_role:
name: osa_ops.mcapi_vexxhost.sonobuoy
vars:
sonobuoy_coe_cluster: "{{ functional_test_cluster_name }}"
sonobuoy_kubeconfig_file: "{{ functional_test_kubeconfig_file }}"
# Delete cluster
- name: Delete coe cluster

View File

@ -18,7 +18,7 @@ sonobuoy_download_url: "https://github.com/vmware-tanzu/sonobuoy/releases/downlo
sonobuoy_unarchive_dest: /usr/local/bin
# set the name or uuid of the openstack coe cluster to test
sonobuoy_coe_cluster: ""
sonobuoy_coe_cluster: "test"
# the location of the kubeconfig file
sonobuoy_kubeconfig_file: "{{ '/root/' ~ 'kubeconfig-' ~ sonobuoy_coe_cluster ~ '/config' }}"

View File

@ -12,20 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
- name: Create dir to hold kubeconfig
ansible.builtin.file:
state: directory
path: "{{ sonobuoy_kubeconfig_file | dirname }}"
- name: Retrieve kubeconfig
vars:
ansible_python_interpreter: "{{ openstack_service_setup_host_python_interpreter }}"
ansible.builtin.command:
cmd: openstack coe cluster config --dir "{{ sonobuoy_kubeconfig_file | dirname }}" "{{ sonobuoy_coe_cluster }}"
creates: "{{ sonobuoy_kubeconfig_file }}"
environment:
OS_CLOUD: default
- name: Run sonobuoy tests
when: sonobuoy_run
environment: