@@ -26,7 +26,17 @@ function wait_for_all_pods {
2626}
2727
2828function check_minishift {
29- (hash minishift && oc whoami --show-server | grep " $( minishift ip) " ) > /dev/null 2>&1
29+ (hash minishift &&
30+ minishift ip | grep -oE " \b([0-9]{1,3}\.){3}[0-9]{1,3}\b" &&
31+ oc whoami --show-server | grep " $( minishift ip) "
32+ ) > /dev/null 2>&1
33+ }
34+
35+ function check_minikube {
36+ (hash minikube &&
37+ minikube ip | grep -oE " \b([0-9]{1,3}\.){3}[0-9]{1,3}\b" &&
38+ oc whoami --show-server | grep " $( minikube ip) "
39+ ) > /dev/null 2>&1
3040}
3141
3242function check_openshift_4 {
@@ -40,6 +50,8 @@ function check_operatorgroups {
4050function enable_admission_webhooks {
4151 if check_openshift_4; then
4252 echo " Detected OpenShift 4 - skipping enabling admission webhooks."
53+ elif check_minikube; then
54+ echo " Detected minikube - skipping enabling admission webhooks."
4355 elif check_minishift; then
4456 echo " Detected minishift - checking if admission webhooks are enabled."
4557 if ! minishift openshift config view --target=kube | grep ValidatingAdmissionWebhook > /dev/null; then
@@ -121,7 +133,7 @@ function install_olm {
121133 if check_openshift_4; then
122134 echo " Detected OpenShift 4 - skipping OLM installation."
123135 OLM_NS=" openshift-operator-lifecycle-manager"
124- elif oc get ns " $OLM_NS " ; then
136+ elif oc get ns " $OLM_NS " 2> /dev/null ; then
125137 echo " Detected OpenShift 3 with OLM already installed."
126138 # we'll assume this is v3.11.0, which doesn't support
127139 # OperatorGroups, or ClusterRoles in the CSV, so...
@@ -150,18 +162,23 @@ function install_olm {
150162}
151163
152164function install_istio {
153- # istio
154- oc create ns istio-operator
155- if check_operatorgroups; then
156- cat << -EOF | oc apply -f -
165+ if check_minikube; then
166+ echo " Detected minikube - incompatible with Maistra operator, so installing upstream istio."
167+ oc apply -f " https://github.com/knative/serving/releases/download/${KNATIVE_SERVING_VERSION} /istio.yaml"
168+ oc label namespace default istio-injection=enabled
169+ wait_for_all_pods istio-system
170+ else
171+ oc create ns istio-operator
172+ if check_operatorgroups; then
173+ cat << -EOF | oc apply -f -
157174 apiVersion: operators.coreos.com/v1alpha2
158175 kind: OperatorGroup
159176 metadata:
160177 name: istio-operator
161178 namespace: istio-operator
162179 EOF
163- fi
164- cat << -EOF | oc apply -f -
180+ fi
181+ cat << -EOF | oc apply -f -
165182 apiVersion: operators.coreos.com/v1alpha1
166183 kind: Subscription
167184 metadata:
@@ -172,9 +189,9 @@ function install_istio {
172189 name: maistra
173190 source: maistra-operators
174191 EOF
175- wait_for_all_pods istio-operator
192+ wait_for_all_pods istio-operator
176193
177- cat << -EOF | oc apply -f -
194+ cat << -EOF | oc apply -f -
178195 apiVersion: istio.openshift.com/v1alpha1
179196 kind: Installation
180197 metadata:
@@ -191,18 +208,19 @@ function install_istio {
191208 prefix: kiali/
192209 version: v0.7.1
193210 EOF
194- timeout 900 ' oc get pods -n istio-system && [[ $(oc get pods -n istio-system | grep openshift-ansible-istio-installer | grep -c Completed) -eq 0 ]]'
211+ timeout 900 ' oc get pods -n istio-system && [[ $(oc get pods -n istio-system | grep openshift-ansible-istio-installer | grep -c Completed) -eq 0 ]]'
195212
196- # Scale down unused services deployed by the istio operator. The
197- # jaeger pods will fail anyway due to the elasticsearch pod failing
198- # due to "max virtual memory areas vm.max_map_count [65530] is too
199- # low, increase to at least [262144]" which could be mitigated on
200- # minishift with:
201- # minishift ssh "echo 'echo vm.max_map_count = 262144 >/etc/sysctl.d/99-elasticsearch.conf' | sudo sh"
202- oc scale -n istio-system --replicas=0 deployment/grafana
203- oc scale -n istio-system --replicas=0 deployment/jaeger-collector
204- oc scale -n istio-system --replicas=0 deployment/jaeger-query
205- oc scale -n istio-system --replicas=0 statefulset/elasticsearch
213+ # Scale down unused services deployed by the istio operator. The
214+ # jaeger pods will fail anyway due to the elasticsearch pod failing
215+ # due to "max virtual memory areas vm.max_map_count [65530] is too
216+ # low, increase to at least [262144]" which could be mitigated on
217+ # minishift with:
218+ # minishift ssh "echo 'echo vm.max_map_count = 262144 >/etc/sysctl.d/99-elasticsearch.conf' | sudo sh"
219+ oc scale -n istio-system --replicas=0 deployment/grafana
220+ oc scale -n istio-system --replicas=0 deployment/jaeger-collector
221+ oc scale -n istio-system --replicas=0 deployment/jaeger-query
222+ oc scale -n istio-system --replicas=0 statefulset/elasticsearch
223+ fi
206224}
207225
208226function install_knative_build {
0 commit comments