Skip to content

Commit

Permalink
[WIP] Prepare crc job for architecture repo
Browse files Browse the repository at this point in the history
  • Loading branch information
cescgina committed Jun 5, 2024
1 parent 1b08ce5 commit f0f85b9
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 18 deletions.
141 changes: 141 additions & 0 deletions ci/playbooks/run-architecture-crc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
# 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: Include common architecture parameter file
when:
- cifmw_architecture_scenario | length > 0
ansible.builtin.include_vars:
file: "scenarios/reproducers/va-common.yml"

- name: Inherit from parent scenarios if needed
ansible.builtin.include_tasks:
file: "ci/playbooks/inherit_parent_scenario.yml"

- 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 }}"
17 changes: 17 additions & 0 deletions scenarios/reproducers/va-hci-base.yml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 8 additions & 0 deletions scenarios/reproducers/va-hci-reduced.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 1 addition & 17 deletions scenarios/reproducers/va-hci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
98 changes: 97 additions & 1 deletion zuul.d/architecture-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions zuul.d/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0f85b9

Please sign in to comment.