diff options
Diffstat (limited to 'tools/kubernetes/helm-tools.sh')
-rw-r--r-- | tools/kubernetes/helm-tools.sh | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tools/kubernetes/helm-tools.sh b/tools/kubernetes/helm-tools.sh index a28b340..fff9a4d 100644 --- a/tools/kubernetes/helm-tools.sh +++ b/tools/kubernetes/helm-tools.sh @@ -39,13 +39,16 @@ function log() { function setup_helm() { log "Setup helm" # Install Helm + # per https://github.com/kubernetes/helm/blob/master/docs/install.md cd ~ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh chmod 700 get_helm.sh ./get_helm.sh + log "Initialize helm" helm init - nohup helm serve > /dev/null 2>&1 & - helm repo update +# nohup helm serve > /dev/null 2>&1 & +# log "Run helm repo update" +# helm repo update # TODO: Workaround for bug https://github.com/kubernetes/helm/issues/2224 # For testing use only! kubectl create clusterrolebinding permissive-binding \ @@ -69,15 +72,17 @@ function setup_helm() { function wait_for_service() { log "Waiting for service $1 to be available" - pod=$(kubectl get pods --namespace default | awk "/$1/ { print \$1 }") - log "Service $1 is at pod $pod" - ready=$(kubectl get pods --namespace default -o jsonpath='{.status.containerStatuses[0].ready}' $pod) - while [[ "$ready" != "true" ]]; do - log "pod $1 is not yet ready... waiting 10 seconds" + pods=$(kubectl get pods --namespace default | awk "/$1/ { print \$1 }") + log "Service $1 is at pod(s) $pods" + ready="false" + while [[ "$ready" != "true" ]] ; do + log "Waiting 10 seconds to check pod status" sleep 10 - # TODO: figure out why transient pods sometimes mess up this logic, thus need to re-get the pods - pod=$(kubectl get pods --namespace default | awk "/$1/ { print \$1 }") - ready=$(kubectl get pods --namespace default -o jsonpath='{.status.containerStatuses[0].ready}' $pod) + for pod in $pods ; do + rdy=$(kubectl get pods --namespace default -o jsonpath='{.status.containerStatuses[0].ready}' $pod) + log "pod $pod is ready: $rdy" + if [[ "$rdy" == "true" ]]; then ready="true"; fi + done done log "pod $pod is ready" host_ip=$(kubectl get pods --namespace default -o jsonpath='{.status.hostIP}' $pod) |