This repository has been archived by the owner on Mar 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
/
install-minikube.sh
executable file
·88 lines (57 loc) · 2.88 KB
/
install-minikube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
LATEST="latest"
FABRIC8_VERSION=${1:-${FABRIC8_VERSION-$LATEST}}
if [ "$FABRIC8_VERSION" == "$LATEST" ] || [ "$FABRIC8_VERSION" == "" ] ; then
FABRIC8_VERSION=$(curl -sL http://central.maven.org/maven2/io/fabric8/platform/packages/fabric8-system/maven-metadata.xml | grep '<latest' | cut -f2 -d">"|cut -f1 -d"<")
fi
TEMPLATE="packages/fabric8-system/target/classes/META-INF/fabric8/k8s-template.yml"
if [ "$FABRIC8_VERSION" == "local" ] ; then
echo "Installing using a local build"
else
echo "Installing fabric8 version: ${FABRIC8_VERSION}"
TEMPLATE="http://central.maven.org/maven2/io/fabric8/platform/packages/fabric8-system/${FABRIC8_VERSION}/fabric8-system-${FABRIC8_VERSION}-k8s-template.yml"
fi
echo "Using the fabric8 template: ${TEMPLATE}"
# to disable ANSI color output
export TERM=dumb
PARTS=$(kubectl cluster-info | grep master |sed -e 's/.*http:\/\///g' -e 's/.*https:\/\///g')
IFS=':' read KUBERNETES_SERVICE_HOST KUBERNETES_SERVICE_PORT <<< "$PARTS"
#echo "enabling CORS in minikube"
#minishift openshift config set --patch '{"corsAllowedOrigins": [".*"]}'
#sleep 5
#oc login -u developer -p developer
APISERVER="${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"
NODE_IP="${KUBERNETES_SERVICE_HOST}"
EXPOSER="Ingress"
DOMAIN=$(minikube ip).nip.io
echo "Connecting to the API Server at: https://${APISERVER}"
echo "Using Node IP ${NODE_IP} and Exposer strategy: ${EXPOSER}"
echo "Using github client ID: ${GITHUB_OAUTH_CLIENT_ID} and secret: ${GITHUB_OAUTH_CLIENT_SECRET}"
STORAGECLASS=`kubectl get storageclass -oname`
if [ "$STORAGECLASS" == "" ] ; then
echo "No storageclass is available yet in this cluster!!!"
echo "Please wait for `kubectl get storageclass` to find a storage class!"
exit 1
fi
GITHUB_ID="${GITHUB_OAUTH_CLIENT_ID}"
GITHUB_SECRET="${GITHUB_OAUTH_CLIENT_SECRET}"
ROUTE_USE_PATH="true"
ROUTE_HOST="fabric8.${NODE_IP}.nic.io"
kubectl create namespace developer
kubectl create namespace fabric8
kubectl label node minikube fabric8.io/externalIP=true --overwrite
echo "Applying the fabric8 template ${TEMPLATE}"
oc process --local -f ${TEMPLATE} -p APISERVER_HOSTPORT=${APISERVER} -p NODE_IP=${NODE_IP} -p EXPOSER=${EXPOSER} -p GITHUB_OAUTH_CLIENT_SECRET=${GITHUB_SECRET} -p GITHUB_OAUTH_CLIENT_ID=${GITHUB_ID} -p DOMAIN=${DOMAIN} | kubectl apply -n fabric8 -f -
#oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:fabric8:init-tenant
#oc login -u developer -p developer
# TODO wait for exposecontroller to be ready!!!
echo "Please wait while the pods all startup!"
echo
echo "To watch this happening you can type:"
echo " kubectl get pod -l provider=fabric8 -w"
echo
echo "Or you can watch in the OpenShift console via:"
echo " minikube dashboard"
echo
echo "Then you should be able the open the fabric8 console here:"
echo " http://`kubectl get ingress -n fabric8 --template='{{ (index .spec.rules 0).host}}' fabric8`/"