|
3 | 3 | - set_fact: |
4 | 4 | log_labels: "{{ log_label | default('test-clf', true) }}" |
5 | 5 | clo_version: "{{ cluster_logging_channel | regex_search('\\d+\\.\\d+') | float }}" |
| 6 | + logging_version: "{{ cluster_logging_channel.split('-')[1].replace('.', '-') }}" |
| 7 | + |
| 8 | + |
| 9 | +- name: Get the ocp server version |
| 10 | + shell: oc version | grep "Server Version" | awk '{print $3}' | cut -d . -f 1,2 |
| 11 | + register: ocp_version |
6 | 12 |
|
7 | 13 | - name: Check channel variables |
8 | 14 | fail: |
|
14 | 20 | # Set log directory |
15 | 21 | - set_fact: |
16 | 22 | cl_log_dir: "{{ log_dir_path | default('/root/clf_logs', true) }}" |
| 23 | + ocp_version: "{{ ocp_version.stdout }}" |
17 | 24 |
|
18 | 25 | # Validate external URLs and install python on external VMs |
19 | 26 | - block: |
|
36 | 43 | when: cluster_log_forwarder |
37 | 44 |
|
38 | 45 | # Custom ImageContentSourcePolicy and CatalogSource |
39 | | -- name: Create ImageContentSourcePolicy and CatalogSource for CLO less than or equal to 5.8 |
| 46 | +- name: Create ImageContentSourcePolicy and CatalogSource for CLO less than 5.9 |
40 | 47 | block: |
41 | 48 | - name: Create CatalogSource |
42 | 49 | template: |
|
45 | 52 |
|
46 | 53 | - name: Run ImageContentSourcePolicy |
47 | 54 | shell: oc apply -f "{{ role_path }}/files/ImageContentSourcePolicy.yml" |
| 55 | + when: ocp_version | float < 4.13 |
| 56 | + |
| 57 | + - name: Create ImageDigestMirrorSet |
| 58 | + template: |
| 59 | + src: "{{ role_path }}/templates/idms.yaml.j2" |
| 60 | + dest: "{{ role_path }}/files/ImageDigestMirrorSet.yaml" |
| 61 | + |
| 62 | + - name: Run ImageDigestMirrorSet |
| 63 | + include_tasks: "{{ role_path }}/files/ImageDigestMirrorSet.yaml" |
| 64 | + when: ocp_version | float >= 4.13 |
48 | 65 |
|
49 | 66 | - name: Run CatalogSource |
50 | 67 | shell: oc apply -f "{{ role_path }}/files/CatalogSource.yml" |
|
65 | 82 | when: |
66 | 83 | - elasticsearch_clf_cs != '' and clusterlogging_clf_cs != '' |
67 | 84 | - elasticsearch_clf_cs != None and clusterlogging_clf_cs != None |
68 | | - - clo_version | float <= 5.8 |
| 85 | + - clo_version | float < 5.9 |
69 | 86 |
|
70 | | -- name: Create ImageContentSourcePolicy and CatalogSource for CLO greater than 5.8 |
| 87 | +- name: Create ImageContentSourcePolicy and CatalogSource for CLO greater than or equal to 5.9 |
71 | 88 | block: |
72 | 89 | - name: Create CatalogSource |
73 | 90 | template: |
|
76 | 93 |
|
77 | 94 | - name: Run ImageContentSourcePolicy |
78 | 95 | shell: oc apply -f "{{ role_path }}/files/ImageContentSourcePolicy.yml" |
| 96 | + when: ocp_version | float < 4.13 |
| 97 | + |
| 98 | + - name: Create ImageDigestMirrorSet |
| 99 | + template: |
| 100 | + src: "{{ role_path }}/templates/idms.yaml.j2" |
| 101 | + dest: "{{ role_path }}/files/ImageDigestMirrorSet.yaml" |
| 102 | + |
| 103 | + - name: Run ImageDigestMirrorSet |
| 104 | + include_tasks: "{{ role_path }}/files/ImageDigestMirrorSet.yaml" |
| 105 | + when: ocp_version | float >= 4.13 |
79 | 106 |
|
80 | 107 | - name: Run CatalogSource |
81 | 108 | shell: oc apply -f "{{ role_path }}/files/NewCatalogSource.yml" |
|
105 | 132 | shell: oc get ImageContentSourcePolicy | grep brew-registry | wc -l |
106 | 133 | register: icsp |
107 | 134 |
|
| 135 | + - name: Check if the ImageDigestMirrorSet exists |
| 136 | + shell: oc get ImageDigestMirrorSet | grep fbc-clo-testing-idms | wc -l |
| 137 | + register: idms |
| 138 | + |
108 | 139 | - name: Check if the CatalogSource exists |
109 | 140 | shell: oc get CatalogSource -n openshift-marketplace | grep "cluster-logging\|elasticsearch" |wc -l |
110 | 141 | register: output |
|
119 | 150 | shell: oc delete ImageContentSourcePolicy brew-registry |
120 | 151 | when: icsp.stdout|int == 1 |
121 | 152 |
|
| 153 | + - name: Delete ImageDigestMirrorSet if it exists |
| 154 | + shell: oc delete ImageDigestMirrorSet fbc-clo-testing-idms |
| 155 | + when: idms.stdout|int == 1 |
| 156 | + |
122 | 157 | - name: Delete CatalogSource if it exists |
123 | 158 | shell: oc delete CatalogSource elasticsearch cluster-logging -n openshift-marketplace |
124 | 159 | when: |
|
0 commit comments