Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 42abcad

Browse files
fixes to deploy-all.sh (#1746)
1 parent e8611da commit 42abcad

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

deploy/k8s/helm/deploy-all.sh

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Parameters:
4343
The Docker username used to logon to the custom registry, supplied using the -r parameter.
4444
--use-local-k8s
4545
Deploy to a locally installed Kubernetes (default: false).
46+
--use-mesh
47+
Use Linkerd as service mesh
48+
--image-pull-policy <policy>
49+
Image Pull Policy: Always, IfNotPresent, Never (default: Always)
4650
4751
It is assumed that the Kubernetes cluster has been granted access to the container registry.
4852
If using AKS and ACR see link for more info:
@@ -72,6 +76,9 @@ push_images=''
7276
skip_infrastructure=''
7377
use_local_k8s=''
7478
namespace='eshop'
79+
use_mesh='false'
80+
ingressMeshAnnotationsFile='ingress_values_linkerd.yaml'
81+
imagePullPolicy='Always'
7582

7683
while [[ $# -gt 0 ]]; do
7784
case "$1" in
@@ -107,12 +114,21 @@ while [[ $# -gt 0 ]]; do
107114
use_local_k8s='yes'; shift ;;
108115
--namespace )
109116
namespace="$2"; shift 2;;
117+
--use-mesh )
118+
use_mesh='true'; shift ;;
119+
--image-pull-policy )
120+
imagePullPolicy="$2"; shift 2;;
110121
*)
111122
echo "Unknown option $1"
112123
usage; exit 2 ;;
113124
esac
114125
done
115126

127+
if [[ $imagePullPolicy != "Always" && $imagePullPolicy != "Never" && $imagePullPolicy != "IfNotPresent" ]]; then
128+
echo "--image-pull-policy needs to be a valid value: Always, IfNotPresent, Never"
129+
usage; exit 2;
130+
fi
131+
116132
if [[ $build_solution ]]; then
117133
echo "#################### Building $app_name solution ####################"
118134
dotnet publish -o obj/Docker/publish ../../eShopOnContainers-ServicesAndWebApps.sln
@@ -201,32 +217,39 @@ if [[ $clean ]]; then
201217
if [[ -z $(helm ls -q --namespace $namespace) ]]; then
202218
echo "No previous releases found"
203219
else
204-
helm uninstall $(helm ls -q --namespace $namespace)
220+
helm --namespace $namespace uninstall $(helm ls -q --namespace $namespace)
205221
echo "Previous releases deleted"
206222
waitsecs=10; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done
207223
fi
208224
fi
209225

210226
echo "#################### Begin $app_name installation using Helm ####################"
211227
infras=(sql-data nosql-data rabbitmq keystore-data basket-data)
212-
charts=(eshop-common apigwms apigwws basket-api catalog-api identity-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web)
228+
charts=(eshop-common basket-api catalog-api identity-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web)
229+
gateways=(apigwms apigwws)
213230

214231
if [[ !$skip_infrastructure ]]; then
215232
for infra in "${infras[@]}"
216233
do
217234
echo "Installing infrastructure: $infra"
218-
helm install "$app_name-$infra" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns $infra
235+
helm install "$app_name-$infra" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns $infra --set inf.mesh.enabled=$use_mesh
219236
done
220237
fi
221238

222239
for chart in "${charts[@]}"
223240
do
224241
echo "Installing: $chart"
225-
if [[ $use_custom_registry ]]; then
226-
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
227-
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed
228-
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
242+
if [[ $use_custom_registry ]]; then
243+
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=$imagePullPolicy $chart --set inf.mesh.enabled=$use_mesh
244+
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed
245+
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=$imagePullPolicy $chart --set inf.mesh.enabled=$use_mesh
229246
fi
230247
done
231248

232-
echo "FINISHED: Helm charts installed."
249+
for gw in "${gateways[@]}"
250+
do
251+
echo "Installing gateway: $gw"
252+
helm install "$app_name-$gw" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.pullPolicy=$imagePullPolicy $gw
253+
done
254+
255+
echo "FINISHED: Helm charts installed."

0 commit comments

Comments
 (0)