Skip to content

Commit

Permalink
Test extracted baremetal layout
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdenny committed May 14, 2024
1 parent 2a7810a commit 44ad7f2
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 8 deletions.
34 changes: 34 additions & 0 deletions ci/playbooks/edpm_baremetal_deployment/run_extracted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: "Run ci/playbooks/edpm_baremetal_deployment/run_extracted.yml"
hosts: "{{ cifmw_zuul_target_host | default('all') }}"
gather_facts: true
tasks:
- name: Filter out host if needed
when:
- cifmw_zuul_target_host is defined
- cifmw_zuul_target_host != 'all'
- inventory_hostname != cifmw_zuul_target_host
ansible.builtin.meta: end_host

- name: Check for edpm-ansible.yml file
ansible.builtin.stat:
path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"
register: edpm_file

- name: Perform Podified and EDPM deployment on compute nodes with virtual baremetal
ansible.builtin.command:
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
cmd: >-
ansible-playbook deploy-edpm.yml
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
-e @scenarios/centos-9/base.yml
-e @scenarios/centos-9/edpm_baremetal_deployment_ci_extracted.yml
{%- if edpm_file.stat.exists %}
-e @{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml
{%- endif %}
{%- if cifmw_extras is defined %}
{%- for extra_var in cifmw_extras %}
-e "{{ extra_var }}"
{%- endfor %}
{%- endif %}
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"
1 change: 1 addition & 0 deletions ci/templates/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
- cifmw-edpm-build-images
- cifmw-multinode-kuttl
- cifmw-tcib
- podified-multinode-edpm-deployment-crc-baremetal
# Start generated content
62 changes: 62 additions & 0 deletions playbooks/06-deploy-edpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,68 @@
step: post_ctlplane_deploy
ansible.builtin.import_playbook: ./hooks.yml

- name: Create virtual baremetal VMs
hosts: "{{ cifmw_sushy_emulator_hypervisor_target | default('localhost') }}"
gather_facts: true
tasks:
# end_play will end only current play, not the main edpm-deploy.yml
- name: Early end if architecture deploy
when:
- cifmw_architecture_scenario is defined
ansible.builtin.meta: end_play

- name: Setup and create virtual baremetal VMs
when: cifmw_edpm_deploy_baremetal | default('false') | bool
block:
- name: Load parameters files
ansible.builtin.include_vars:
dir: "{{ cifmw_basedir }}/artifacts/parameters"

- name: Ensure libvirt is present/configured
ansible.builtin.import_role:
name: libvirt_manager

- name: Create virtual baremetal
ansible.builtin.include_role:
name: libvirt_manager
tasks_from: deploy_layout

- name: "Copy artifacts to {{ cifmw_target_host | default('localhost') }}"
ansible.posix.synchronize:
src: "{{ cifmw_basedir }}/artifacts/"
dest: "{{ cifmw_basedir }}/artifacts/"
mode: pull
delegate_to: "{{ cifmw_target_host | default('localhost') }}"

- name: Deploy and configure sushy-emulator
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
tasks:
- name: Load parameters files
ansible.builtin.include_vars:
dir: "{{ cifmw_basedir }}/artifacts/parameters"

- name: Deploy and configure sushy-emulator
when: cifmw_edpm_deploy_baremetal | default('false') | bool
block:
- name: Deploy and configure sushy-emulator
ansible.builtin.include_role:
name: sushy_emulator

- name: Generate baremetal-info fact
ansible.builtin.include_role:
name: reproducer
tasks_from: generate_bm_info.yml

- name: Verify connection to baremetal VMs via Sushy Emulator
ansible.builtin.include_role:
name: sushy_emulator
tasks_from: verify.yml

- name: Deploy Metal3 BMHs
ansible.builtin.include_role:
name: deploy_bmh

- name: EDPM deployment on virtual baremetal
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: false
Expand Down
13 changes: 13 additions & 0 deletions roles/edpm_deploy_baremetal/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "cifmw_edpm_deploy_baremetal"
cifmw_edpm_deploy_baremetal_hypervisor_target: "{{ cifmw_baremetal_hypervisor_target | default('baremetal-hypervisor') }}"
cifmw_edpm_deploy_baremetal_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
cifmw_edpm_deploy_baremetal_manifests_dir: "{{ cifmw_manifests | default(cifmw_edpm_deploy_baremetal_basedir ~ '/artifacts/manifests') }}"
cifmw_edpm_deploy_baremetal_dry_run: false
cifmw_edpm_deploy_baremetal_libvirt_user: sushyemu
cifmw_edpm_deploy_baremetal_wait_provisionserver_retries: 60
cifmw_edpm_deploy_baremetal_wait_provisionserver_timeout_mins: 20
cifmw_edpm_deploy_baremetal_wait_ironic_timeout_mins: 20
Expand All @@ -28,3 +30,14 @@ cifmw_edpm_deploy_baremetal_wait_dataplane_timeout_mins: 40
cifmw_edpm_deploy_baremetal_update_os_containers: false
cifmw_edpm_deploy_baremetal_repo_setup_override: false
cifmw_edpm_deploy_baremetal_create_vms: true
cifmw_edpm_deploy_baremetal_instance_node_count: 2
cifmw_edpm_deploy_baremetal_instance_network_name: default
cifmw_edpm_deploy_baremetal_instance_node_name_prefix: edpm-compute
cifmw_edpm_deploy_baremetal_instance_memory: 4096
cifmw_edpm_deploy_baremetal_instance_vcpu: 2
cifmw_edpm_deploy_baremetal_instance_disk_size: 20
cifmw_edpm_deploy_baremetal_instance_os_variant: centos-stream9
cifmw_edpm_deploy_baremetal_instance_virt_type: kvm
cifmw_edpm_deploy_baremetal_instance_net_model: virtio
cifmw_edpm_deploy_baremetal_console_log_dir: "/var/log/bmaas_console_logs"
cifmw_edpm_deploy_baremetal_libvirt_hooks_path: /etc/libvirt/hooks/qemu.d
25 changes: 17 additions & 8 deletions roles/edpm_deploy_baremetal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,23 @@
}}
cifmw_edpm_deploy_baremetal_operators_build_output: "{{ operators_build_output }}"

- name: Create virtual baremetal
when: cifmw_edpm_deploy_baremetal_create_vms | bool
- name: Set facts for baremetal UEFI image url
ansible.builtin.set_fact:
cifmw_set_openstack_containers_overrides:
RELATED_IMAGE_OS_CONTAINER_IMAGE_URL_DEFAULT: "{{ cifmw_build_images_output['images']['edpm-hardened-uefi']['image'] }}"
cacheable: true
when: cifmw_build_images_output is defined

- name: Patch baremetal CSV to override the uefi image
when:
- not cifmw_edpm_deploy_baremetal_dry_run
- (cifmw_edpm_deploy_baremetal_update_os_containers|bool) or (cifmw_build_images_output is defined)
vars:
make_edpm_baremetal_compute_env: "{{ cifmw_edpm_deploy_baremetal_common_env |
combine(cifmw_edpm_deploy_baremetal_make_openstack_env)}}"
make_edpm_baremetal_compute_dryrun: "{{ cifmw_edpm_deploy_baremetal_dry_run }}"
cifmw_set_openstack_containers_operator_name: openstack-baremetal
ansible.builtin.include_role:
name: 'install_yamls_makes'
tasks_from: 'make_edpm_baremetal_compute'
name: set_openstack_containers

- name: Prepare OpenStack Dataplane NodeSet CR
- name: Deploy EDPM with baremetal
vars:
make_edpm_deploy_baremetal_prep_env: "{{ cifmw_edpm_deploy_baremetal_common_env |
combine(cifmw_edpm_deploy_baremetal_make_openstack_env)}}"
Expand Down Expand Up @@ -181,6 +187,9 @@
yq -i '(.spec.services[] | select(. == "repo-setup")) |= "repo-setup-downstream"' {{ cifmw_edpm_deploy_baremetal_crs_kustomize_result.output_path }}
- name: Apply the OpenStackDataPlaneNodeSet CR
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
when: not cifmw_edpm_deploy_baremetal_dry_run
cifmw.general.ci_script:
output_dir: "{{ cifmw_edpm_deploy_baremetal_basedir }}/artifacts"
Expand Down
98 changes: 98 additions & 0 deletions scenarios/centos-9/edpm_baremetal_deployment_ci_extracted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
cifmw_installyamls_repos: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/install_yamls"

# edpm_prepare role vars
cifmw_operator_build_meta_name: "openstack-operator"
cifmw_edpm_prepare_skip_crc_storage_creation: true


# openshift_login role vars
cifmw_openshift_user: "kubeadmin"
cifmw_openshift_password: "123456789"
cifmw_openshift_api: api.crc.testing:6443
cifmw_openshift_kubeconfig: "{{ ansible_user_dir }}/.kube/config"
cifmw_openshift_skip_tls_verify: true
cifmw_config_certmanager: true

pre_infra:
- name: Download needed tools
inventory: 'localhost,'
connection: local
type: playbook
source: "{{ cifmw_installyamls_repos }}/devsetup/download_tools.yaml"

post_ctlplane_deploy:
- name: Tune rabbitmq resources
type: playbook
source: rabbitmq_tuning.yml

- name: Validate podified control plane
type: playbook
source: validate_podified_deployment.yml
extra_vars:
podified_validation: "{{ podified_validation | default ('false') | bool }}"
cifmw_openshift_kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
cifmw_path: "{{ cifmw_path }}"
openstack_namespace: "{{ cifmw_install_yamls_defaults['NAMESPACE'] }}"

cifmw_install_yamls_vars:
DEPLOY_DIR: "{{ cifmw_basedir }}/artifacts/edpm_compute" # used during Baremetal deployment
INFRA_REPO: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/infra-operator"
BMAAS_INSTANCE_MEMORY: 8192
BMAAS_INSTANCE_VCPUS: 6
BMAAS_INSTANCE_DISK_SIZE: 40
DATAPLANE_GROWVOLS_ARGS: "/=8GB /tmp=1GB /home=1GB /var=8GB"
BMO_SETUP:
DATAPLANE_TOTAL_NODES: 2
INSTALL_CERT_MANAGER: false

cifmw_use_crc: false
cifmw_use_libvirt: false


# Deploy EDPM in multinode scenario
cifmw_deploy_edpm: true

post_infra: &fetch_nodes_facts
- name: Fetch nodes facts and save them as parameters
type: playbook
inventory: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
source: fetch_compute_facts.yml

pre_update: *fetch_nodes_facts

cifmw_openshift_setup_skip_internal_registry_tls_verify: true
# openshift_setup role vars
cifmw_openshift_setup_skip_internal_registry: true


# edpm_deploy role vars
cifmw_baremetal_hypervisor_target: baremetal-hypervisor # remove
cifmw_sushy_emulator_hypervisor_target: baremetal-hypervisor
cifmw_edpm_deploy_baremetal: true

cifmw_libvirt_manager_configuration:
vms:
edpm-compute:
amount: 2
disk_file_name: "blank"
disksize: 50
memory: 8
cpus: 4
bootmenu_enable: "yes"
nets:
- public
networks:
public: |-
<network>
<name>public</name>
<forward mode='nat'/>
<bridge name='public' stp='on' delay='0'/>
<mac address='52:54:00:6a:f2:dc'/>
<ip family='ipv4' address='192.168.100.1' prefix='24'>
<dhcp>
<range start='192.168.100.10' end='192.168.100.100'/>
</dhcp>
</ip>
</network>
9 changes: 9 additions & 0 deletions zuul.d/edpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
crc_parameters: "--memory 32000 --disk-size 240 --cpus 12"
cifmw_manage_secrets_pullsecret_content: '{}'

# Extracted baremetal job
- job:
name: podified-multinode-edpm-deployment-crc-baremetal
nodeset: centos-9-medium-2x-centos-9-crc-extracted-2.30-3xl
parent: cifmw-podified-multinode-edpm-base-crc
run:
- ci/playbooks/edpm_baremetal_deployment/run_extracted.yml


# Podified galera job
- job:
name: cifmw-crc-podified-galera-deployment
Expand Down
19 changes: 19 additions & 0 deletions zuul.d/nodeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,22 @@
- name: ocps
nodes:
- crc

- nodeset:
name: centos-9-medium-2x-centos-9-crc-extracted-2.30-3xl
nodes:
- name: controller
label: cloud-centos-9-stream-tripleo-medium
- name: compute-0
label: cloud-centos-9-stream-tripleo
- name: baremetal-hypervisor
label: cloud-centos-9-stream-tripleo
- name: crc
label: coreos-crc-extracted-2-30-0-3xl
groups:
- name: computes
nodes:
- compute-0
- name: ocps
nodes:
- crc
1 change: 1 addition & 0 deletions zuul.d/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- cifmw-edpm-build-images
- cifmw-multinode-kuttl
- cifmw-tcib
- podified-multinode-edpm-deployment-crc-baremetal
- cifmw-molecule-artifacts
- cifmw-molecule-build_containers
- cifmw-molecule-build_openstack_packages
Expand Down

0 comments on commit 44ad7f2

Please sign in to comment.