@@ -6,114 +6,14 @@ STEP_BREADCRUMB='~~~~~~~~'
66SECONDS=0
77TIMEFORMAT=" ${STEP_BREADCRUMB} took %R seconds"
88
9- function k8s_cleanup {
10- local RELEASE=$1
11- local NAMESPACE=$2
12-
13- # Create namespace if it doesn't exist.
14- kubectl create namespace " $NAMESPACE " || true
15-
16- # Uninstall previous feast release if there is any.
17- helm uninstall " $RELEASE " -n " $NAMESPACE " || true
18-
19- # `helm uninstall` doesn't remove PVCs, delete them manually.
20- time kubectl delete pvc --all -n " $NAMESPACE " || true
21-
22- kubectl get service -n " $NAMESPACE "
23-
24- # Set a new postgres password. Note that the postgres instance is not available outside
25- # the k8s cluster anyway so it doesn't have to be super secure.
26- echo " ${STEP_BREADCRUMB} Setting PG password"
27- PG_PASSWORD=$( head -c 59 /dev/urandom | md5sum | head -c 16)
28- kubectl delete secret feast-postgresql -n " $NAMESPACE " || true
29- kubectl create secret generic feast-postgresql --from-literal=postgresql-password=" $PG_PASSWORD " -n " $NAMESPACE "
30- }
31-
32- function helm_install {
33- # helm install Feast into k8s cluster and display a nice error if it fails.
34- # Usage: helm_install $RELEASE $DOCKER_REPOSITORY $GIT_TAG ...
35- # Args:
36- # $RELEASE is helm release name
37- # $DOCKER_REPOSITORY is the docker repo containing feast images tagged with $GIT_TAG
38- # ... you can pass additional args to this function that are passed on to helm install
39-
40- local RELEASE=$1
41- local DOCKER_REPOSITORY=$2
42- local GIT_TAG=$3
43-
44- shift 3
45-
46- # We skip statsd exporter and other metrics stuff since we're not using it anyway, and it
47- # has some issues with unbound PVCs (that cause kubectl delete pvc to hang).
48- echo " ${STEP_BREADCRUMB} Helm installing feast"
49-
50- if ! time helm install --wait " $RELEASE " infra/charts/feast \
51- --timeout 15m \
52- --set " feast-jupyter.image.repository=${DOCKER_REPOSITORY} /feast-jupyter" \
53- --set " feast-jupyter.image.tag=${GIT_TAG} " \
54- --set " feast-online-serving.image.repository=${DOCKER_REPOSITORY} /feast-serving" \
55- --set " feast-online-serving.image.tag=${GIT_TAG} " \
56- --set " feast-jobservice.image.repository=${DOCKER_REPOSITORY} /feast-jobservice" \
57- --set " feast-jobservice.image.tag=${GIT_TAG} " \
58- --set " feast-core.image.repository=${DOCKER_REPOSITORY} /feast-core" \
59- --set " feast-core.image.tag=${GIT_TAG} " \
60- --set " prometheus-statsd-exporter.enabled=false" \
61- --set " prometheus.enabled=false" \
62- --set " grafana.enabled=false" \
63- --set " feast-jobservice.enabled=false" \
64- " $@ " ; then
65-
66- echo " Error during helm install. "
67- kubectl -n " $NAMESPACE " get pods
68-
69- readarray -t CRASHED_PODS < <( kubectl -n " $NAMESPACE " get pods --no-headers=true | grep " $RELEASE " | awk ' {if ($2 == "0/1") { print $1 } }' )
70- echo " Crashed pods: ${CRASHED_PODS[*]} "
71-
72- for POD in " ${CRASHED_PODS[@]} " ; do
73- echo " Logs from pod error $POD :"
74- kubectl -n " $NAMESPACE " logs " $POD " --previous
75- done
76-
77- exit 1
78- fi
79- }
80-
81- function setup_sparkop_role {
82- # Set up permissions for the default user in sparkop namespace so that Feast SDK can manage
83- # sparkapplication resources from the test runner pod.
84-
85- cat << EOF | kubectl apply -f -
86- kind: Role
87- apiVersion: rbac.authorization.k8s.io/v1beta1
88- metadata:
89- name: use-spark-operator
90- rules:
91- - apiGroups: ["sparkoperator.k8s.io"]
92- resources: ["sparkapplications"]
93- verbs: ["create", "delete", "deletecollection", "get", "list", "update", "watch", "patch"]
94- ---
95- apiVersion: rbac.authorization.k8s.io/v1beta1
96- kind: RoleBinding
97- metadata:
98- name: use-spark-operator
99- roleRef:
100- kind: Role
101- name: use-spark-operator
102- apiGroup: rbac.authorization.k8s.io
103- subjects:
104- - kind: ServiceAccount
105- name: default
106- EOF
107- }
9+ # Note requires running in root feast directory
10+ source infra/scripts/runner-helper.sh
10811
10912GIT_TAG=$( git rev-parse HEAD)
11013GIT_REMOTE_URL=$( git config --get remote.origin.url)
11114
11215echo " ########## Starting e2e tests for ${GIT_REMOTE_URL} ${GIT_TAG} ###########"
11316
114- # This seems to make builds a bit faster.
115- export DOCKER_BUILDKIT=1
116-
11717# Workaround for COPY command in core docker image that pulls local maven repo into the image
11818# itself.
11919mkdir .m2 2> /dev/null || true
0 commit comments