Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions roles/validations/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ cifmw_validations_bmh_replace_leaf_label: leaf0-1
cifmw_validations_bmh_spare_leaf_label: leaf0-0
cifmw_validations_bmh_spare_nodename: edpm-compute-0-0
cifmw_validations_bmh_spare_hostname: edpm-compute-0-0.ctlplane.openstack.lab

# variables needed for download cache
cifmw_validations_cached_packages: ["tuned"]
cifmw_validations_cached_images: ["frr"]
cifmw_validations_cache_run_services: ["bootstrap", "frr"]
120 changes: 120 additions & 0 deletions roles/validations/tasks/edpm/download-cache-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
- name: Determine name of deployed NodeSet
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
cifmw.general.ci_script:
output_dir: "{{ cifmw_validations_basedir }}/artifacts"
script: >-
oc get -n {{ cifmw_validations_namespace }} osdpns --no-headers -o custom-columns=":metadata.name"
register: deployed_nodeset_name

- name: Clean cache on a compute node
become: true
ansible.builtin.command:
cmd: dnf clean all
delegate_to: "{{ cifmw_validations_edpm_check_node }}"

- name: Uninstall requested packages on a compute node
become: true
ansible.builtin.dnf:
name: "{{ item_cached_package }}"
state: absent
loop: "{{ cifmw_validations_cached_packages }}"
loop_control:
loop_var: item_cached_package
delegate_to: "{{ cifmw_validations_edpm_check_node }}"

- name: Patch nodeset with download cache configuration
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
cifmw.general.ci_script:
output_dir: "{{ cifmw_validations_basedir }}/artifacts"
script: >-
oc patch -n {{ cifmw_validations_namespace }} osdpns/"{{ deployed_nodeset_name.stdout | trim }}" --type json --patch '[{ "op": "add", "path": "/spec/nodeTemplate/ansible/ansibleVars/edpm_download_cache_running_services","value": {{ cifmw_validations_cache_run_services }} }]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This var shouldn't need to be set. It's set by the edpm_download_cache role from either edpm_services_override, or edpm_services, both of which of those are set automatically by openstack-operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was here because of: https://issues.redhat.com/browse/OSPRH-21737 Now that we know a fix is coming will remove this and let the role populate it automatically.


- name: Wait for nodeset to be SetupReady again
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
cifmw.general.ci_script:
output_dir: "{{ cifmw_validations_basedir }}/artifacts"
script: >-
oc wait osdpns "{{ deployed_nodeset_name.stdout | trim }}"
--namespace={{ cifmw_validations_namespace }}
--for=condition=SetupReady
--timeout={{ cifmw_validations_timeout }}m

- name: Create openstackdataplanedeployment for download cache service
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
cifmw.general.ci_script:
output_dir: "{{ cifmw_validations_basedir }}/artifacts"
script: |
oc apply -f - <<EOF
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneDeployment
metadata:
name: download-cache-service
namespace: {{ cifmw_validations_namespace }}
spec:
nodeSets:
- "{{ deployed_nodeset_name.stdout | trim }}"
servicesOverride:
- download-cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you want to also list bootstrap and frr
This will ensure that edpm_download_cache_running_services gets set automatically by the role with download-cache, bootstrap, and frr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootstrap can be added. Will look some more at frr.

EOF

- name: Wait for download cache service deployment to be complete
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
cifmw.general.ci_script:
output_dir: "{{ cifmw_validations_basedir }}/artifacts"
script: >-
oc wait openstackdataplanedeployment download-cache-service
--namespace={{ cifmw_validations_namespace }}
--for=condition=ready
--timeout={{ cifmw_validations_timeout }}s

- name: Find all rpm packages cached on compute node
become: true
ansible.builtin.command:
cmd: find /var/cache/dnf/ -name "*.rpm"
delegate_to: "{{ cifmw_validations_edpm_check_node }}"
register: dnf_cached_packages

# Create failure msg for xml results file
- name: Verify all requested packages were cached
ansible.builtin.fail:
msg: "'{{ item_cached_package }}' package was not cached"
loop: "{{ cifmw_validations_cached_packages }}"
loop_control:
loop_var: item_cached_package
when: item_cached_package+'-' not in dnf_cached_packages.stdout

- name: Find all container images cached on compute node
become: true
ansible.builtin.command:
cmd: podman images
delegate_to: "{{ cifmw_validations_edpm_check_node }}"
register: podman_images

# Create failure msg for xml results file
- name: Verify all requested container images were cached
ansible.builtin.fail:
msg: "'{{ item_cached_image }}' container image was not cached"
loop: "{{ cifmw_validations_cached_images }}"
loop_control:
loop_var: item_cached_image
when: item_cached_image+' ' not in podman_images.stdout

- name: Reinstall requested packages on a compute node
become: true
ansible.builtin.dnf:
name: "{{ item_cached_package }}"
state: present
loop: "{{ cifmw_validations_cached_packages }}"
loop_control:
loop_var: item_cached_package
delegate_to: "{{ cifmw_validations_edpm_check_node }}"