diff --git a/ci/playbooks/edpm_baremetal_deployment/run_extracted.yml b/ci/playbooks/edpm_baremetal_deployment/run_extracted.yml new file mode 100644 index 0000000000..8ff6b7635c --- /dev/null +++ b/ci/playbooks/edpm_baremetal_deployment/run_extracted.yml @@ -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" diff --git a/ci/templates/projects.yaml b/ci/templates/projects.yaml index ea967963cf..d82fbd43c7 100644 --- a/ci/templates/projects.yaml +++ b/ci/templates/projects.yaml @@ -20,4 +20,5 @@ - cifmw-edpm-build-images - cifmw-multinode-kuttl - cifmw-tcib + - podified-multinode-edpm-deployment-crc-baremetal # Start generated content diff --git a/playbooks/06-deploy-edpm.yml b/playbooks/06-deploy-edpm.yml index bdea245047..b32262310a 100644 --- a/playbooks/06-deploy-edpm.yml +++ b/playbooks/06-deploy-edpm.yml @@ -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 diff --git a/roles/edpm_deploy_baremetal/defaults/main.yml b/roles/edpm_deploy_baremetal/defaults/main.yml index 145424ec80..0878cd91ff 100644 --- a/roles/edpm_deploy_baremetal/defaults/main.yml +++ b/roles/edpm_deploy_baremetal/defaults/main.yml @@ -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 @@ -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 diff --git a/roles/edpm_deploy_baremetal/tasks/main.yml b/roles/edpm_deploy_baremetal/tasks/main.yml index aeed057db7..1c3b65af2f 100644 --- a/roles/edpm_deploy_baremetal/tasks/main.yml +++ b/roles/edpm_deploy_baremetal/tasks/main.yml @@ -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)}}" @@ -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" diff --git a/scenarios/centos-9/edpm_baremetal_deployment_ci_extracted.yml b/scenarios/centos-9/edpm_baremetal_deployment_ci_extracted.yml new file mode 100644 index 0000000000..2a9460b1a9 --- /dev/null +++ b/scenarios/centos-9/edpm_baremetal_deployment_ci_extracted.yml @@ -0,0 +1,97 @@ +--- +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" + 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: |- + + public + + + + + + + + + diff --git a/zuul.d/edpm.yaml b/zuul.d/edpm.yaml index 68ca51a7a5..c4bab767e4 100644 --- a/zuul.d/edpm.yaml +++ b/zuul.d/edpm.yaml @@ -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 diff --git a/zuul.d/nodeset.yaml b/zuul.d/nodeset.yaml index 952d39c2cc..2ffe86e227 100644 --- a/zuul.d/nodeset.yaml +++ b/zuul.d/nodeset.yaml @@ -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 diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index f780ae7a4e..4103e08dd7 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -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