Skip to content

Commit 877a43c

Browse files
author
jmccormick2001
committed
update quickstart.sh script to look for env vars
1 parent 8849702 commit 877a43c

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

examples/quickstart.sh

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414
# limitations under the License.
1515

1616
LOG="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
1926
echo -n "Which Operator version do you want to install? ["$CO_VERSION"]"
2027
read REPLY
2128
if [[ "$REPLY" != "" ]]; then
@@ -24,7 +31,7 @@ if [[ "$REPLY" != "" ]]; then
2431
fi
2532
echo $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]"
2835
read REPLY
2936
case $REPLY in
3037
kube)
@@ -36,36 +43,35 @@ ocp)
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
;;
4249
esac
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)"
4552
read REPLY
4653
case $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
;;
5966
esac
6067

61-
echo -n "enter operator image prefix [crunchydata]"
68+
echo -n "enter operator image prefix ["$CO_IMAGE_PREFIX"]"
6269
read REPLY
6370
if [[ "$REPLY" != "" ]]; then
6471
echo "setting CO_IMAGE_PREFIX="$REPLY
6572
export CO_IMAGE_PREFIX=$REPLY
6673
else
67-
echo "setting CO_IMAGE_PREFIX to crunchydata"
68-
export CO_IMAGE_PREFIX=crunchydata
74+
echo "setting CO_IMAGE_PREFIX to " $CO_IMAGE_PREFIX
6975
fi
7076
echo "user has entered "$CO_IMAGE_PREFIX " for the operator image prefix"| tee -a $LOG
7177

@@ -88,11 +94,11 @@ echo ""
8894
case $CO_CMD in
8995
kubectl)
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
;;
9399
oc)
94100
$CO_CMD project
95-
export NAMESPACE=`eval $CO_CMD project -q`
101+
export CO_NAMESPACE=`eval $CO_CMD project -q`
96102
;;
97103
esac
98104
if [[ $? -ne 0 ]]; then
@@ -103,7 +109,7 @@ fi
103109
echo "Connected to cluster" | tee -a $LOG
104110
echo ""
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

108114
echo -n "Do you want to continue the installation? [Yn] "
109115
read REPLY
@@ -179,8 +185,8 @@ cp $COROOT/examples/pgo.yaml.storageclass $COROOT/conf/apiserver/pgo.yaml
179185
sed --in-place=.bak 's/standard/'"$STORAGE_CLASS"'/' $COROOT/conf/apiserver/pgo.yaml
180186
sed --in-place=.bak 's/crunchydata/'"$CO_IMAGE_PREFIX"'/' $COROOT/conf/apiserver/pgo.yaml
181187
sed --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

185191
echo ""
186192
echo "Setting up pgo client authentication..." | tee -a $LOG
@@ -207,7 +213,7 @@ echo "execute the following command..." | tee -a $LOG
207213

208214
echo ""
209215
echo "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
211217
echo "export PATH=$PATH:$HOME/odev/bin" | tee -a $LOG
212218
echo "$COROOT/deploy/install-rbac.sh" | tee -a $LOG
213219

0 commit comments

Comments
 (0)