diff --git a/dist/openshift/cincinnati-e2e.yaml b/dist/openshift/cincinnati-e2e.yaml index 5471fc2b0..df4ff7fe3 100644 --- a/dist/openshift/cincinnati-e2e.yaml +++ b/dist/openshift/cincinnati-e2e.yaml @@ -10,7 +10,9 @@ objects: name: openshift-update-service annotations: olm.providedAPIs: '' - spec: {} + spec: + targetNamespaces: + - "${NAMESPACE}" - apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: @@ -36,6 +38,8 @@ objects: releases: quay.io/openshift-release-dev/ocp-release replicas: ${{REPLICAS}} parameters: + - name: NAMESPACE + value: "openshift-update-service" - name: IMAGE value: "quay.io/app-sre/cincinnati" displayName: cincinnati image diff --git a/hack/e2e.sh b/hack/e2e.sh index d1af2103a..f3fec55c2 100755 --- a/hack/e2e.sh +++ b/hack/e2e.sh @@ -102,8 +102,11 @@ export GRAPH_SOURCE="${GRAPHDATA_IMAGE:-quay.io/openshift-ota/cincinnati-graph-d echo "GRAPHDATA_IMAGE=${GRAPH_SOURCE}" +NAMESPACE="openshift-update-service" + # Render the template and apply subscription/operand oc process -f dist/openshift/cincinnati-e2e.yaml \ + -p NAMESPACE="${NAMESPACE}" \ -p IMAGE="${IMAGE}" \ -p IMAGE_TAG="${IMAGE_TAG}" \ -p GRAPHDATA_IMAGE="${GRAPH_SOURCE}" \ @@ -126,8 +129,13 @@ backoff oc -n openshift-update-service wait --for=condition=Ready pod -l app=e2e } # Expose services -PE_URL=$(oc get route e2e-policy-engine-route -o jsonpath='{.spec.host}') -export GRAPH_URL="https://${PE_URL}/api/upgrades_info/graph" +while sleep 1; +do + PE_URL=$(oc -n "${NAMESPACE}" get -o jsonpath='{.status.policyEngineURI}' updateservice "e2e"); + SCHEME="${PE_URL%%:*}"; + if test "${SCHEME}" = http -o "${SCHEME}" = https; then break; fi; +done +export GRAPH_URL="${PE_URL}/api/upgrades_info/graph" # Wait for route to become available backoff test "$(curl -ks -o /dev/null -w "%{http_code}" --header 'Accept:application/json' "${GRAPH_URL}?channel=a")" = "200" @@ -139,12 +147,27 @@ PROM_ROUTE=$(oc -n openshift-monitoring get route thanos-querier -o jsonpath="{. export PROM_ENDPOINT="https://${PROM_ROUTE}" echo "Using Prometheus endpoint ${PROM_ENDPOINT}" -export PROM_TOKEN=$(oc -n openshift-monitoring get secret \ - $(oc -n openshift-monitoring get serviceaccount prometheus-k8s \ - -o jsonpath='{range .secrets[*]}{.name}{"\n"}{end}' | grep prometheus-k8s-token) \ - -o go-template='{{.data.token | base64decode}}') + +# create a prometheus secret based token manually. this is required for clusters >= OCP 4.11 +oc apply -f - <