1- #! /usr/bin/env bash
1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ function wait_for_images {
6+ local DOCKER_REPOSITORY=$1
7+ local GIT_TAG=$2
8+ # Wait for images to be available in the docker repository; ci is the last image built
9+ timeout 15m bash -c " while ! gcloud container images list-tags ${DOCKER_REPOSITORY} /feast-ci --format=json | jq -e \" .[] | select(.tags[] | contains (\\\" ${GIT_TAG} \\\" ))\" > /dev/null; do sleep 10s; done"
10+ }
211
312function k8s_cleanup {
413 local RELEASE=$1
@@ -17,8 +26,12 @@ function k8s_cleanup {
1726
1827 # Set a new postgres password. Note that the postgres instance is not available outside
1928 # the k8s cluster anyway so it doesn't have to be super secure.
20- echo " ${STEP_BREADCRUMB} Setting PG password"
21- PG_PASSWORD=$( head -c 59 /dev/urandom | md5sum | head -c 16)
29+ echo " ${STEP_BREADCRUMB:- } Setting PG password"
30+
31+ # use either shasum or md5sum, whichever exists
32+ SUM=$( which md5sum shasum | grep -v " not found" | tail -n1 || true )
33+
34+ PG_PASSWORD=$( head -c 59 /dev/urandom | $SUM | head -c 16)
2235 kubectl delete secret feast-postgresql -n " $NAMESPACE " || true
2336 kubectl create secret generic feast-postgresql --from-literal=postgresql-password=" $PG_PASSWORD " -n " $NAMESPACE "
2437}
@@ -30,36 +43,34 @@ function helm_install {
3043 # $RELEASE is helm release name
3144 # $DOCKER_REPOSITORY is the docker repo containing feast images tagged with $GIT_TAG
3245 # ... you can pass additional args to this function that are passed on to helm install
46+ # $NAMESPACE is the namespace name
3347
3448 local RELEASE=$1
3549 local DOCKER_REPOSITORY=$2
3650 local GIT_TAG=$3
51+ local NAMESPACE=$4
3752
38- shift 3
39-
40- # Wait for images to be available in the docker repository; ci is the last image built
41- timeout 15m bash -c " while ! gcloud container images list-tags ${DOCKER_REPOSITORY} /feast-ci --format=json | jq -e \" .[] | select(.tags[] | contains (\\\" ${GIT_TAG} \\\" ))\" > /dev/null; do sleep 10s; done"
53+ shift 4
4254
4355 # We skip statsd exporter and other metrics stuff since we're not using it anyway, and it
4456 # has some issues with unbound PVCs (that cause kubectl delete pvc to hang).
45- echo " ${STEP_BREADCRUMB} Helm installing feast"
57+ echo " ${STEP_BREADCRUMB:- } Helm installing feast"
4658
47- if ! time helm install --wait " $RELEASE " infra/charts/feast \
59+ if ! time helm install --wait " $RELEASE " ./ infra/charts/feast \
4860 --timeout 15m \
4961 --set " feast-jupyter.image.repository=${DOCKER_REPOSITORY} /feast-jupyter" \
5062 --set " feast-jupyter.image.tag=${GIT_TAG} " \
5163 --set " feast-online-serving.image.repository=${DOCKER_REPOSITORY} /feast-serving" \
5264 --set " feast-online-serving.image.tag=${GIT_TAG} " \
5365 --set " feast-jobservice.image.repository=${DOCKER_REPOSITORY} /feast-jobservice" \
5466 --set " feast-jobservice.image.tag=${GIT_TAG} " \
55- --set " feast-jobservice.envOverrides.FEAST_AZURE_BLOB_ACCOUNT_NAME=${AZURE_BLOB_ACCOUNT_NAME} " \
56- --set " feast-jobservice.envOverrides.FEAST_AZURE_BLOB_ACCOUNT_ACCESS_KEY=${AZURE_BLOB_ACCOUNT_ACCESS_KEY} " \
5767 --set " feast-core.image.repository=${DOCKER_REPOSITORY} /feast-core" \
5868 --set " feast-core.image.tag=${GIT_TAG} " \
5969 --set " prometheus-statsd-exporter.enabled=false" \
6070 --set " prometheus.enabled=false" \
6171 --set " grafana.enabled=false" \
6272 --set " feast-jobservice.enabled=false" \
73+ --namespace " $NAMESPACE " \
6374 " $@ " ; then
6475
6576 echo " Error during helm install. "
@@ -105,4 +116,4 @@ subjects:
105116 - kind: ServiceAccount
106117 name: default
107118EOF
108- }
119+ }
0 commit comments