Skip to content

Commit e0c9a19

Browse files
authored
Merge pull request #138 from mhjacks/v2_to_be
Bring Ansible Edge GitOps level with Federated Edge Observability
2 parents 27c8577 + 30e817e commit e0c9a19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+177
-1491
lines changed

Changes.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,19 @@
5353
* Remove ODF overrides from OCP 4.12/3 that force storageClass to gp2; all released versions should use gp3-csi now.
5454
* Include overrides for OCP 4.12 and OCP 4.13 to use the older `ocs-storagecluster-ceph-rbd` storageClass.
5555

56-
## Changes for v2.0 (TBD)
56+
## Changes for v2.0 (March 5, 2025)
5757

5858
* Split HMI Demo Project out to separate [repository](https://github.com/validatedpatterns-demos/rhvp.ansible_edge_hmi)
5959
* Split HMI Config out to separate [repository](https://github.com/validatedpatterns-demos/ansible-edge-gitops-hmi-config-as-code.git)
6060
* Drop the custom execution environment because AAP can resolve these dependencies itself
6161
* Switch to modular common
6262
* Use the Validated Patterns ODF Chart (dropping our custom version)
63-
* Comment out portworx install and test, as the only OCP version that supports is 4.12, which is now past
63+
* Drop portworx chart and Makefile targets, as the only OCP version that supports is 4.12, which is now past
6464
the end of its maintenance support lifecycle.
6565
* Refactor installation mechannism to use standard configuration-as-code approach, which will make it easier to drop
6666
in a new config-as-code repository.
6767
* Move VM definitions outside of edge-gitops-vms chart so that derived patterns do not inherit the HMI kiosks. Kiosk
6868
VMs now defined by default in overrides.
69+
* Use Validated Patterns charts for Installing Ansible Automation Platform, OpenShift Virtualization, and
70+
edge-gitops-vms.
71+
* Switch to AAP-2.5 support as provided by Validated Patterns aap-config chart.

Makefile

-6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ help:
1414
install upgrade deploy: operator-deploy post-install ## Install or upgrade the pattern via the operator
1515
echo "Installed/Upgraded"
1616

17-
#portworx-install portworx-upgrade portworx-deploy: ## Install with portworx instead
18-
# EXTRA_HELM_OPTS='-f values-portworx.yaml' make install
19-
2017
post-install: ## Post-install tasks - load-secrets
2118
make load-secrets
2219
echo "Post-deploy complete"
@@ -31,9 +28,6 @@ test: ## Run tests
3128
@set -e; for i in $(CHARTS); do echo "$${i}"; helm template "$${i}"; done
3229
echo Tests SUCCESSFUL
3330

34-
#portworx-test:
35-
# EXTRA_HELM_OPTS='-f values-portworx.yaml' make test
36-
3731
update-tests: ## Update test results
3832
./scripts/update-tests.sh $(CHART_OPTS)
3933

ansible/ansible_get_credentials.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
api_version: route.openshift.io/v1
1414
kind: Route
1515
namespace: ansible-automation-platform
16-
name: controller
16+
name: aap
1717
register: aap_host
1818
until: aap_host.resources | length == 1
1919
retries: 20
@@ -27,7 +27,7 @@
2727
kubernetes.core.k8s_info:
2828
kind: Secret
2929
namespace: ansible-automation-platform
30-
name: controller-admin-password
30+
name: aap-admin-password
3131
register: admin_pw
3232
until: admin_pw.resources | length == 1
3333
retries: 20

ansible/configure_aap.yml

-94
This file was deleted.

ansible/get_controller_values_overrides.yml

-22
This file was deleted.

ansible/imperative_configure_aap.yml

-12
This file was deleted.

ansible/odf_fix_dataimportcrons.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env ansible-playbook
2+
---
3+
# This workaround was implemented to fix a problem where openshift-cnv would
4+
# not recognize a default virt storage class change and change the format of
5+
# datasources. The issue was fixed in OpenShift Virtualization 4.16.4.
6+
- name: Determine if we have PVC clean-up to do
7+
become: false
8+
connection: local
9+
hosts: localhost
10+
gather_facts: false
11+
vars:
12+
kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"
13+
dataimportcron_cleanup: false
14+
image_cleanup_namespace: "openshift-virtualization-os-images"
15+
cluster_version: "{{ global['clusterVersion'] | default('UNSET') }}"
16+
tasks:
17+
- name: Check cluster version
18+
ansible.builtin.debug:
19+
var: cluster_version
20+
21+
- name: Exit if normal version check is not right
22+
ansible.builtin.meta: end_play
23+
when: cluster_version not in [ '4.17', '4.16', 'UNSET' ]
24+
25+
- name: Find default storageclass
26+
ansible.builtin.shell: |
27+
set -o pipefail
28+
oc get storageclass -o json | jq -r '.items[] | select(.metadata.annotations."storageclass.kubernetes.io/is-default-class")'
29+
register: default_sc_output
30+
changed_when: false
31+
32+
- name: Find virtualization default storageclass
33+
ansible.builtin.shell: |
34+
set -o pipefail
35+
oc get storageclass -o json | jq -r '.items[] | select(.metadata.annotations."storageclass.kubevirt.io/is-default-virt-class")'
36+
register: default_virt_sc_output
37+
changed_when: false
38+
39+
- name: Compare default virtualization storageclass and default storageclass to determine whether to clean PVCs
40+
block:
41+
- name: Parse results
42+
ansible.builtin.set_fact:
43+
default_sc: '{{ default_sc_output.stdout | from_json }}'
44+
default_virt_sc: '{{ default_virt_sc_output.stdout | from_json }}'
45+
46+
- name: Commit to dataimportcron cleanup
47+
ansible.builtin.set_fact:
48+
dataimportcron_cleanup: true
49+
when:
50+
- default_virt_sc.metadata.name == "ocs-storagecluster-ceph-rbd-virtualization"
51+
- default_sc.metadata.name != default_virt_sc.metadata.name
52+
rescue:
53+
- name: Note that we exited
54+
ansible.builtin.debug:
55+
msg: "Caught an error before we could determine to clean up dataimportcrons, exiting"
56+
57+
- name: End play (successfully)
58+
ansible.builtin.meta: end_play
59+
60+
- name: Cleanup incorrect datasourceimport images (PVCs)
61+
when:
62+
- dataimportcron_cleanup
63+
block:
64+
- name: Find dataimportcrons
65+
kubernetes.core.k8s_info:
66+
kind: dataimportcron
67+
namespace: '{{ image_cleanup_namespace }}'
68+
api_version: cdi.kubevirt.io/v1beta1
69+
register: dic_list
70+
71+
- name: Extract dic names
72+
ansible.builtin.set_fact:
73+
dic_names: "{{ dic_names | default([]) + [ item.metadata.name ] }}"
74+
loop: "{{ dic_list.resources }}"
75+
76+
- name: Show names
77+
ansible.builtin.debug:
78+
var: dic_names
79+
80+
- name: Find datasources to cleanup
81+
kubernetes.core.k8s_info:
82+
kind: datasource
83+
namespace: '{{ image_cleanup_namespace }}'
84+
api_version: cdi.kubevirt.io/v1beta1
85+
register: ds_cleanup_list
86+
87+
- name: Keep track of objects to remove
88+
ansible.builtin.set_fact:
89+
cron_cleanups: []
90+
ds_cleanups: []
91+
92+
- name: Record datasources that need cleanup
93+
ansible.builtin.set_fact:
94+
cron_cleanups: "{{ cron_cleanups + [ item.metadata.labels['cdi.kubevirt.io/dataImportCron'] ] }}"
95+
ds_cleanups: "{{ ds_cleanups + [ item.metadata.name ] }}"
96+
loop: "{{ ds_cleanup_list.resources }}"
97+
when:
98+
- item['metadata']['labels']['cdi.kubevirt.io/dataImportCron'] is defined
99+
- item['metadata']['labels']['cdi.kubevirt.io/dataImportCron'] in dic_names
100+
- item.status.conditions[0].message != "DataSource is ready to be consumed"
101+
102+
- name: Check on removables
103+
ansible.builtin.debug:
104+
msg:
105+
- "cron_cleanups: {{ cron_cleanups }}"
106+
- "ds_cleanups: {{ ds_cleanups }}"
107+
108+
- name: Delete datasources in cleanup list
109+
kubernetes.core.k8s:
110+
kind: datasource
111+
namespace: '{{ image_cleanup_namespace }}'
112+
api_version: cdi.kubevirt.io/v1beta1
113+
name: "{{ item }}"
114+
state: absent
115+
loop: "{{ ds_cleanups }}"
116+
117+
- name: Delete datavolumes in cleanup list
118+
kubernetes.core.k8s:
119+
kind: datavolume
120+
namespace: '{{ image_cleanup_namespace }}'
121+
api_version: cdi.kubevirt.io/v1beta1
122+
label_selectors:
123+
- 'cdi.kubevirt.io/dataImportCron={{ item }}'
124+
state: absent
125+
loop: "{{ cron_cleanups }}"
126+
127+
- name: Delete dataimportcrons in cleanup list
128+
kubernetes.core.k8s:
129+
kind: dataimportcron
130+
namespace: '{{ image_cleanup_namespace }}'
131+
api_version: cdi.kubevirt.io/v1beta1
132+
name: "{{ item }}"
133+
state: absent
134+
loop: "{{ cron_cleanups }}"
135+
rescue:
136+
- name: Note that we exited
137+
ansible.builtin.debug:
138+
msg: "Caught an error while cleaning up dataimportcrons, exiting"

0 commit comments

Comments
 (0)