Ingress integration (#688)
Ingress integration to allow the optional creation of ingress for a given route. The ingress controller needs to be set up by the user separately so that ingress path is accessible outside the cluster.
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(dirname $0)/../..
|
||||
|
||||
relativeUrl="/itest"
|
||||
functionName="hellotest"
|
||||
hostName="test.com"
|
||||
|
||||
cleanup() {
|
||||
fission route delete --name $1
|
||||
}
|
||||
|
||||
log "Creating route for URL $relativeUrl"
|
||||
route_name=$(fission route create --url $relativeUrl --function $functionName --createingress| grep trigger| cut -d" " -f 2|cut -d"'" -f 2)
|
||||
trap "cleanup $route_name" EXIT
|
||||
|
||||
log "Route $route_name created"
|
||||
|
||||
sleep 5
|
||||
|
||||
log "Ingresses matching this trigger:"
|
||||
kubectl get ing -l 'functionName='$functionName',triggerName='$route_name --all-namespaces -o=json
|
||||
|
||||
log "Verifying to route value in ingress"
|
||||
actual_route=$(kubectl -n fission get ing -l 'functionName='$functionName',triggerName='$route_name --all-namespaces -o=jsonpath='{.items[0].spec.rules[0].http.paths[0].path}')
|
||||
|
||||
if [ $actual_route != $relativeUrl ]
|
||||
then
|
||||
log "Provided route and route in ingress don't match"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Modifying the route by adding host"
|
||||
fission route update --name $route_name --host $hostName --function $functionName
|
||||
|
||||
sleep 2
|
||||
|
||||
actual_host=$(kubectl get ing -l 'functionName='$functionName',triggerName='$route_name --all-namespaces -o=jsonpath='{.items[0].spec.rules[0].host}')
|
||||
|
||||
if [ $hostName != $actual_host ]
|
||||
then
|
||||
log "Provided host and host in ingress don't match"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user