From 19910b3641df5107f5aff575efd926787c6dd561 Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Nava Date: Mon, 16 Dec 2024 17:15:03 +0100 Subject: [PATCH 1/7] [ci_gen_kustomize_values] Allow reject vars patches --- roles/ci_gen_kustomize_values/README.md | 4 ++-- .../tasks/generate_snippets.yml | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/roles/ci_gen_kustomize_values/README.md b/roles/ci_gen_kustomize_values/README.md index 4fd81bcb4f..6c23440cdf 100644 --- a/roles/ci_gen_kustomize_values/README.md +++ b/roles/ci_gen_kustomize_values/README.md @@ -35,8 +35,8 @@ with a message. * `ci_gen_kustomize_fetch_ocp_state`: (Boolean) If true it enables generating CI templates based on the OCP state. Defaults to `true`. * `cifmw_ci_gen_kustomize_values_storage_class_prefix`: (String) Prefix for `storageClass` in generated values.yaml files. Defaults to `"lvms-"` only if `cifmw_use_lvms` is True, otherwise it defaults to `""`. The prefix is prepended to the `cifmw_ci_gen_kustomize_values_storage_class`. It is not recommended to override this value, instead set `cifmw_use_lvms` True or False. * `cifmw_ci_gen_kustomize_values_storage_class`: (String) Value for `storageClass` in generated values.yaml files. Defaults to `"lvms-local-storage"` only if `cifmw_use_lvms` is True, otherwise it defaults to `"local-storage"`. -* `cifmw_ci_gen_kustomize_values_remove_keys_expressions`: (List) Remove keys matching the regular expressions from source ConfigMaps (values.yaml). - Defaults to `["^nodes$", "^node(_[0-9]+)?$"]`. +* `cifmw_ci_gen_kustomize_values_remove_keys_expressions*`: (List) Remove keys matching the regular expressions from source ConfigMaps (values.yaml). + Defaults to `["^nodes$", "^node(_[0-9]+)?$"]`. Accepts passing additional expressions by passing variables that matches `cifmw_ci_gen_kustomize_values_remove_keys_expressions.+`. ### Specific parameters for edpm-values This configMap needs some more parameters in order to properly override the `architecture` provided one. diff --git a/roles/ci_gen_kustomize_values/tasks/generate_snippets.yml b/roles/ci_gen_kustomize_values/tasks/generate_snippets.yml index fe6d535786..b5afcbb243 100644 --- a/roles/ci_gen_kustomize_values/tasks/generate_snippets.yml +++ b/roles/ci_gen_kustomize_values/tasks/generate_snippets.yml @@ -69,6 +69,22 @@ cifmw_ci_gen_kustomize_values_snippets_dir_prefix ~ _datatype) | path_join }} + _cifmw_gen_kustomize_values_reject_extra_expressions: >- + {{ + hostvars[inventory_hostname] | + dict2items | + selectattr("key", "match", "^cifmw_ci_gen_kustomize_values_remove_keys_expressions.+") | + sort(attribute='key') | + map(attribute="value") | + list + }} + _cifmw_gen_kustomize_values_reject_expressions: >- + {{ + ( + _cifmw_gen_kustomize_values_reject_extra_expressions + + cifmw_ci_gen_kustomize_values_remove_keys_expressions + ) | flatten | unique + }} ansible.builtin.set_fact: values_datatype: "{{ _datatype }}" snippet_datadir: "{{ _dest_dir }}" @@ -81,7 +97,7 @@ {{ _config_map_content | ansible.utils.remove_keys( - target=cifmw_ci_gen_kustomize_values_remove_keys_expressions, + target=_cifmw_gen_kustomize_values_reject_expressions, matching_parameter='regex') }} cacheable: false From a3d4e430bb9d9103f939da688cd0207731d5a90f Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Nava Date: Mon, 16 Dec 2024 16:21:10 +0100 Subject: [PATCH 2/7] Consider that the zuul executor may be an IP Exposed a variable to pass the API endpoint without computing it too. --- ci/playbooks/multinode-autohold.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ci/playbooks/multinode-autohold.yml b/ci/playbooks/multinode-autohold.yml index db5a6ecc4b..3e19ae0e48 100644 --- a/ci/playbooks/multinode-autohold.yml +++ b/ci/playbooks/multinode-autohold.yml @@ -20,10 +20,16 @@ block: - name: Fetch existing autoholds from zuul vars: + _zuul_host: >- + {{ + zuul.executor.hostname + if (zuul.executor.hostname is ansible.utils.ip) else + (zuul.executor.hostname | split('.'))[1:] | join('.') + }} _zuul_api_url: >- {{ [ - ('https://'+ (zuul.executor.hostname | split('.'))[1:] | join('.')), + ('https://'+ _zuul_host, 'zuul', 'api', 'tenant', @@ -32,7 +38,7 @@ ] | join('/') }} ansible.builtin.uri: - url: "{{ _zuul_api_url }}" + url: "{{ zuul_autohold_endpoint | default(_zuul_api_url) }}" method: GET headers: Content-Type: "application/json" From 843c6f0d33fca6e859e60251829fe30492f0bb99 Mon Sep 17 00:00:00 2001 From: Miguel Angel Nieto Jimenez Date: Thu, 29 Aug 2024 12:48:11 +0200 Subject: [PATCH 3/7] Add nodeset2 for scenarios using 2 nodesets In NFV, we have some compute nodes belonging to the same deployment that are different and we need 2 nodesets to be able to deploy --- .../baremetal/01_baremetal_hosts_data.md | 2 + .../edpm-nodeset-values/values.yaml.j2 | 58 +++++++++ .../edpm-nodeset2-values/values.yaml.j2 | 58 +++++++++ roles/deploy_bmh/template/bmh.yml.j2 | 2 +- .../dt-nfv-ovs-dpdk-sriov-2nodesets.yml | 117 ++++++++++++++++++ 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset-values/values.yaml.j2 create mode 100644 roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset2-values/values.yaml.j2 create mode 100644 scenarios/reproducers/dt-nfv-ovs-dpdk-sriov-2nodesets.yml diff --git a/docs/source/baremetal/01_baremetal_hosts_data.md b/docs/source/baremetal/01_baremetal_hosts_data.md index 2999ac7cf2..ba8e25cc89 100644 --- a/docs/source/baremetal/01_baremetal_hosts_data.md +++ b/docs/source/baremetal/01_baremetal_hosts_data.md @@ -53,6 +53,8 @@ cifmw_baremetal_hosts: nmstate: # interfaces: # Sample nmstate state snippet # - name: enp6s0f0.161 + # Optional: (string) app label + label: openstack compute-1: # Another BM host diff --git a/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset-values/values.yaml.j2 b/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset-values/values.yaml.j2 new file mode 100644 index 0000000000..6ae842b92b --- /dev/null +++ b/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset-values/values.yaml.j2 @@ -0,0 +1,58 @@ +--- +# source: ovs-dpdk-sriov-2nodesets/edpm-nodeset-values/values.yaml.j2 +{% set instances_names = [] %} +{% set _original_nodeset = (original_content.data | default({})).nodeset | default({}) %} +{% set _original_nodes = _original_nodeset.nodes | default({}) %} +{% set _original_services = _original_nodeset['services'] | default([]) %} +{% if cifmw_baremetal_hosts | default([]) | length > 0 %} +{% for _inst in cifmw_baremetal_hosts.keys() %} +{% if (('label' in cifmw_baremetal_hosts[_inst]) and + (cifmw_baremetal_hosts[_inst]['label'] == 'openstack')) %} +{% set _ = instances_names.append(_inst) %} +{% endif %} +{% endfor %} +{% else %} +# Needed for verification gate +{% set _vm_type = (_original_nodes.keys() | first).split('-')[1] %} +{% for _inst in cifmw_networking_env_definition.instances.keys() %} +{% if _inst.startswith(_vm_type) %} +{% set _ = instances_names.append(_inst) %} +{% endif %} +{% endfor %} +{% endif %} +data: + ssh_keys: + authorized: {{ cifmw_ci_gen_kustomize_values_ssh_authorizedkeys | b64encode }} + private: {{ cifmw_ci_gen_kustomize_values_ssh_private_key | b64encode }} + public: {{ cifmw_ci_gen_kustomize_values_ssh_public_key | b64encode }} + nova: + migration: + ssh_keys: + private: {{ cifmw_ci_gen_kustomize_values_migration_priv_key | b64encode }} + public: {{ cifmw_ci_gen_kustomize_values_migration_pub_key | b64encode }} + nodeset: + ansible: + ansibleVars: + edpm_fips_mode: "{{ 'enabled' if cifmw_fips_enabled|default(false)|bool else 'check' }}" + timesync_ntp_servers: + - hostname: "{{ cifmw_ci_gen_kustomize_values_ntp_srv | default('pool.ntp.org') }}" +{% if cifmw_ci_gen_kustomize_values_sshd_ranges | default([]) | length > 0 %} + edpm_sshd_allowed_ranges: +{% for range in cifmw_ci_gen_kustomize_values_sshd_ranges %} + - "{{ range }}" +{% endfor %} +{% endif %} + nodes: +{% for instance in instances_names %} + edpm-{{ instance }}: + hostName: {{ instance }} +{% endfor %} + +{% if ('repo-setup' not in (_original_nodeset['services'] | default([]))) and + ('repo-setup' in ci_gen_kustomize_edpm_nodeset_predeployed_services) %} + services: + - "repo-setup" +{% for svc in _original_services %} + - "{{ svc }}" +{% endfor %} +{% endif %} diff --git a/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset2-values/values.yaml.j2 b/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset2-values/values.yaml.j2 new file mode 100644 index 0000000000..6e2109bc50 --- /dev/null +++ b/roles/ci_gen_kustomize_values/templates/ovs-dpdk-sriov-2nodesets/edpm-nodeset2-values/values.yaml.j2 @@ -0,0 +1,58 @@ +--- +# source: ovs-dpdk-sriov-2nodesets/edpm-nodeset2-values/values.yaml.j2 +{% set instances_names = [] %} +{% set _original_nodeset = (original_content.data | default({})).nodeset | default({}) %} +{% set _original_nodes = _original_nodeset.nodes | default({}) %} +{% set _original_services = _original_nodeset['services'] | default([]) %} +{% if cifmw_baremetal_hosts | default([]) | length > 0 %} +{% for _inst in cifmw_baremetal_hosts.keys() %} +{% if (('label' in cifmw_baremetal_hosts[_inst]) and + (cifmw_baremetal_hosts[_inst]['label'] == 'openstack-2')) %} +{% set _ = instances_names.append(_inst) %} +{% endif %} +{% endfor %} +{% else %} +# Needed for verification gate +{% set _vm_type = (_original_nodes.keys() | first).split('-')[1] %} +{% for _inst in cifmw_networking_env_definition.instances.keys() %} +{% if _inst.startswith(_vm_type) %} +{% set _ = instances_names.append(_inst) %} +{% endif %} +{% endfor %} +{% endif %} +data: + ssh_keys: + authorized: {{ cifmw_ci_gen_kustomize_values_ssh_authorizedkeys | b64encode }} + private: {{ cifmw_ci_gen_kustomize_values_ssh_private_key | b64encode }} + public: {{ cifmw_ci_gen_kustomize_values_ssh_public_key | b64encode }} + nova: + migration: + ssh_keys: + private: {{ cifmw_ci_gen_kustomize_values_migration_priv_key | b64encode }} + public: {{ cifmw_ci_gen_kustomize_values_migration_pub_key | b64encode }} + nodeset: + ansible: + ansibleVars: + edpm_fips_mode: "{{ 'enabled' if cifmw_fips_enabled|default(false)|bool else 'check' }}" + timesync_ntp_servers: + - hostname: "{{ cifmw_ci_gen_kustomize_values_ntp_srv | default('pool.ntp.org') }}" +{% if cifmw_ci_gen_kustomize_values_sshd_ranges | default([]) | length > 0 %} + edpm_sshd_allowed_ranges: +{% for range in cifmw_ci_gen_kustomize_values_sshd_ranges %} + - "{{ range }}" +{% endfor %} +{% endif %} + nodes: +{% for instance in instances_names %} + edpm-{{ instance }}: + hostName: {{ instance }} +{% endfor %} + +{% if ('repo-setup' not in (_original_nodeset['services'] | default([]))) and + ('repo-setup' in ci_gen_kustomize_edpm_nodeset_predeployed_services) %} + services: + - "repo-setup" +{% for svc in _original_services %} + - "{{ svc }}" +{% endfor %} +{% endif %} diff --git a/roles/deploy_bmh/template/bmh.yml.j2 b/roles/deploy_bmh/template/bmh.yml.j2 index 3c9cd7f4f1..587917ef04 100644 --- a/roles/deploy_bmh/template/bmh.yml.j2 +++ b/roles/deploy_bmh/template/bmh.yml.j2 @@ -9,7 +9,7 @@ metadata: inspect.metal3.io: "disabled" {% endif %} labels: - app: openstack + app: {{ node_data['label'] | default("openstack") }} workload: {{ node_name.split('-')[0] }} spec: bmc: diff --git a/scenarios/reproducers/dt-nfv-ovs-dpdk-sriov-2nodesets.yml b/scenarios/reproducers/dt-nfv-ovs-dpdk-sriov-2nodesets.yml new file mode 100644 index 0000000000..f491145b4c --- /dev/null +++ b/scenarios/reproducers/dt-nfv-ovs-dpdk-sriov-2nodesets.yml @@ -0,0 +1,117 @@ +--- +cifmw_architecture_scenario: "ovs-dpdk-sriov-2nodesets" + +# 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: "{{ cifmw_architecture_repo | default('/home/zuul/src/github.com/openstack-k8s-operators/architecture') }}" + +# HERE if you want to override kustomization, you can uncomment this parameter +# and push the data structure you want to apply. +# cifmw_architecture_user_kustomize: +# stage_0: +# 'network-values': +# data: +# starwars: Obiwan + +# HERE, if you want to stop the deployment loop at any stage, you can uncomment +# the following parameter and update the value to match the stage you want to +# reach. Known stages are: +# pre_kustomize_stage_INDEX +# pre_apply_stage_INDEX +# post_apply_stage_INDEX +# +# cifmw_deploy_architecture_stopper: + +cifmw_libvirt_manager_net_prefix_add: false +cifmw_libvirt_manager_fixed_networks: + - ocpbm + - ocppr + - osp_external + - osp_trunk + +cifmw_libvirt_manager_configuration: + networks: + ocpbm: | + + ocpbm + + + + ocppr: | + + ocppr + + + + osp_external: | + + osp_external + + + + osp_trunk: | + + osp_trunk + + + + vms: + controller: + uefi: "{{ cifmw_use_uefi }}" + root_part_id: "{{ cifmw_root_partition_id }}" + image_url: "{{ cifmw_discovered_image_url }}" + sha256_image_name: "{{ cifmw_discovered_hash }}" + image_local_dir: "{{ cifmw_basedir }}/images/" + disk_file_name: "base-os.qcow2" + disksize: 50 + memory: 8 + cpus: 4 + nets: + - ocpbm + - osp_trunk + ocp: + amount: 3 + uefi: true + root_part_id: 4 + admin_user: core + image_local_dir: "{{ cifmw_basedir }}/images/" + disk_file_name: "ocp_master" + disksize: "100" + extra_disks_num: 3 + extra_disks_size: "50G" + cpus: 10 + memory: 32 + nets: + - ocppr + - ocpbm + - osp_trunk + - osp_external + +# Note: with that extra_network_names "osp_trunk", we instruct +# devscripts role to create a new network, and associate it to +# the OCP nodes. This one is a "private network", and will hold +# the VLANs used for network isolation. + +# Please create a custom env file to provide: +# cifmw_devscripts_ci_token: +# cifmw_devscripts_pull_secret: + +# Baremetal host configuration +cifmw_config_bmh: true + +# BMH are deployed in a differnt NS than the secret OSP BMO +# references in each BMH. Metal3 requires the referenced +# secrets to be in the same NS or be allowed to access them +cifmw_openshift_setup_metal3_watch_all_ns: true + +# Use EDPM image for computes +cifmw_update_containers_edpm_image_url: "{{ cifmw_update_containers_registry }}/{{ cifmw_update_containers_org }}/edpm-hardened-uefi:{{ cifmw_update_containers_tag }}" + +# Set Logical Volume Manager Storage by default for local storage +cifmw_use_lvms: true +cifmw_lvms_disk_list: + - /dev/vda + - /dev/vdb + - /dev/vdc From e53622f51cbf3db7e289f3c42187aafa599d2d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Lobillo?= Date: Tue, 26 Nov 2024 21:49:10 +0100 Subject: [PATCH 4/7] [shiftstack]Enable the option to run the role isolated In order to allow users to run the shiftsatck role without being part of the whole reproducer, below changes are needed: - Add missing kubeconfig param - Load .bashrc whle running the ansible-navigator. That's needed for reading the envvars that will be used for writting the junit report. - Enable the option to exclude artifacts to be gathered. --- roles/shiftstack/README.md | 1 + roles/shiftstack/defaults/main.yml | 1 + roles/shiftstack/molecule/default/converge.yml | 1 + roles/shiftstack/tasks/pre_test_shiftstack.yml | 1 + roles/shiftstack/tasks/test_config.yml | 10 +++++++++- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/roles/shiftstack/README.md b/roles/shiftstack/README.md index 737d776741..d15e94a4f6 100644 --- a/roles/shiftstack/README.md +++ b/roles/shiftstack/README.md @@ -13,6 +13,7 @@ Role for triggering Openshift on Openstack QA automation (installation and tests * `cifmw_shiftstack_client_pod_image`: (*string*) The image for the container running in the `cifmw_shiftstack_client_pod_name` pod. Defaults to `quay.io/shiftstack-qe/shiftstack-client:latest`. * `cifmw_shiftstack_client_pvc_manifest`: (*string*) The file name for the shiftstackclient pvc manifest. Defaults to `"{{ cifmw_shiftstack_client_pod_name }}_pvc.yml"`. * `cifmw_shiftstack_cluster_name`: (*string*) The Openshift cluster name. Defaults to `ostest`. +* `cifmw_shiftstack_exclude_artifacts_regex`: (*string*) Regex that will be passed on `oc rsync` command as `--exclude` param, so the role does not gather the artifacts matching it. * `cifmw_shiftstack_installation_dir`: (*string*) Directory to place installation files. Defaults to `"{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/installation"`. * `cifmw_shiftstack_manifests_dir`: (*string*) Directory name for the role generated Openshift manifests. Defaults to `"{{ cifmw_shiftstack_basedir }}/manifests"`. * `cifmw_shiftstack_project_name`: (*string*) The Openstack project name. Defaults to `shiftstack`. diff --git a/roles/shiftstack/defaults/main.yml b/roles/shiftstack/defaults/main.yml index 4835e89d00..18a170a0fd 100644 --- a/roles/shiftstack/defaults/main.yml +++ b/roles/shiftstack/defaults/main.yml @@ -28,6 +28,7 @@ cifmw_shiftstack_client_pod_name: "shiftstackclient-{{ cifmw_shiftstack_project_ cifmw_shiftstack_client_pod_namespace: "openstack" cifmw_shiftstack_client_pvc_manifest: "{{ cifmw_shiftstack_client_pod_name }}_pvc.yml" cifmw_shiftstack_cluster_name: "ostest" +cifmw_shiftstack_exclude_artifacts_regex: "openshift-install" cifmw_shiftstack_installation_dir: "{{ cifmw_shiftstack_basedir }}/installation" cifmw_shiftstack_manifests_dir: "{{ cifmw_shiftstack_basedir }}/manifests" cifmw_shiftstack_project_name: "shiftstack" diff --git a/roles/shiftstack/molecule/default/converge.yml b/roles/shiftstack/molecule/default/converge.yml index ad49e1169d..fb30de5414 100644 --- a/roles/shiftstack/molecule/default/converge.yml +++ b/roles/shiftstack/molecule/default/converge.yml @@ -22,6 +22,7 @@ cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}" cifmw_openshift_kubeconfig: "{{ ansible_user_dir }}/.crc/machines/crc/kubeconfig" cifmw_shiftstack_run_playbook: cifmw-gate.yaml + cifmw_shiftstack_exclude_artifacts_regex: '' cifmw_run_test_shiftstack_testconfig: - cifmw-gate.yaml - cifmw-gate.yaml # The purpose of this repeated test config is to check the test config loop logic diff --git a/roles/shiftstack/tasks/pre_test_shiftstack.yml b/roles/shiftstack/tasks/pre_test_shiftstack.yml index 001ced3049..a285016b9a 100644 --- a/roles/shiftstack/tasks/pre_test_shiftstack.yml +++ b/roles/shiftstack/tasks/pre_test_shiftstack.yml @@ -21,6 +21,7 @@ - name: Remove the shiftstackclient pod if exists kubernetes.core.k8s: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" state: absent api_version: v1 kind: Pod diff --git a/roles/shiftstack/tasks/test_config.yml b/roles/shiftstack/tasks/test_config.yml index c6d697d32d..861b85b195 100644 --- a/roles/shiftstack/tasks/test_config.yml +++ b/roles/shiftstack/tasks/test_config.yml @@ -31,6 +31,7 @@ namespace: "{{ cifmw_shiftstack_client_pod_namespace }}" pod_name: "{{ cifmw_shiftstack_client_pod_name }}" command: >- + source .bashrc && cd shiftstack-qa && ansible-navigator run playbooks/{{ cifmw_shiftstack_run_playbook }} -e @jobs_definitions/{{ testconfig }} -e ocp_cluster_name={{ cifmw_shiftstack_cluster_name }} -e user_cloud={{ cifmw_shiftstack_project_name }} ansible.builtin.include_tasks: exec_command_in_pod.yml @@ -48,12 +49,19 @@ always: - name: "Copy the artifacts from the pod '{{ cifmw_shiftstack_client_pod_name }}'" + vars: + _exclude_options: >- + {{ + '--exclude=' ~ cifmw_shiftstack_exclude_artifacts_regex + if cifmw_shiftstack_exclude_artifacts_regex | default('') != '' + else '' + }} environment: PATH: "{{ cifmw_path }}" KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" ansible.builtin.command: cmd: > - oc rsync -n {{ cifmw_shiftstack_client_pod_namespace }} + oc rsync -n {{ cifmw_shiftstack_client_pod_namespace }} {{ _exclude_options }} {{ cifmw_shiftstack_client_pod_name }}:{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/ {{ testconfig_artifacts_dir }}/ failed_when: false From fc3040019e10e1f139783d89e1c3e75a720154c3 Mon Sep 17 00:00:00 2001 From: Andrew Bays Date: Fri, 15 Nov 2024 14:48:57 +0000 Subject: [PATCH 5/7] Support new OpenStack initialization resource for RHOSO install --- roles/edpm_prepare/tasks/main.yml | 28 ++++++++ roles/kustomize_deploy/defaults/main.yml | 18 +++++ .../tasks/install_operators.yml | 67 ++++++++++++++++++- 3 files changed, 110 insertions(+), 3 deletions(-) diff --git a/roles/edpm_prepare/tasks/main.yml b/roles/edpm_prepare/tasks/main.yml index 88a7c4b356..9029dab6f9 100644 --- a/roles/edpm_prepare/tasks/main.yml +++ b/roles/edpm_prepare/tasks/main.yml @@ -119,6 +119,34 @@ --namespace={{ cifmw_install_yamls_defaults['OPERATOR_NAMESPACE'] }} --for=jsonpath='{.status.phase}'=Complete --timeout=20m +- name: Check if the OpenStack initialization CRD exists + when: + - not cifmw_edpm_prepare_dry_run + kubernetes.core.k8s_info: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" + api_key: "{{ cifmw_openshift_token | default(omit) }}" + context: "{{ cifmw_openshift_context | default(omit) }}" + kind: CustomResourceDefinition + name: openstacks.operator.openstack.org + register: _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out + tags: + - control-plane + +- name: OpenStack meta-operator initialization, if necessary + when: + - not cifmw_edpm_prepare_dry_run + - _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out is defined + - _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources is defined + - (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) > 0 + vars: + make_openstack_init_env: "{{ cifmw_edpm_prepare_common_env }}" + make_openstack_init_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" + ansible.builtin.include_role: + name: 'install_yamls_makes' + tasks_from: 'make_openstack_init' + tags: + - control-plane + # Note(chkumar): Keeping set_openstack_containers role # till we migrate this task to update_containers role - name: Update OpenStack Services containers Env diff --git a/roles/kustomize_deploy/defaults/main.yml b/roles/kustomize_deploy/defaults/main.yml index 1d14a72461..eefd888a7f 100644 --- a/roles/kustomize_deploy/defaults/main.yml +++ b/roles/kustomize_deploy/defaults/main.yml @@ -108,6 +108,24 @@ cifmw_kustomize_deploy_nmstate_dest_file: >- ] | path_join }} +# openstack init resource +cifmw_kustomize_deploy_openstack_source_files: >- + {{ + [ + cifmw_kustomize_deploy_architecture_repo_dest_dir, + cifmw_kustomize_deploy_architecture_examples_common_path, + 'openstack' + ] | path_join + }} + +cifmw_kustomize_deploy_openstack_dest_file: >- + {{ + [ + cifmw_kustomize_deploy_kustomizations_dest_dir, + 'openstack.yaml' + ] | path_join + }} + # controlsplane resources cifmw_kustomize_deploy_nncp_source_files: >- diff --git a/roles/kustomize_deploy/tasks/install_operators.yml b/roles/kustomize_deploy/tasks/install_operators.yml index 8be1a7500f..eca39c58a2 100644 --- a/roles/kustomize_deploy/tasks/install_operators.yml +++ b/roles/kustomize_deploy/tasks/install_operators.yml @@ -107,7 +107,7 @@ - _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1 - (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined - - name: Wait for the openstack operators InstallPlan to be finish + - name: Wait for the openstack operators InstallPlan to be finished vars: _install_plan: >- {{ @@ -319,8 +319,69 @@ status: "True" wait_timeout: 300 -- name: Wait until OpenStack operators are deployed and ready - when: not cifmw_kustomize_deploy_generate_crs_only +- name: Check if the OpenStack initialization CRD exists + kubernetes.core.k8s_info: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" + api_key: "{{ cifmw_openshift_token | default(omit) }}" + context: "{{ cifmw_openshift_context | default(omit) }}" + kind: CustomResourceDefinition + name: openstacks.operator.openstack.org + register: _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out + +- name: Handle OpenStack initialization, if necessary + when: (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) > 0 + block: + - name: Generate OpenStack initialization kustomization file + ansible.builtin.copy: + content: >- + {{ + lookup( + 'kubernetes.core.kustomize', + dir=cifmw_kustomize_deploy_openstack_source_files + ) + }} + dest: "{{ cifmw_kustomize_deploy_openstack_dest_file }}" + mode: "0644" + + - name: Openstack initialization resources + when: not cifmw_kustomize_deploy_generate_crs_only + block: + - name: Apply the kustomized OpenStack initialization CRs + kubernetes.core.k8s: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" + api_key: "{{ cifmw_openshift_token | default(omit) }}" + context: "{{ cifmw_openshift_context | default(omit) }}" + state: present + wait: true + src: "{{ cifmw_kustomize_deploy_openstack_dest_file }}" + check_mode: >- + {{ + cifmw_kustomize_deploy_check_mode | + default(false, true) + }} + + - name: Wait until OpenStack operators are deployed and ready (new install paradigm) + when: not cifmw_kustomize_deploy_generate_crs_only + kubernetes.core.k8s_info: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" + kind: Openstack + namespace: openstack-operators + name: openstack + wait: true + wait_condition: + type: Ready + status: "True" + wait_timeout: 600 + check_mode: >- + {{ + cifmw_kustomize_deploy_check_mode | + default(false, true) + }} + +- name: Wait until OpenStack operators are deployed and ready (old install paradigm) + when: + - not cifmw_kustomize_deploy_generate_crs_only + - (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) == 0 kubernetes.core.k8s_info: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" kind: Deployment From 607e0e6311331c47cb17e5a8b07e81638c776a61 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Thu, 21 Nov 2024 15:06:59 +0530 Subject: [PATCH 6/7] Add hook to enable horizon Horizon is not enabled by default in crc based deployment. This PR adds hooks to enable horizon service --- hooks/playbooks/control_plane_horizon.yml | 28 +++++++++++++++++++++++ scenarios/centos-9/horizon.yml | 5 ++++ zuul.d/edpm_multinode.yaml | 1 + 3 files changed, 34 insertions(+) create mode 100644 hooks/playbooks/control_plane_horizon.yml create mode 100644 scenarios/centos-9/horizon.yml diff --git a/hooks/playbooks/control_plane_horizon.yml b/hooks/playbooks/control_plane_horizon.yml new file mode 100644 index 0000000000..010e1eace7 --- /dev/null +++ b/hooks/playbooks/control_plane_horizon.yml @@ -0,0 +1,28 @@ +--- +- name: Kustomize ControlPlane for horizon service + hosts: "{{ cifmw_target_hook_host | default('localhost') }}" + gather_facts: false + tasks: + - name: Ensure the kustomizations dir exists + ansible.builtin.file: + path: "{{ cifmw_basedir }}/artifacts/manifests/kustomizations/controlplane" + state: directory + mode: "0755" + + - name: Create kustomize yaml to enable Horizon + ansible.builtin.copy: + dest: "{{ cifmw_basedir }}/artifacts/manifests/kustomizations/controlplane/80-horizon-kustomization.yaml" + content: |- + apiVersion: kustomize.config.k8s.io/v1beta1 + kind: Kustomization + namespace: {{ namespace }} + patches: + - target: + kind: OpenStackControlPlane + patch: |- + - op: add + path: /spec/horizon/enabled + value: true + - op: add + path: /spec/horizon/template/memcachedInstance + value: memcached diff --git a/scenarios/centos-9/horizon.yml b/scenarios/centos-9/horizon.yml new file mode 100644 index 0000000000..83c427507c --- /dev/null +++ b/scenarios/centos-9/horizon.yml @@ -0,0 +1,5 @@ +--- +pre_deploy: + - name: 80 Kustomize OpenStack CR + type: playbook + source: control_plane_horizon.yml diff --git a/zuul.d/edpm_multinode.yaml b/zuul.d/edpm_multinode.yaml index 5438fbcb38..5eadecd4b2 100644 --- a/zuul.d/edpm_multinode.yaml +++ b/zuul.d/edpm_multinode.yaml @@ -316,6 +316,7 @@ vars: cifmw_extras: - '@scenarios/centos-9/multinode-ci.yml' + - '@scenarios/centos-9/horizon.yml' run: - ci/playbooks/edpm/run.yml From c2e4f9f08865c3812e06832c9533093f3876762e Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Tue, 24 Dec 2024 16:20:09 +0530 Subject: [PATCH 7/7] [autohold playbook] Add missing bracket https://github.com/openstack-k8s-operators/ci-framework/pull/2607 missed a bracket and that results into an error. Related-Issue: OSPRH-12508 --- ci/playbooks/multinode-autohold.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/playbooks/multinode-autohold.yml b/ci/playbooks/multinode-autohold.yml index 3e19ae0e48..cce54b32bf 100644 --- a/ci/playbooks/multinode-autohold.yml +++ b/ci/playbooks/multinode-autohold.yml @@ -29,7 +29,7 @@ _zuul_api_url: >- {{ [ - ('https://'+ _zuul_host, + ('https://'+ _zuul_host), 'zuul', 'api', 'tenant',