Skip to content

Commit 4cbb736

Browse files
committed
Make CLO install channel change resilient
Cluster Logging Operator keeps changing the list of available channels. On OCP version 4.19 stable-6.1 is not available anymore, while on 4.16 stable-6.3 is not available. This patch probes the operator manifest to grab the latest available channel and use that to install CLO.
1 parent ebb79d2 commit 4cbb736

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

applications/openshift/api-server/audit_log_forwarding_enabled/tests/ocp4/e2e-remediation.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
#!/bin/bash
22
set -xe
33

4-
ocp_version=$(oc version -ojson | jq -r '.openshiftVersion')
5-
clo_v6_available_from="4.14.0"
4+
export CLO_CHANNEL=$(oc get packagemanifest -o jsonpath='{range .status.channels[*]}{.name}{"\n"}{end}' -n openshift-marketplace cluster-logging | sort | tail -1)
65

7-
if [ "$(printf '%s\n' "$ocp_version" "$clo_v6_available_from" | sort -V | head -n1)" = "$clo_v6_available_from" ]; then
6+
if [ "${CLO_CHANNEL}" =~ stable-6\.* ]; then
87
echo "OCP ${ocp_version} has CLO 6.0 is available for install";
98
install_v6=true
109
fi
1110

11+
echo "installing cluster-logging-operator from channel ${CLO_CHANNEL}"
1212
if [ "$install_v6" = true ] ; then
13-
echo "installing cluster-logging-operator V6.0"
14-
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install-observability.yaml
13+
envsubst < <(cat ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install-observability.yaml) | oc apply -f
1514
else
16-
echo "installing cluster-logging-operator"
17-
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install.yaml
15+
envsusbst < <(cat ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install.yaml) | oc apply -f
1816
fi
1917

2018
sleep 30

applications/openshift/api-server/audit_log_forwarding_enabled_logging_api/tests/ocp4/e2e-remediation.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
22
set -xe
33

4-
echo "installing cluster-logging-operator"
5-
oc apply -f ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install.yaml
4+
export CLO_CHANNEL=$(oc get packagemanifest -o jsonpath='{range .status.channels[*]}{.name}{"\n"}{end}' -n openshift-marketplace cluster-logging | sort | tail -1)
5+
6+
echo "installing cluster-logging-operator from channel ${CLO_CHANNEL}"
7+
envsusbst < <(cat ${ROOT_DIR}/ocp-resources/e2e/cluster-logging-install.yaml) | oc apply -f
68

79
sleep 30
810

ocp-resources/e2e/cluster-logging-install-observability.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ metadata:
5050
name: cluster-logging
5151
namespace: openshift-logging
5252
spec:
53-
channel: stable-6.1
53+
channel: ${CLO_CHANNEL}
5454
name: cluster-logging
5555
source: redhat-operators
5656
sourceNamespace: openshift-marketplace

ocp-resources/e2e/cluster-logging-install.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ metadata:
5050
name: cluster-logging
5151
namespace: openshift-logging
5252
spec:
53-
channel: stable
53+
channel: ${CLO_CHANNEL}
5454
name: cluster-logging
5555
source: redhat-operators
5656
sourceNamespace: openshift-marketplace

0 commit comments

Comments
 (0)