Skip to content

Commit

Permalink
Adjust sed command to work with Darwin and Linux platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
chirangaalwis authored and DilanUA committed May 24, 2019
1 parent e4aa80a commit bee88de
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 28 deletions.
54 changes: 38 additions & 16 deletions advanced/is-with-analytics/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,44 @@ if [[ ${REPLY} =~ ^[Yy]$ ]]; then
exit 1
fi

if ! ${SED} -i.bak -e '/serviceAccount/a \ imagePullSecrets:' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \ - name: wso2creds' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi
case "`uname`" in
Darwin*)
if ! ${SED} -i.bak -e '/serviceAccount/a \
\ imagePullSecrets:' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \
\ - name: wso2creds' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi;;
*)
if ! ${SED} -i.bak -e '/serviceAccount/a \ imagePullSecrets:' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \ - name: wso2creds' \
../is/identity-server-deployment.yaml \
../is-analytics-dashboard/identity-server-analytics-dashboard-deployment.yaml \
../is-analytics-worker/identity-server-analytics-worker-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi
esac
fi
elif [[ ${REPLY} =~ ^[Nn]$ || -z "${REPLY}" ]]; then
HAS_SUBSCRIPTION=1
Expand Down
4 changes: 3 additions & 1 deletion advanced/is/identity-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
spec:
containers:
- name: wso2is
image: wso2/wso2is:5.8.0
image: docker.wso2.com/wso2is:5.8.0
livenessProbe:
exec:
command:
Expand Down Expand Up @@ -74,6 +74,8 @@ spec:
- name: shared-tenants-persistent-disk
mountPath: /home/wso2carbon/wso2is-5.8.0/repository/tenants
serviceAccountName: "wso2svc-account"
imagePullSecrets:
- name: wso2creds
volumes:
- name: identity-server-conf
configMap:
Expand Down
38 changes: 27 additions & 11 deletions advanced/is/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function echoBold () {
${ECHO} -e $'\e[1m'"${1}"$'\e[0m'
}

read -p "Do you have a WSO2 Subscription? (Y/N)" -n 1 -r
read -p "Do you have a WSO2 Subscription? (y/N)" -n 1 -r
${ECHO}

if [[ ${REPLY} =~ ^[Yy]$ ]]; then
Expand All @@ -47,16 +47,32 @@ if [[ ${REPLY} =~ ^[Yy]$ ]]; then
exit 1
fi

if ! ${SED} -i.bak -e '/serviceAccount/a \ imagePullSecrets:' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \ - name: wso2creds' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi
case "`uname`" in
Darwin*)
if ! ${SED} -i.bak -e '/serviceAccount/a \
\ imagePullSecrets:' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \
\ - name: wso2creds' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi;;
*)
if ! ${SED} -i.bak -e '/serviceAccount/a \ imagePullSecrets:' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create \"imagePullSecrets:\" attribute"
exit 1
fi


if ! ${SED} -i.bak -e '/imagePullSecrets/a \ - name: wso2creds' ../identity-server-deployment.yaml; then
echoBold "Could not configure Kubernetes Docker image pull secret: Failed to create secret name"
exit 1
fi;;
esac
fi
elif [[ ${REPLY} =~ ^[Nn]$ || -z "${REPLY}" ]]; then
HAS_SUBSCRIPTION=1
Expand Down

0 comments on commit bee88de

Please sign in to comment.