From 603a4611ad7d4b5131fba419f2ea1c5fb45d210e Mon Sep 17 00:00:00 2001 From: jgilaber Date: Wed, 29 May 2024 15:42:15 +0200 Subject: [PATCH] [WIP] Prepare crc job for architecture repo --- ci/playbooks/run-architecture-crc.yml | 131 +++++++++++++++++++++++ scenarios/reproducers/va-hci-base.yml | 17 +++ scenarios/reproducers/va-hci-reduced.yml | 8 ++ scenarios/reproducers/va-hci.yml | 18 +--- zuul.d/architecture-jobs.yaml | 98 ++++++++++++++++- zuul.d/projects.yaml | 1 + 6 files changed, 255 insertions(+), 18 deletions(-) create mode 100644 ci/playbooks/run-architecture-crc.yml create mode 100644 scenarios/reproducers/va-hci-base.yml create mode 100644 scenarios/reproducers/va-hci-reduced.yml diff --git a/ci/playbooks/run-architecture-crc.yml b/ci/playbooks/run-architecture-crc.yml new file mode 100644 index 0000000000..739de06a6d --- /dev/null +++ b/ci/playbooks/run-architecture-crc.yml @@ -0,0 +1,131 @@ +--- +# Usage and expected parameters +# $ ansible-playbook run-architecture.yml \ +# -e cifmw_architecture_repo=$HOME/architecture \ +# -e cifmw_architecture_scenario=hci \ +# -e cifmw_networking_mapper_networking_env_def_path=$HOME/net-env.yml +# [any other parameter/files your VA/DT might need] +# +# cifmw_architecture_repo: location of the architecture repository. +# cifmw_architecture_scenario: the scenario you want to test. +# cifmw_networking_mapper_networking_env_def_path: path to the +# networking-mapper environment definition file. +# +# Special parameters set in the playbook (you can override them) +# cifmw_basedir: defaults to ~/ci-framework-data +# cifmw_zuul_target_host: target host. Defaults to localhost + +- name: Test architecture automations + hosts: "{{ cifmw_zuul_target_host | default('controller') }}" + gather_facts: true + vars: + _homedir: "{{ ansible_user_dir | default(lookup('env', 'HOME')) }}" + cifmw_basedir: >- + {{ + (_homedir, + 'ci-framework-data') | + path_join + }} + cifmw_path: >- + {{ + ['~/bin', + ansible_env.PATH] | join(':') + }} + pre_tasks: + - name: Assert we have the bare minimum to run + ansible.builtin.assert: + quiet: true + that: + - cifmw_architecture_repo is defined + - cifmw_architecture_scenario is defined + - cifmw_networking_mapper_networking_env_def_path is defined + + - name: Create needed directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: "0755" + loop: + - "{{ cifmw_basedir }}/logs" + - "{{ cifmw_basedir }}/artifacts" + + tasks: + - name: Load the networking-info file + register: _networking_info + ansible.builtin.slurp: + src: /etc/ci/env/networking-info.yml + + - name: Set networks var + vars: + _read_networking_vars: >- + {{ + _networking_info['content'] | b64decode | from_yaml + }} + ansible.builtin.set_fact: + crc_ci_bootstrap_networks_out: "{{ _read_networking_vars['crc_ci_bootstrap_networks_out'] }}" + + - name: Construct interfaces dict + vars: + networks: >- + {{ + item.value | dict2items | map(attribute='key') + }} + macs: >- + {{ + item.value | dict2items | map(attribute='value.mac') + }} + ansible.builtin.set_fact: + interfaces: >- + {{ + interfaces | default({}) | combine( + { item.key: + networks | zip(macs) + } + ) + }} + loop: "{{ crc_ci_bootstrap_networks_out | dict2items }}" + + - name: Generate interfaces-info dictionary + ansible.builtin.copy: + dest: "{{ cifmw_basedir }}/artifacts/interfaces-info-generated.yml" + content: | + {% for node, net_list in interfaces.items() %} + {{ node }}: + {% for interface in net_list %} + - network: {{ interface[0] }} + mac: {{ interface[1] }} + {% endfor%} + {% endfor%} + + - name: Read the networking-definition file + register: _network_definition + ansible.builtin.slurp: + src: /home/zuul/src/github.com/openstack-k8s-operators/ci-framework/scenarios/reproducers/networking-definition.yml + + - name: Set networking-defintion variable + vars: + _read_networkin_def: >- + {{ + _network_definition['content'] | b64decode | from_yaml + }} + ansible.builtin.set_fact: + cifmw_networking_definition: "{{ _read_networkin_def['cifmw_networking_definition'] }}" + + - name: Call networking_mapper + ansible.builtin.include_role: + name: networking_mapper + + - name: Deploy VA with crc + vars: + ci_framework_src_dir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + ansible.builtin.command: > + ansible-playbook -i {{ cifmw_basedir }}/artifacts/zuul_inventory.yml + deploy-edpm.yml + -e cifmw_target_host=localhost + {%- if cifmw_extras is defined %} + {%- for extra_vars in cifmw_extras %} + -e "{{ extra_vars }}" + {%- endfor %} + {%- endif %} + args: + chdir: "{{ ci_framework_src_dir }}" diff --git a/scenarios/reproducers/va-hci-base.yml b/scenarios/reproducers/va-hci-base.yml new file mode 100644 index 0000000000..bb23b50972 --- /dev/null +++ b/scenarios/reproducers/va-hci-base.yml @@ -0,0 +1,17 @@ +--- +cifmw_architecture_scenario: hci + +# Automation section. Most of those parameters will be passed to the +# controller-0 as-is and be consumed by the `deploy-va.sh` script. +# Please note, all paths are on the controller-0, meaning managed by the +# Framework. Please do not edit them! +_arch_repo: "/home/zuul/src/github.com/openstack-k8s-operators/architecture" +cifmw_ceph_client_vars: /tmp/ceph_client.yml +cifmw_ceph_client_values_post_ceph_path_src: >- + {{ _arch_repo }}/examples/va/hci/values.yaml +cifmw_ceph_client_values_post_ceph_path_dst: >- + {{ cifmw_ceph_client_values_post_ceph_path_src }} +cifmw_ceph_client_service_values_post_ceph_path_src: >- + {{ _arch_repo }}/examples/va/hci/service-values.yaml +cifmw_ceph_client_service_values_post_ceph_path_dst: >- + {{ cifmw_ceph_client_service_values_post_ceph_path_src }} diff --git a/scenarios/reproducers/va-hci-reduced.yml b/scenarios/reproducers/va-hci-reduced.yml new file mode 100644 index 0000000000..e11975554d --- /dev/null +++ b/scenarios/reproducers/va-hci-reduced.yml @@ -0,0 +1,8 @@ +--- +cifmw_parent_scenario: "scenarios/reproducers/va-hci-base.yml" + +# Test Ceph file and object storage (block is enabled by default) +cifmw_ceph_daemons_layout: + rgw_enabled: true + dashboard_enabled: false + cephfs_enabled: true diff --git a/scenarios/reproducers/va-hci.yml b/scenarios/reproducers/va-hci.yml index 9b79741e2d..c0ade2591a 100644 --- a/scenarios/reproducers/va-hci.yml +++ b/scenarios/reproducers/va-hci.yml @@ -1,21 +1,5 @@ --- -cifmw_architecture_scenario: hci - -# Automation section. Most of those parameters will be passed to the -# controller-0 as-is and be consumed by the `deploy-va.sh` script. -# Please note, all paths are on the controller-0, meaning managed by the -# Framework. Please do not edit them! -_arch_repo: "/home/zuul/src/github.com/openstack-k8s-operators/architecture" -cifmw_ceph_client_vars: /tmp/ceph_client.yml -cifmw_ceph_client_values_post_ceph_path_src: >- - {{ _arch_repo }}/examples/va/hci/values.yaml -cifmw_ceph_client_values_post_ceph_path_dst: >- - {{ cifmw_ceph_client_values_post_ceph_path_src }} -cifmw_ceph_client_service_values_post_ceph_path_src: >- - {{ _arch_repo }}/examples/va/hci/service-values.yaml -cifmw_ceph_client_service_values_post_ceph_path_dst: >- - {{ cifmw_ceph_client_service_values_post_ceph_path_src }} - +cifmw_parent_scenario: "scenarios/reproducers/va-hci-base.yml" # HERE if you want to overload kustomization, you can uncomment this parameter # and push the data structure you want to apply. # cifmw_architecture_user_kustomize: diff --git a/zuul.d/architecture-jobs.yaml b/zuul.d/architecture-jobs.yaml index 9614620b89..9d2e44480e 100644 --- a/zuul.d/architecture-jobs.yaml +++ b/zuul.d/architecture-jobs.yaml @@ -8,7 +8,7 @@ - job: name: cifmw-architecture-validate-base parent: cifmw-base-minimal - vars: + vars: &architecture_vars cifmw_networking_mapper_networking_env_def_path: >- {{ [ansible_user_dir, @@ -36,3 +36,99 @@ - zuul.d/architecture-jobs.yaml - ^roles/ci_gen_kustomize_values/(?!meta|README).* - ^roles/kustomize_deploy/(?!meta|README).* + +- job: + name: cifmw-architecture-crc-base + parent: cifmw-podified-multinode-edpm-base-crc + nodeset: centos-9-medium-3x-centos-9-crc-extracted-2-30-0-xxl + vars: *architecture_vars + extra-vars: + crc_ci_bootstrap_networking: + networks: + default: + mtu: "{{ ('ibm' in nodepool.cloud) | ternary('1440', '1500') }}" + router_net: "{{ ('ibm' in nodepool.cloud) | ternary('hostonly', 'public') }}" + range: 192.168.122.0/24 + internal-api: + vlan: 20 + range: 172.17.0.0/24 + storage: + vlan: 21 + range: 172.18.0.0/24 + tenant: + vlan: 22 + range: 172.19.0.0/24 + instances: + controller: + networks: + default: + ip: 192.168.122.11 + crc: + networks: + default: + ip: 192.168.122.10 + internal-api: + ip: 172.17.0.5 + storage: + ip: 172.18.0.5 + tenant: + ip: 172.19.0.5 + compute-0: + networks: + default: + ip: 192.168.122.100 + internal-api: + ip: 172.17.0.100 + config_nm: false + storage: + ip: 172.18.0.100 + config_nm: false + tenant: + ip: 172.19.0.100 + config_nm: false + compute-1: + networks: + default: + ip: 192.168.122.101 + internal-api: + ip: 172.17.0.101 + config_nm: false + storage: + ip: 172.18.0.101 + config_nm: false + tenant: + ip: 172.19.0.101 + config_nm: false + compute-2: + networks: + default: + ip: 192.168.122.102 + internal-api: + ip: 172.17.0.102 + config_nm: false + storage: + ip: 172.18.0.102 + config_nm: false + tenant: + ip: 172.19.0.102 + config_nm: false + run: + - ci/playbooks/run-architecture-crc.yml + required-projects: + - openstack-k8s-operators/architecture + +- job: + name: cifmw-architecture-crc-hci + parent: cifmw-architecture-crc-base + vars: + cifmw_libvirt_manager_pub_net: public + cifmw_use_devscripts: false + cifmw_openshift_setup_skip_internal_registry_tls_verify: true + cifmw_deploy_architecture: true + cifmw_use_libvirt: false + cifmw_architecture_scenario: va-hci-reduced + cifmw_extras: + - '@scenarios/reproducers/networking-definition.yml' + - '@scenarios/reproducers/3-nodes.yml' + files: + - ci/playbooks/run-architecture-crc.yml diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 1b51102754..b1d9d58b3c 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -2,6 +2,7 @@ github-check: jobs: - noop + - cifmw-architecture-crc-hci - cifmw-pod-ansible-test - cifmw-pod-k8s-snippets-source - cifmw-pod-pre-commit