diff --git a/ci/playbooks/bootstrap-networking-mapper.yml b/ci/playbooks/bootstrap-networking-mapper.yml index 954bb09229..5d91e085a8 100644 --- a/ci/playbooks/bootstrap-networking-mapper.yml +++ b/ci/playbooks/bootstrap-networking-mapper.yml @@ -24,6 +24,3 @@ -e @scenarios/centos-9/base.yml -e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml" -e cifmw_networking_mapper_ifaces_info_path=/etc/ci/env/interfaces-info.yml - {% if nodepool is defined %} - -e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/nodepool_params.yml" - {% endif %} diff --git a/ci/playbooks/edpm/fail.yml b/ci/playbooks/edpm/fail.yml new file mode 100644 index 0000000000..370acdf6b7 --- /dev/null +++ b/ci/playbooks/edpm/fail.yml @@ -0,0 +1,8 @@ +--- +- name: "Run ci/playbooks/edpm/fail.yml" + hosts: "{{ cifmw_zuul_target_host | default('all') }}" + gather_facts: true + tasks: + - name: Fail + ansible.builtin.fail: + msg: "Debug failure" diff --git a/playbooks/02-infra.yml b/playbooks/02-infra.yml index 7c8d637be7..735c23d181 100644 --- a/playbooks/02-infra.yml +++ b/playbooks/02-infra.yml @@ -32,6 +32,13 @@ ansible.builtin.include_vars: dir: "{{ cifmw_basedir }}/artifacts/parameters" + - name: Load Networking Environment Definition + vars: + cifmw_networking_mapper_assert_env_load: false + ansible.builtin.import_role: + name: networking_mapper + tasks_from: load_env_definition.yml + - name: Deploy OCP using Hive when: - cifmw_use_hive is defined @@ -86,6 +93,13 @@ ansible.builtin.include_role: name: cert_manager + - name: Configure hosts networking using nmstate + when: + - cifmw_config_nmstate is defined + - cifmw_config_nmstate | bool + ansible.builtin.include_role: + name: ci_nmstate + - name: Deploy Sushy Emulator and configure controller as hypervisor when: - cifmw_enable_virtual_baremetal_support | default(false) | bool @@ -102,13 +116,6 @@ ansible.builtin.include_role: name: libvirt_manager - - name: Configure hosts networking using nmstate - when: - - cifmw_config_nmstate is defined - - cifmw_config_nmstate | bool - ansible.builtin.include_role: - name: ci_nmstate - - name: Prepare container package builder when: - cifmw_pkg_build_list is defined diff --git a/roles/ci_nmstate/filter_plugins/ci_nmstate_map_instance_nets.py b/roles/ci_nmstate/filter_plugins/ci_nmstate_map_instance_nets.py index 64dd8f1fd4..bc140f0a39 100644 --- a/roles/ci_nmstate/filter_plugins/ci_nmstate_map_instance_nets.py +++ b/roles/ci_nmstate/filter_plugins/ci_nmstate_map_instance_nets.py @@ -199,6 +199,10 @@ def __map_instance_net_dnss(cls, net_env_def, intance_nets_defs): net_search_domain = network_data.get("search_domain", None) if net_search_domain and net_search_domain not in nmstate_search_domains: nmstate_search_domains.append(net_search_domain) + + # If not DNS servers configured for the instance skip DNS config + if not nmstate_nameservers: + return {} return { "search": nmstate_search_domains, "server": nmstate_nameservers, @@ -273,23 +277,22 @@ def __map_instance_nets(cls, net_env_def, instance_name): if not bool(net_data.get("skip_nm", False)) ] + result = {} interfaces = [ cls.__map_instance_net_interface(net_data) for net_data in intance_nets_defs ] + if interfaces: + result.update({"interfaces": interfaces}) - if not interfaces: - return {} routes = cls.__map_instance_net_routes(net_env_def, intance_nets_defs) + if routes: + result.update({"routes": {"config": routes}}) + dns = cls.__map_instance_net_dnss(net_env_def, intance_nets_defs) - return { - "interfaces": interfaces, - "routes": { - "config": routes, - }, - "dns-resolver": { - "config": dns, - }, - } + if dns: + result.update({"dns-resolver": {"config": dns}}) + + return result def filters(self): return { diff --git a/roles/ci_nmstate/tasks/main.yml b/roles/ci_nmstate/tasks/main.yml index 9bdc1a522a..79a0aedbd2 100644 --- a/roles/ci_nmstate/tasks/main.yml +++ b/roles/ci_nmstate/tasks/main.yml @@ -38,7 +38,7 @@ _cifmw_ci_nmstate_configs: >- {{ _cifmw_ci_nmstate_configs | - combine({ item: _instance_nmstate if _instance_nmstate | length > 0 else omit }) + combine({ item: _instance_nmstate | default({}) }) }} cacheable: true loop: >- @@ -91,7 +91,12 @@ cacheable: true - name: Provision k8s workers with nmstate - when: cifmw_openshift_kubeconfig is defined + when: + - cifmw_openshift_kubeconfig is defined + - >- + _cifmw_ci_nmstate_configs | dict2items | + selectattr('key', 'in', _cifmw_ci_nmstate_k8s_hosts) | + map('length') | sum > 0 ansible.builtin.include_tasks: nmstate_k8s_install.yml - name: Provision unmanaged nodes with nmstate diff --git a/roles/ci_nmstate/tasks/nmstate_k8s_install.yml b/roles/ci_nmstate/tasks/nmstate_k8s_install.yml index 10a15ad3c6..ed707c6763 100644 --- a/roles/ci_nmstate/tasks/nmstate_k8s_install.yml +++ b/roles/ci_nmstate/tasks/nmstate_k8s_install.yml @@ -13,14 +13,54 @@ kind: Namespace state: present +- name: Generate the OperatorGroup final CR + vars: + _operator_group_patches: >- + {{ + hostvars[inventory_hostname] | + dict2items | + selectattr("key", "match", + "^cifmw_ci_nmstate_olm_operator_group_patch.*") | + sort(attribute='key') | + map(attribute='value') | + list + }} + ansible.builtin.set_fact: + _cifmw_ci_nmstate_olm_operator_group_patched: >- + {{ + _cifmw_ci_nmstate_olm_operator_group_patched | default({}) | + combine(item, recursive=True) + }} + loop: "{{ [cifmw_ci_nmstate_olm_operator_group] + _operator_group_patches }}" + +- name: Generate the Subscription final CR + vars: + _subscription_patches: >- + {{ + hostvars[inventory_hostname] | + dict2items | + selectattr("key", "match", + "^cifmw_ci_nmstate_olm_subscription_patch.*") | + sort(attribute='key') | + map(attribute='value') | + list + }} + ansible.builtin.set_fact: + _cifmw_ci_nmstate_olm_subscription_patched: >- + {{ + _cifmw_ci_nmstate_olm_subscription_patched | default({}) | + combine(item, recursive=True) + }} + loop: "{{ [cifmw_ci_nmstate_olm_subscription] + _subscription_patches }}" + - name: Save k8s nmstate OLM manifests as artifacts ansible.builtin.copy: mode: "0644" dest: "{{ cifmw_ci_nmstate_manifests_dir }}/nmstate-{{ item.kind | lower }}-olm.yaml" content: "{{ item | to_nice_yaml }}" loop: - - "{{ cifmw_ci_nmstate_olm_operator_group }}" - - "{{ cifmw_ci_nmstate_olm_subscription }}" + - "{{ _cifmw_ci_nmstate_olm_operator_group_patched }}" + - "{{ _cifmw_ci_nmstate_olm_subscription_patched }}" loop_control: label: "{{ item.metadata.name }}" @@ -32,8 +72,8 @@ definition: "{{ item }}" state: present loop: - - "{{ cifmw_ci_nmstate_olm_operator_group }}" - - "{{ cifmw_ci_nmstate_olm_subscription }}" + - "{{ _cifmw_ci_nmstate_olm_operator_group_patched }}" + - "{{ _cifmw_ci_nmstate_olm_subscription_patched }}" loop_control: label: "{{ item.metadata.name }}" diff --git a/roles/install_yamls/tasks/main.yml b/roles/install_yamls/tasks/main.yml index fc90ce7a2d..4d87716b74 100644 --- a/roles/install_yamls/tasks/main.yml +++ b/roles/install_yamls/tasks/main.yml @@ -33,18 +33,39 @@ name: install_yamls tasks_from: zuul_set_operators_repo.yml +- name: Compute the cifmw_install_yamls_vars final value + tags: + - bootstrap + vars: + _cifmw_install_yamls_vars_patches: >- + {{ + hostvars[inventory_hostname] | + dict2items | + selectattr("key", "match", + "^cifmw_install_yamls_vars_patch.*") | + sort(attribute='key') | + map(attribute='value') | + list + }} + ansible.builtin.set_fact: + _install_yamls_override_vars: >- + {{ + _install_yamls_override_vars | default({}) | + combine(item, recursive=True) + }} + loop: "{{ [cifmw_install_yamls_vars| default({})] + _cifmw_install_yamls_vars_patches }}" + - name: Set environment override cifmw_install_yamls_environment fact tags: - bootstrap vars: - install_yamls_override_vars: "{{ cifmw_install_yamls_vars| default({}) }}" install_yamls_operators_repos: "{{ cifmw_install_yamls_operators_repo | default({}) }}" ansible.builtin.set_fact: cifmw_install_yamls_environment: >- {{ - install_yamls_override_vars.keys() | + _install_yamls_override_vars.keys() | map('upper') | - zip(install_yamls_override_vars.values()) | + zip(_install_yamls_override_vars.values()) | items2dict(key_name=0, value_name=1) | combine({ 'OUT': cifmw_install_yamls_manifests_dir, diff --git a/zuul.d/edpm_multinode.yaml b/zuul.d/edpm_multinode.yaml index eb429f8548..d82016657b 100644 --- a/zuul.d/edpm_multinode.yaml +++ b/zuul.d/edpm_multinode.yaml @@ -375,15 +375,12 @@ mtu: 1500 internal-api: network: "172.17.0.0/24" - gateway: "172.17.0.1" vlan: 20 storage: network: "172.18.0.0/24" - gateway: "172.18.0.1" vlan: 21 tenant: network: "172.19.0.0/24" - gateway: "172.19.0.1" vlan: 22 routers: ci-router: @@ -419,12 +416,15 @@ internal-api: ip: "172.17.0.5" trunk-parent: default + skip-nm-configuration: true storage: ip: "172.18.0.5" trunk-parent: default + skip-nm-configuration: true tenant: ip: "172.19.0.5" trunk-parent: default + skip-nm-configuration: true cifmw_extras: - '@scenarios/centos-9/multinode-ci.yml' run: @@ -445,23 +445,76 @@ parent: podified-multinode-edpm-deployment-crc-bootstrap-staging vars: cifmw_enable_virtual_baremetal_support: true + cifmw_config_nmstate: true + cifmw_ci_nmstate_instance_config: + controller: + interfaces: + - name: "{{ cifmw_networking_env_definition.instances['controller'].networks['baremetal'].interface_name | default(omit) }}" + type: ethernet + state: up + + - name: baremetal + type: linux-bridge + state: up + bridge: + options: + stp: + enabled: false + port: + - name: "{{ cifmw_networking_env_definition.instances['controller'].networks['baremetal'].interface_name | default(omit) }}" + stp-hairpin-mode: false + stp-path-cost: 100 + stp-priority: 32 + ipv4: + address: + - ip: "{{ cifmw_networking_mapper_definition_patch_02_bmaas_net.instances.controller.networks.baremetal.ip }}" + prefix-length: 24 + enabled: true + ipv6: + enabled: false + cifmw_ci_nmstate_olm_subscription_patch_01_ironic_ci_base: + metadata: + name: openshift-nmstate + cifmw_ci_nmstate_olm_operator_group_patch_01_ironic_ci_base: + metadata: + name: openshift-nmstate + cifmw_install_yamls_vars_patch_01_ironic_ci_base: + NMSTATE_OPERATOR_GROUP: "openshift-nmstate" + NMSTATE_SUBSCRIPTION: "openshift-nmstate" cifmw_networking_mapper_definition_patch_02_bmaas_net: networks: baremetal: network: "172.20.1.0/24" - gateway: "172.20.1.1" mtu: 1500 instances: controller: networks: baremetal: ip: "172.20.1.11" - skip-nm-configuration: true crc: networks: baremetal: ip: "172.20.1.5" - skip-nm-configuration: true + cifmw_libvirt_manager_configuration: + vms: + compute: + uefi: true + amount: 2 + root_part_id: 4 + disk_file_name: "blank" + disksize: 30 + memory: 4 + cpus: 4 + nets: + - baremetal + networks: + baremetal: | + + baremetal + + + + run: - ci/playbooks/edpm/run.yml - ci/playbooks/edpm/fail.yml diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 193a6e7ad2..7fb48bc6dd 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -2,106 +2,4 @@ github-check: jobs: - noop - - cifmw-pod-ansible-test - - cifmw-pod-k8s-snippets-source - - cifmw-pod-pre-commit - - cifmw-pod-zuul-files - - cifmw-content-provider-build-images - - cifmw-edpm-build-images - - cifmw-multinode-kuttl - - cifmw-tcib - - cifmw-architecture-validate-hci - - ci-framework-openstack-meta-content-provider - - build-push-container-cifmw-client - - cifmw-molecule-artifacts - - cifmw-molecule-build_containers - - cifmw-molecule-build_openstack_packages - - cifmw-molecule-build_push_container - - cifmw-molecule-cert_manager - - cifmw-molecule-ci_gen_kustomize_values - - cifmw-molecule-ci_local_storage - - cifmw-molecule-ci_lvms_storage - - cifmw-molecule-ci_metallb - - cifmw-molecule-ci_multus - - cifmw-molecule-ci_netconfig - - cifmw-molecule-ci_network - - cifmw-molecule-ci_nmstate - - cifmw-molecule-ci_setup - - cifmw-molecule-cifmw_block_device - - cifmw-molecule-cifmw_ceph_client - - cifmw-molecule-cifmw_ceph_spec - - cifmw-molecule-cifmw_cephadm - - cifmw-molecule-cifmw_create_admin - - cifmw-molecule-cifmw_external_dns - - cifmw-molecule-cifmw_ntp - - cifmw-molecule-cifmw_test_role - - cifmw-molecule-compliance - - cifmw-molecule-config_drive - - cifmw-molecule-copy_container - - cifmw-molecule-deploy_bmh - - cifmw-molecule-devscripts - - cifmw-molecule-discover_latest_image - - cifmw-molecule-dlrn_promote - - cifmw-molecule-dlrn_report - - cifmw-molecule-dnsmasq - - cifmw-molecule-edpm_build_images - - cifmw-molecule-edpm_deploy - - cifmw-molecule-edpm_deploy_baremetal - - cifmw-molecule-edpm_kustomize - - cifmw-molecule-edpm_prepare - - cifmw-molecule-env_op_images - - cifmw-molecule-hci_prepare - - cifmw-molecule-hive - - cifmw-molecule-idrac_configuration - - cifmw-molecule-install_ca - - cifmw-molecule-install_openstack_ca - - cifmw-molecule-install_yamls - - cifmw-molecule-kustomize_deploy - - cifmw-molecule-libvirt_manager - - cifmw-molecule-manage_secrets - - cifmw-molecule-mirror_registry - - cifmw-molecule-nat64_appliance - - cifmw-molecule-networking_mapper - - cifmw-molecule-openshift_adm - - cifmw-molecule-openshift_login - - cifmw-molecule-openshift_obs - - cifmw-molecule-openshift_provisioner_node - - cifmw-molecule-openshift_setup - - cifmw-molecule-operator_build - - cifmw-molecule-operator_deploy - - cifmw-molecule-os_must_gather - - cifmw-molecule-os_net_setup - - cifmw-molecule-ovirt - - cifmw-molecule-pkg_build - - cifmw-molecule-podman - - cifmw-molecule-polarion - - cifmw-molecule-registry_deploy - - cifmw-molecule-repo_setup - - cifmw-molecule-reportportal - - cifmw-molecule-reproducer - - cifmw-molecule-rhol_crc - - cifmw-molecule-run_hook - - cifmw-molecule-set_openstack_containers - - cifmw-molecule-shiftstack - - cifmw-molecule-ssh_jumper - - cifmw-molecule-sushy_emulator - - cifmw-molecule-switch_config - - cifmw-molecule-tempest - - cifmw-molecule-test_deps - - cifmw-molecule-test_operator - - cifmw-molecule-tofu - - cifmw-molecule-update - - cifmw-molecule-update_containers - - cifmw-molecule-validations - - cifmw-molecule-virtualbmc - github-experimental-trigger: - jobs: - - downstream-va-hci-trigger-job - - downstream-uni02beta-upstream-trigger-job - github-post: - jobs: - - build-push-container-cifmw-client-post - name: openstack-k8s-operators/ci-framework - templates: - - podified-multinode-edpm-ci-framework-pipeline - - data-plane-adoption-ci-framework-pipeline + - podified-multinode-edpm-deployment-crc-bootstrap-staging-ironic