Add role to install and run sonobouy k8s validation tests
Change-Id: Ic5af3ec8f8553f54f95e945a91068873f02d1d1a
This commit is contained in:
parent
025f68aea8
commit
51a254943f
22
mcapi_vexxhost/playbooks/sonobuoy.yml
Normal file
22
mcapi_vexxhost/playbooks/sonobuoy.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
# Copyright 2024, BBC R&D.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install and run sonobuoy
|
||||
hosts: utility_all[0]
|
||||
gather_facts: false
|
||||
roles:
|
||||
- openstack.osa.source_install_vars
|
||||
- osa_ops.mcapi_vexxhost.sonobuoy
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
31
mcapi_vexxhost/roles/sonobuoy/defaults/main.yml
Normal file
31
mcapi_vexxhost/roles/sonobuoy/defaults/main.yml
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2024 BBC R&D.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
sonobuoy_version: 0.57.1
|
||||
sonobuoy_download_file: "sonobuoy_{{ sonobuoy_version }}_linux_amd64.tar.gz"
|
||||
sonobuoy_download_url: "https://github.com/vmware-tanzu/sonobuoy/releases/download/v{{ sonobuoy_version }}/{{ sonobuoy_download_file }}"
|
||||
sonobuoy_unarchive_dest: /usr/local/bin
|
||||
|
||||
# set the name or uuid of the openstack coe cluster to test
|
||||
sonobuoy_coe_cluster: ""
|
||||
|
||||
# the location of the kubeconfig file
|
||||
sonobuoy_kubeconfig_file: "{{ '/root/' ~ 'kubeconfig-' ~ sonobuoy_coe_cluster ~ '/config' }}"
|
||||
|
||||
# set the options for the test
|
||||
sonobuoy_run_options: "--mode quick --wait"
|
||||
|
||||
# execute tests after downloading sonobuoy
|
||||
sonobuoy_run: true
|
||||
sonobuoy_delete: true
|
33
mcapi_vexxhost/roles/sonobuoy/meta/main.yml
Normal file
33
mcapi_vexxhost/roles/sonobuoy/meta/main.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright (c) 2024 BBC R&D.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
galaxy_info:
|
||||
author: BBC R&D
|
||||
description: Ansible role for "sonobuoy"
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 5.5.0
|
||||
standalone: false
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- jammy
|
||||
|
||||
dependencies:
|
||||
- role: vexxhost.containers.download_artifact
|
||||
download_artifact_url: "{{ sonobuoy_download_url }}"
|
||||
download_artifact_dest: "{{ download_artifact_work_directory ~ '/' ~ sonobuoy_download_file }}"
|
||||
download_artifact_owner: root
|
||||
download_artifact_mode: "0755"
|
||||
download_artifact_unarchive: true
|
||||
download_artifact_unarchive_dest: "{{ sonobuoy_unarchive_dest }}"
|
46
mcapi_vexxhost/roles/sonobuoy/tasks/main.yml
Normal file
46
mcapi_vexxhost/roles/sonobuoy/tasks/main.yml
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2024 BBC R&D.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# 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:
|
||||
KUBECONFIG: "{{ sonobuoy_kubeconfig_file }}"
|
||||
block:
|
||||
- name: Execute tests
|
||||
ansible.builtin.shell:
|
||||
cmd: "{{ sonobuoy_unarchive_dest ~ '/sonobuoy run ' ~ sonobuoy_run_options }}"
|
||||
|
||||
- name: Get sonobuoy results
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ sonobuoy_unarchive_dest ~ '/sonobuoy retrieve' }}"
|
||||
register: _retrieve
|
||||
|
||||
- name: Cleanup
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ sonobuoy_unarchive_dest ~ '/sonobuoy delete --wait' }}"
|
||||
when: sonobuoy_delete
|
Loading…
Reference in New Issue
Block a user