@@ -164,7 +164,7 @@ function waitForIngressPod() {
164164 ns=$2
165165
166166 printInfo " Wait until ${type} ingress controller pod is running."
167- ipod=$( ${kubernetesCli} -o name get po -n ${ns} )
167+ ipod=$( ${kubernetesCli} -o name get po -n ${ns} | grep -v admission-patch )
168168 if [[ " ${ipod} " != * $chart * ]]; then
169169 printError " Couldn't find the pod associated with ${type} helm deployment. List helm deployment status on namespace [${ns} ]. "
170170 helm list -n ${ns}
@@ -229,6 +229,26 @@ function createVoyager() {
229229 exit 0;
230230 fi
231231
232+ max=20
233+ count=0
234+ printInfo " Checking availability of voyager deployment [${chart} ]"
235+ while test $count -lt $max ; do
236+ status=$( ${kubernetesCli} get deployment --namespace ${ns} -l " app.kubernetes.io/name=voyager,app.kubernetes.io/instance=${chart} " --no-headers 2> /dev/null | awk ' {print $2}' || true)
237+ if [ " ${status} " == " 1/1" ]; then
238+ echo " "
239+ printInfo " voyager deployment resource [${chart} ] is available now."
240+ ${kubernetesCli} get deployment --namespace ${ns} -l " app.kubernetes.io/name=voyager,app.kubernetes.io/instance=${chart} "
241+ break ;
242+ fi
243+ count=` expr $count + 1`
244+ echo -n " ."
245+ sleep 2
246+ done
247+ if test $count -eq $max ; then
248+ printError " voyager deployment resource can not be created"
249+ exit 1
250+ fi
251+
232252 waitForIngressPod voyager ${ns}
233253
234254 max=20
@@ -293,20 +313,23 @@ function createTraefik() {
293313# Remove ingress related resources from default Namespace ( if any )
294314function purgeDefaultResources() {
295315 printInfo " Remove ingress related resources from default Namespace (if any)"
296- crole=$( ${kubernetesCli} get ClusterRole | grep ${chart} | awk ' {print $1}' )
297- if [ " x${crole} " != " x" ]; then
298- ${kubernetesCli} get ClusterRole | grep ${chart} | awk ' {print $1}' | xargs kubectl delete ClusterRole --ignore-not-found
299- fi
316+ croles=$( ${kubernetesCli} get ClusterRole | grep ${chart} | awk ' {print $1}' )
317+ for crole in ${croles} ; do
318+ printInfo " Deleting ClusterRole ${crole} from default Namespace"
319+ ${kubernetesCli} delete ClusterRole ${crole}
320+ done
300321
301- crb=$( ${kubernetesCli} get ClusterRoleBinding | grep ${chart} | awk ' {print $1}' )
302- if [ x${crb} != " x" ]; then
303- ${kubernetesCli} get ClusterRoleBinding | grep ${chart} | awk ' {print $1}' | xargs kubectl delete ClusterRoleBinding
304- fi
322+ crbs=$( ${kubernetesCli} get ClusterRoleBinding | grep ${chart} | awk ' {print $1}' )
323+ for crb in ${crbs} ; do
324+ printInfo " Deleting ClusterRoleBinding ${crb} from default Namespace"
325+ ${kubernetesCli} delete ClusterRoleBinding ${crb}
326+ done
305327
306- vwc=$( ${kubernetesCli} get ValidatingWebhookConfiguration | grep ${chart} | awk ' {print $1}' )
307- if [ x${vwc} != " x" ]; then
308- ${kubernetesCli} get ValidatingWebhookConfiguration | grep ${chart} | awk ' {print $1}' | xargs kubectl delete ValidatingWebhookConfiguration
309- fi
328+ vwcs=$( ${kubernetesCli} get ValidatingWebhookConfiguration | grep ${chart} | awk ' {print $1}' )
329+ for vwc in ${vwcs} ; do
330+ printInfo " Deleting ValidatingWebhookConfiguration ${vwc} from default Namespace"
331+ ${kubernetesCli} delete ValidatingWebhookConfiguration ${vwc}
332+ done
310333}
311334
312335# Remove voyager related resources from default Namespace ( if any )
@@ -342,7 +365,7 @@ function purgeVoyagerResources() {
342365 ${kubernetesCli} delete ClusterRole/${chart} --ignore-not-found
343366 ${kubernetesCli} delete ClusterRoleBinding/${chart} --ignore-not-found
344367 ${kubernetesCli} delete ClusterRoleBinding/${chart} -apiserver-auth-delegator --ignore-not-found
345- kubectl delete RoleBinding/${chart} -apiserver-extension-server-authentication-reader -n kube-system --ignore-not-found
368+ ${kubernetesCli} delete RoleBinding/${chart} -apiserver-extension-server-authentication-reader -n kube-system --ignore-not-found
346369}
347370
348371function deleteIngress() {
0 commit comments