From 70650441aa6cc6fdba24286b7960259faf550b84 Mon Sep 17 00:00:00 2001 From: pkomarov <33867702+pinikomarov@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:04:36 +0200 Subject: [PATCH] ospdo adoption dataplane adoption (#692) * Add Director Operator dataplane_adoption scripts for adoption Related CI patch and background: https://gitlab.cee.redhat.com/ci-framework/ci-framework-jobs/-/merge_requests/966 Jiras: https://issues.redhat.com/browse/OSPRH-1891 https://issues.redhat.com/browse/OSPRH-2984 * fix lint * fix lint * fix lint * fix lint * update vars * update org_ns var --- .../dataplane_adoption/defaults/main.yaml | 13 +++ .../roles/dataplane_adoption/tasks/main.yaml | 20 +++- .../tasks/ospdo_dataplane.yaml | 32 +++++ .../roles/dataplane_adoption/vars/ospdo.yaml | 109 ++++++++++++++++++ 4 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 tests/roles/dataplane_adoption/tasks/ospdo_dataplane.yaml create mode 100644 tests/roles/dataplane_adoption/vars/ospdo.yaml diff --git a/tests/roles/dataplane_adoption/defaults/main.yaml b/tests/roles/dataplane_adoption/defaults/main.yaml index 2e25c2af9..17a887729 100644 --- a/tests/roles/dataplane_adoption/defaults/main.yaml +++ b/tests/roles/dataplane_adoption/defaults/main.yaml @@ -272,3 +272,16 @@ dataplane_cr: | ovn_monitor_all: true edpm_ovn_remote_probe_interval: 60000 edpm_ovn_ofctrl_wait_before_clear: 8000 + +dpa_dir: "../.." +dpa_tests_dir: "{{ dpa_dir }}/tests" + +# ospdo env: +# Whether source env is OSPD Director Operator +# i.e. https://github.com/openstack-k8s-operators/osp-director-operator +ospdo_src: false +# rhoso namespace +rhoso_namespace: "openstack" +# director operator namespace +org_namespace: "openstack" +# adoption repo default location diff --git a/tests/roles/dataplane_adoption/tasks/main.yaml b/tests/roles/dataplane_adoption/tasks/main.yaml index 7ebbd8410..67fbf8b36 100644 --- a/tests/roles/dataplane_adoption/tasks/main.yaml +++ b/tests/roles/dataplane_adoption/tasks/main.yaml @@ -13,7 +13,7 @@ {{ shell_header }} {{ oc_header }} {{ oc_login_command }} - oc patch -n openstack openstackversion openstack \ + oc patch -n {{ rhoso_namespace }} openstackversion openstack \ --type='json' -p='[{ "op":"replace", "path":"/spec/customContainerImages/ansibleeeImage", "value": "{{ ansibleee_runner_img | default('quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest')}}"}]' @@ -23,13 +23,18 @@ ansible.builtin.shell: | {{ shell_header }} {{ oc_header }} - oc project openstack + oc project {{ rhoso_namespace }} - name: Include RHEV vars ansible.builtin.include_vars: file: rhev.yaml when: platform_rhev|default(false) +- name: Include OSPdO vars + ansible.builtin.include_vars: + file: ospdo.yaml + when: ospdo_src| bool + - name: ensure IPAM is configured no_log: "{{ use_no_log }}" ansible.builtin.shell: | @@ -51,6 +56,10 @@ register: edpm_privatekey when: edpm_encoded_privatekey is undefined +- name: execute alternative tasks when source env is ODPdO + ansible.builtin.include_tasks: ospdo_dataplane.yaml + when: ospdo_src| bool + - name: create dataplane-adoption-secret.yaml no_log: "{{ use_no_log }}" ansible.builtin.shell: | @@ -64,6 +73,7 @@ data: ssh-privatekey: "{{ edpm_encoded_privatekey | default(edpm_privatekey.content) }}" EOF + when: not ospdo_src| bool - name: generate an ssh key-pair nova-migration-ssh-key secret when: compute_adoption|bool @@ -74,7 +84,7 @@ cd "$(mktemp -d)" ssh-keygen -f ./id -t ecdsa-sha2-nistp521 -N '' oc get secret nova-migration-ssh-key || oc create secret generic nova-migration-ssh-key \ - -n openstack \ + -n {{ rhoso_namespace }} \ --from-file=ssh-privatekey=id \ --from-file=ssh-publickey=id.pub \ --type kubernetes.io/ssh-auth @@ -94,7 +104,7 @@ kind: ConfigMap metadata: name: nova-extra-config - namespace: openstack + namespace: {{ rhoso_namespace }} data: 19-nova-compute-cell1-workarounds.conf: | [workarounds] @@ -115,7 +125,7 @@ kind: ConfigMap metadata: name: nova-extra-config - namespace: openstack + namespace: {{ rhoso_namespace }} data: 19-nova-compute-cell1-workarounds.conf: | [workarounds] diff --git a/tests/roles/dataplane_adoption/tasks/ospdo_dataplane.yaml b/tests/roles/dataplane_adoption/tasks/ospdo_dataplane.yaml new file mode 100644 index 000000000..dbf66ee84 --- /dev/null +++ b/tests/roles/dataplane_adoption/tasks/ospdo_dataplane.yaml @@ -0,0 +1,32 @@ +# Take the private ssh key (id_ra) from the /home/cloud-admin/.ssh/ directory of the openstackclient pod and create a secret in the osp18 namespace +- name: Create secret from openstackclient pod + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc apply -f - <