Skip to content

Commit

Permalink
Wire up test-minimal data plane adoption test target multinode tripleo
Browse files Browse the repository at this point in the history
Wires up the test-minimal target from the data plane adoption tests repo
for the new tripleo multinode job. The overcloud/tripleo deployment was
added in the parent patch [1] and its depenencies. This is part of [2].

https://issues.redhat.com/browse/OSPRH-5754

Depends-On: openstack-k8s-operators/data-plane-adoption#397

[1] https://review.rdoproject.org/r/c/rdo-jobs/+/51916
[2] https://issues.redhat.com/browse/OSPRH-3038

Change-Id: I104399d783a46cd58b245a0aab0aa2e9ab6ffa0e
  • Loading branch information
marios committed Apr 18, 2024
1 parent 0fbbe75 commit 3dea7e7
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 7 deletions.
5 changes: 3 additions & 2 deletions playbooks/data_plane_adoption/collect_logs_crc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
ansible-galaxy collection install ansible.posix
ansible-playbook {{ rdo_dir }}/standalone_collect_logs.yaml -i /home/zuul/{{ standalone_vm_inventory | default("standalone_vm_inventory") }}
# os_net_config_file is only defined for multinode tripleo deploy job (not standalone)
- name: Gather logs from undercloud deployment
failed_when: false
when: tripleo_ci_inventory is defined
when: os_net_config_file is defined
ansible.builtin.shell: |
ansible-playbook {{ rdo_dir }}/tripleo_collect_logs.yaml -i /home/zuul/{{ tripleo_ci_inventory }}
ansible-playbook {{ rdo_dir }}/tripleo_collect_logs.yaml -i /home/zuul/tripleo_ci_inventory
- name: Copy pod debug files from {{ ansible_user_dir }}/logs on node
failed_when: false
Expand Down
224 changes: 222 additions & 2 deletions playbooks/data_plane_adoption/deploy_tripleo_run_repo_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
rdo_dir: "/home/zuul/src/review.rdoproject.org/rdo-jobs/playbooks/data_plane_adoption"
framework_dir: "/home/zuul/src/github.com/openstack-k8s-operators/ci-framework"
cifmw_datadir: "/home/zuul/ci-framework-data"
edpm_node_ip: 192.168.122.106
tasks:
- name: Create inventory for logs collection on the undercloud
ansible.builtin.template:
src: "{{ playbook_dir }}/files/standalone_vm_inventory.yaml.j2"
dest: "/home/zuul/{{ tripleo_ci_inventory }}"
dest: "/home/zuul/tripleo_ci_inventory"
vars:
tripleo_name: 'undercloud'

Expand All @@ -28,7 +29,7 @@
--enable=openstack-17.1-for-rhel-9-x86_64-rpms \
--enable=fast-datapath-for-rhel-9-x86_64-rpms
- name: Deploy the tripleo undercloud
- name: Deploy the tripleo source environment
ansible.builtin.shell: >
ansible-playbook {{ rdo_dir }}/install_yamls_deploy_tripleo.yaml -e "job_name={{ zuul.job }}"
{% if dpa_standalone_ntp_server is defined %}
Expand All @@ -51,3 +52,222 @@
ansible.builtin.shell: >
ansible-playbook -i {{ cifmw_datadir }}/artifacts/zuul_inventory.yml
{{rdo_dir}}/allow_zuul_connect_tripleo.yaml
- name: Accept undercloud ssh host keys to avoid prompt connecting for the first time
connection: local
ansible.builtin.shell: |
ssh-keygen -F {{ standalone_ip }} ||
ssh-keyscan -H {{ standalone_ip }} >> ~/.ssh/known_hosts
register: known_hosts_script
changed_when: "'found' not in known_hosts_script.stdout"

- name: Run test preparation in undercloud vm
ansible.builtin.shell:
ansible-playbook {{ rdo_dir }}/undercloud_prepare_tests.yaml -i /home/zuul/tripleo_ci_inventory

- name: Place control0 IP into vars.yaml for mariadb, ovndb
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/vars.yaml"
regexp: "'^{{ item }}:'"
value: "{{ item }}: 192.168.122.103"
loop:
- "source_mariadb_ip"
- "source_ovndb_ip"

- name: Place compute IP into vars.yaml for edpm_node_ip
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/vars.yaml"
regexp: "'^edpm_node_ip:'"
value: "edpm_node_ip: {{ edpm_node_ip }}"

- name: Fetch compute hostname to set edpm_node_hostname var
delegate_to: "overcloud-novacompute-0"
ansible.builtin.slurp:
path: /home/zuul/ansible_hostname
register: compute_hostname

- name: Insert vars for data plane operator and os-net-config with zuul native undercloud node
ansible.builtin.blockinfile:
marker_begin: "BEGIN os-net-config vars"
marker_end: "END os-net-config vars"
path: "{{ rdo_dir }}/vars.yaml"
block: |
dataplane_os_net_config_iface: nic2
dataplane_public_iface: eth1
dataplane_os_net_config_set_route: false
os_cloud_name: overcloud
edpm_node_hostname: "{{ compute_hostname['content'] | b64decode | trim }}.localdomain"
edpm_user: zuul
standalone_ip: "{{ standalone_ip | default('192.168.122.100') }}"
edpm_nodes:
{{ compute_hostname['content'] | b64decode | trim }}:
hostName: "{{ compute_hostname['content'] | b64decode | trim }}.localdomain"
ansible:
ansibleHost: {{ edpm_node_ip }}
networks:
- defaultRoute: true
fixedIP: {{ edpm_node_ip }}
name: ctlplane
subnetName: subnet1
- name: internalapi
subnetName: subnet1
- name: storage
subnetName: subnet1
- name: tenant
subnetName: subnet1
- name: Read the standalone ssh key downloaded from standalone
ansible.builtin.slurp:
path: "{{ standalone_private_key | default('/home/zuul/src/github.com/openstack-k8s-operators/install_yamls/out/edpm/ansibleee-ssh-key-id_rsa') }}"
register: standalone_key

- name: Place undercloud key into secrets.yaml
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/secrets.yaml"
regexp: '^edpm_encoded_privatekey:'
value: "edpm_encoded_privatekey: \"{{ standalone_key['content'] }}\""

- name: Read the tripleo passwords downloaded from undercloud
ansible.builtin.slurp:
path: /home/zuul/tripleo-passwords.yaml
register: tripleo_passwords

- name: Set tripleo passwords in secrets.yaml
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/secrets.yaml"
regexp: "{{ item.key }}:"
line: "{{ item.key }}: {{ tripleo_passwords['content'] | b64decode | regex_search(item.regex + ': (.+)', '\\1') | first }}"
loop:
- key: 'source_db_root_password'
regex: 'MysqlRootPassword'
- key: 'barbican_password'
regex: 'BarbicanPassword'
- key: 'glance_password'
regex: 'GlancePassword'
- key: 'placement_password'
regex: 'PlacementPassword'
- key: 'cinder_password'
regex: 'CinderPassword'
- key: 'neutron_password'
regex: 'NeutronPassword'
- key: 'heat_password'
regex: 'HeatPassword'
- key: 'heat_auth_encryption_key'
regex: 'HeatAuthEncryptionKey'
- key: 'manila_password'
regex: 'ManilaPassword'
- key: 'ironic_password'
regex: 'IronicPassword'
- key: 'nova_password'
regex: 'NovaPassword'
- key: 'octavia_password'
regex: 'OctaviaPassword'
- key: 'swift_password'
regex: 'SwiftPassword'

- name: Set controller ssh login vars controller1_ssh in secrets.yaml
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/secrets.yaml"
regexp: "controller{{ item.ctrl }}_ssh:"
value: "controller{{ item.ctrl }}_ssh: ssh -o StrictHostKeyChecking=accept-new -i {{ standalone_private_key | default('/home/zuul/src/github.com/openstack-k8s-operators/install_yamls/out/edpm/ansibleee-ssh-key-id_rsa') }} [email protected]{{ item.suffix }}"
loop:
- {ctrl: "1", suffix: "3"}
- {ctrl: "2", suffix: "4"}
- {ctrl: "3", suffix: "5"}

- name: Install required packages
become: true
ansible.builtin.package:
name:
- python3
- python3-pip

- name: pip install openstackclient for keystone adoption on crc
become: true
ansible.builtin.pip:
name: python-openstackclient
executable: pip3

- name: Fetch hash and set ci_testing_hash fact for periodic
when: "'periodic' in zuul.job or (force_periodic|default(false)|bool)"
block:
- name: Fetch latest c9 or rhel9 antelope podified-ci-testing from dlrn
when: dlrn_hash_tag is not defined
ansible.builtin.uri:
url: "https://{{ dpa_dlrn_server | default('trunk.rdoproject.org') }}/{{ dpa_dlrn_namespace | default('centos9-antelope') }}/podified-ci-testing/delorean.repo.md5"
return_content: true
register: latest_podified_ci_testing
until: latest_podified_ci_testing.status == 200
retries: 6
delay: 5

- name: Insert vars needed for periodic job into test vars.yaml
ansible.builtin.blockinfile:
marker_begin: "BEGIN periodic container vars"
marker_end: "END periodic container vars"
path: "{{ rdo_dir }}/vars.yaml"
block: |
periodic: true
container_registry: "{{ dpa_container_registry | default('quay.rdoproject.org') }}"
container_namespace: "{{ dpa_container_namespace | default('podified-antelope-centos9') }}"
container_tag: {{ dlrn_hash_tag | default(latest_podified_ci_testing.content) }}
- name: Set timesync_ntp_servers if dpa_standalone_ntp_server set
ansible.builtin.blockinfile:
path: "{{ rdo_dir }}/vars.yaml"
block: |
timesync_ntp_servers:
- hostname: {{ dpa_standalone_ntp_server }}
when: dpa_standalone_ntp_server is defined

- name: Store upstream dns server in vars.yaml if defined
# we need to expose this so that the tests can then point the dnsmasq in
# the controlplane to a working dns server to resolve names outside of
# openstack
when: upstream_control_plane_dns is defined
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/vars.yaml"
line: "upstream_dns: {{ upstream_control_plane_dns }}"

- name: Check if edpm-ansible.yml file was created
ansible.builtin.stat:
path: "/home/zuul/ci-framework-data/artifacts/edpm-ansible.yml"
register: edpm_ansible_file

- name: Read edpm_ansible file and extract ansibleee_runner img
when: edpm_ansible_file.stat.exists
block:
- name: Read file
ansible.builtin.slurp:
path: "/home/zuul/ci-framework-data/artifacts/edpm-ansible.yml"
register: edpm_ansible_output

- name: Extract ansiblee_runner img
ansible.builtin.set_fact:
ansibleee_runner_img: "{{ edpm_ansible_output['content'] | b64decode | regex_search('RELATED_IMAGE_ANSIBLEEE_IMAGE_URL_DEFAULT' + ': \"(.+)\"', '\\1') | first }}"

- name: Insert ansibleee_runner_img var into vars.yaml
ansible.builtin.lineinfile:
path: "{{ rdo_dir }}/vars.yaml"
line: "ansibleee_runner_img: {{ ansibleee_runner_img }}"

- name: Run data-plane-adoption tests test-minimal target
community.general.make:
chdir: "{{ dpa_dir }}"
target: "test-minimal"
params:
TEST_CONFIG: "{{ rdo_dir }}/ansible.cfg"
TEST_SECRETS: "{{ rdo_dir}}/secrets.yaml"
TEST_VARS: "{{ rdo_dir }}/vars.yaml"
TEST_INVENTORY: "tests/inventory.sample-crc-vagrant.yaml"
register: make_res
failed_when: '"failed=0" not in "{{ make_res.stdout_lines[-1:] }}"'

- name: Unregister with subscription-manager when this was a CDN OSP 17.1 source job
ansible.builtin.shell:
ansible-playbook {{ rdo_dir }}/unregister_RH_subscription_standalone.yaml -i /home/zuul/{{ standalone_vm_inventory | default("standalone_vm_inventory") }}

- name: Mark job as successful
ansible.builtin.file:
path: "{{ ansible_user_dir }}/cifmw-success"
state: touch
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
hostname_str_array=(${hostname//./ })
echo ${hostname_str_array[0]} > /home/zuul/ansible_hostname
- name: Set expected overcloud hostname with .ctlplane.localdomain
- name: Set expected overcloud hostname with .localdomain
become: true
ansible.builtin.shell: |
hostname=$(cat /home/zuul/ansible_hostname)
hostnamectl hostname "$hostname.ctlplane.localdomain"
hostnamectl hostname "$hostname.localdomain"
26 changes: 26 additions & 0 deletions playbooks/data_plane_adoption/undercloud_prepare_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- hosts: undercloud
gather_facts: false
tasks:
- name: Pull the tripleo passwords from undercloud vm
ansible.builtin.fetch:
src: /home/zuul/overcloud-deploy/overcloud/overcloud-passwords.yaml
dest: /home/zuul/tripleo-passwords.yaml
flat: true

- name: Pull the private key from undercloud
ansible.builtin.fetch:
src: /home/zuul/.ssh/id_rsa
dest: /home/zuul/edpm_ssh_key
flat: true

- name: Slurp crc public key for ssh access to standalone
delegate_to: localhost # localhost is the controller node in this case
ansible.builtin.slurp:
path: /home/zuul/.ssh/id_rsa.pub
register: crc_ssh_key

- name: Place crc public key to undercloud authorized_keys
ansible.builtin.lineinfile:
path: "/home/zuul/.ssh/authorized_keys"
insertafter: "EOF"
value: "{{ crc_ssh_key['content'] | b64decode | trim }}"
1 change: 0 additions & 1 deletion zuul.d/_data_plane_adoption.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
standalone_ip: 192.168.122.100
standalone_gateway: 192.168.122.10
standalone_private_key: /home/zuul/.ssh/id_rsa
tripleo_ci_inventory: "tripleo_ci_inventory"
os_net_config_file: "overcloud_net_config.j2"
host-vars:
undercloud:
Expand Down

0 comments on commit 3dea7e7

Please sign in to comment.