1414# limitations under the License.
1515
1616LOG=" pgo-installer.log"
17+ if [[ " $CO_VERSION " != " " ]]; then
18+ echo " CO_VERSION is set to " $CO_VERSION
19+ else
20+ export CO_VERSION=3.2.0-rc5
21+ fi
22+ if [[ " $CO_NAMESPACE " != " " ]]; then
23+ echo " CO_NAMESPACE is set to " $CO_NAMESPACE
24+ fi
1725
18- export CO_VERSION=3.2.0-rc3
1926echo -n " Which Operator version do you want to install? [" $CO_VERSION " ]"
2027read REPLY
2128if [[ " $REPLY " != " " ]]; then
@@ -24,7 +31,7 @@ if [[ "$REPLY" != "" ]]; then
2431fi
2532echo $CO_VERSION is the version entered | tee -a $LOG
2633
27- echo -n " Is this a 'kube' install or an 'ocp' install?"
34+ echo -n " Is this a 'kube' install or an 'ocp' install?[kube] "
2835read REPLY
2936case $REPLY in
3037kube)
3643 export CO_CMD=oc
3744 ;;
3845* )
39- echo " user has entered an invalid install type "
40- exit 2
46+ echo " user has selected a kube install" | tee -a $LOG
47+ export CO_CMD=kubectl
4148 ;;
4249esac
4350
44- echo -n " use centos or rhel based images?, NOTE: rhel images available only to crunchy customers)"
51+ echo -n " use centos7 or rhel7 based images?[centos7] , NOTE: rhel images available only to crunchy customers)"
4552read REPLY
4653case $REPLY in
47- centos )
54+ centos7 )
4855 echo " user has selected centos images" | tee -a $LOG
4956 export CO_BASEOS=centos7
5057 ;;
51- rhel )
58+ rhel7 )
5259 echo " user has selected rhel images" | tee -a $LOG
5360 export CO_BASEOS=rhel7
5461 ;;
5562* )
56- echo " user has entered an invalid image type "
57- exit 2
63+ echo " user has selected centos images " | tee -a $LOG
64+ export CO_BASEOS=centos7
5865 ;;
5966esac
6067
61- echo -n " enter operator image prefix [crunchydata ]"
68+ echo -n " enter operator image prefix [" $CO_IMAGE_PREFIX " ]"
6269read REPLY
6370if [[ " $REPLY " != " " ]]; then
6471 echo " setting CO_IMAGE_PREFIX=" $REPLY
6572 export CO_IMAGE_PREFIX=$REPLY
6673else
67- echo " setting CO_IMAGE_PREFIX to crunchydata"
68- export CO_IMAGE_PREFIX=crunchydata
74+ echo " setting CO_IMAGE_PREFIX to " $CO_IMAGE_PREFIX
6975fi
7076echo " user has entered " $CO_IMAGE_PREFIX " for the operator image prefix" | tee -a $LOG
7177
@@ -88,11 +94,11 @@ echo ""
8894case $CO_CMD in
8995kubectl)
9096$CO_CMD get namespaces
91- $NAMESPACE =` $CO_CMD config view | grep namespace:`
97+ export CO_NAMESPACE =` $CO_CMD config view | grep namespace:| cut -f2 -d ' : ' | cut -f2 -d ' ' `
9298 ;;
9399oc)
94100$CO_CMD project
95- export NAMESPACE =` eval $CO_CMD project -q`
101+ export CO_NAMESPACE =` eval $CO_CMD project -q`
96102 ;;
97103esac
98104if [[ $? -ne 0 ]]; then
103109echo " Connected to cluster" | tee -a $LOG
104110echo " "
105111
106- echo " The postgres-operator will be installed into the current namespace which is [" $NAMESPACE " ]."
112+ echo " The postgres-operator will be installed into the current namespace which is [" $CO_NAMESPACE " ]."
107113
108114echo -n " Do you want to continue the installation? [Yn] "
109115read REPLY
@@ -179,8 +185,8 @@ cp $COROOT/examples/pgo.yaml.storageclass $COROOT/conf/apiserver/pgo.yaml
179185sed --in-place=.bak ' s/standard/' " $STORAGE_CLASS " ' /' $COROOT /conf/apiserver/pgo.yaml
180186sed --in-place=.bak ' s/crunchydata/' " $CO_IMAGE_PREFIX " ' /' $COROOT /conf/apiserver/pgo.yaml
181187sed --in-place=.bak ' s/centos7/' " $CO_BASEOS " ' /' $COROOT /conf/apiserver/pgo.yaml
182- sed --in-place=.bak ' s/demo/' " $NAMESPACE " ' /' $COROOT /deploy/cluster-rbac.yaml
183- sed --in-place=.bak ' s/demo/' " $NAMESPACE " ' /' $COROOT /deploy/rbac.yaml
188+ sed --in-place=.bak ' s/demo/' " $CO_NAMESPACE " ' /' $COROOT /deploy/cluster-rbac.yaml
189+ sed --in-place=.bak ' s/demo/' " $CO_NAMESPACE " ' /' $COROOT /deploy/rbac.yaml
184190
185191echo " "
186192echo " Setting up pgo client authentication..." | tee -a $LOG
@@ -207,7 +213,7 @@ echo "execute the following command..." | tee -a $LOG
207213
208214echo " "
209215echo " export CO_CMD=" $CO_CMD | tee -a $LOG
210- echo " export CO_NAMESPACE=" $NAMESPACE | tee -a $LOG
216+ echo " export CO_NAMESPACE=" $CO_NAMESPACE | tee -a $LOG
211217echo " export PATH=$PATH :$HOME /odev/bin" | tee -a $LOG
212218echo " $COROOT /deploy/install-rbac.sh" | tee -a $LOG
213219
0 commit comments