Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Commit cb96654

Browse files
committed
Bump up the OLM version, break out CS install, and sourceNS
Apparently, recent version of OLM require the sourceNamespace field in the Subscription. Who knew? Because we now need it, we determine the correct OLM namespace a little differently. We also detect OCP4 differently since some clusters seem to error when we try to get its api-resources
1 parent f6e453f commit cb96654

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

etc/scripts/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ source "$DIR/installation-functions.sh"
2626

2727
enable_admission_webhooks
2828
install_olm
29+
install_catalogsources
2930
install_istio
3031
install_knative_build
3132
install_knative_serving

etc/scripts/installation-functions.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ function show_server {
3838
fi
3939
}
4040

41+
function olm_namespace {
42+
$CMD get pods --all-namespaces | grep catalog-operator | awk '{print $1}'
43+
}
44+
4145
function check_minishift {
4246
(hash minishift &&
4347
minishift ip | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" &&
@@ -53,7 +57,7 @@ function check_minikube {
5357
}
5458

5559
function check_openshift_4 {
56-
$CMD api-resources | grep machineconfigs | grep machineconfiguration.openshift.io > /dev/null 2>&1
60+
($CMD get ns openshift && $CMD version | tail -1 | grep "v1.12") >/dev/null 2>&1
5761
}
5862

5963
function check_operatorgroups {
@@ -142,12 +146,10 @@ function enable_admission_webhooks {
142146

143147
function install_olm {
144148
local ROOT_DIR="$INSTALL_SCRIPT_DIR/../.."
145-
local OLM_NS="operator-lifecycle-manager"
146149
if check_openshift_4; then
147150
echo "Detected OpenShift 4 - skipping OLM installation."
148-
OLM_NS="openshift-operator-lifecycle-manager"
149-
elif $CMD get ns "$OLM_NS" 2>/dev/null; then
150-
echo "Detected OpenShift 3 with OLM already installed."
151+
elif $CMD get ns "operator-lifecycle-manager" 2>/dev/null; then
152+
echo "Detected OpenShift 3 with an older OLM already installed."
151153
# we'll assume this is v3.11.0, which doesn't support
152154
# OperatorGroups, or ClusterRoles in the CSV, so...
153155
oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:istio-operator:istio-operator
@@ -160,18 +162,21 @@ function install_olm {
160162
mkdir -p "$REPO_DIR"
161163
rm -rf "$OLM_DIR"
162164
git clone https://github.com/operator-framework/operator-lifecycle-manager "$OLM_DIR"
163-
pushd $OLM_DIR; git checkout eaf605cca864e; popd
165+
pushd $OLM_DIR; git checkout f474ec872ca7b1dd; popd
164166
for i in "$OLM_DIR"/deploy/okd/manifests/latest/*.crd.yaml; do $CMD apply -f $i; done
165167
for i in $(find "$OLM_DIR/deploy/okd/manifests/latest/" -type f ! -name "*crd.yaml" | sort); do $CMD create -f $i; done
166168
wait_for_all_pods openshift-operator-lifecycle-manager
167169
# perms required by the OLM console: $OLM_DIR/scripts/run_console_local.sh
168170
# oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:kube-system:default
169-
# check our namespace
170-
OLM_NS=$(grep "catalog_namespace:" "$OLM_DIR/deploy/okd/values.yaml" | awk '{print $2}')
171171
fi
172-
# and finally apply the catalog sources
172+
}
173+
174+
function install_catalogsources {
175+
local ROOT_DIR="$INSTALL_SCRIPT_DIR/../.."
176+
local OLM_NS=$(olm_namespace)
173177
$CMD apply -f "$ROOT_DIR/knative-operators.catalogsource.yaml" -n "$OLM_NS"
174178
$CMD apply -f "$ROOT_DIR/maistra-operators.catalogsource.yaml" -n "$OLM_NS"
179+
wait_for_all_pods "$OLM_NS"
175180
}
176181

177182
function install_istio {
@@ -201,6 +206,7 @@ function install_istio {
201206
channel: alpha
202207
name: maistra
203208
source: maistra-operators
209+
sourceNamespace: $(olm_namespace)
204210
EOF
205211
wait_for_all_pods istio-operator
206212

@@ -256,6 +262,7 @@ function install_knative_build {
256262
namespace: knative-build
257263
spec:
258264
source: knative-operators
265+
sourceNamespace: $(olm_namespace)
259266
name: knative-build
260267
startingCSV: knative-build.${KNATIVE_BUILD_VERSION}
261268
channel: alpha
@@ -282,6 +289,7 @@ function install_knative_serving {
282289
namespace: knative-serving
283290
spec:
284291
source: knative-operators
292+
sourceNamespace: $(olm_namespace)
285293
name: knative-serving
286294
startingCSV: knative-serving.${KNATIVE_SERVING_VERSION}
287295
channel: alpha
@@ -308,6 +316,7 @@ function install_knative_eventing {
308316
namespace: knative-eventing
309317
spec:
310318
source: knative-operators
319+
sourceNamespace: $(olm_namespace)
311320
name: knative-eventing
312321
startingCSV: knative-eventing.${KNATIVE_EVENTING_VERSION}
313322
channel: alpha

0 commit comments

Comments
 (0)