Service type ClusterIP - Controller port forward through CLI (#431)
setting serviceType to ClusterIP as default for fission controller and corresponding changes in fission cli to be able to port-forward the controller pod.
This commit is contained in:
committed by
smruthi2187
parent
1428c64b4f
commit
b9a559af2f
@@ -6,6 +6,7 @@ pkg=""
|
||||
http_status=""
|
||||
url=""
|
||||
|
||||
|
||||
cleanup() {
|
||||
if [ -e "test-deploy-pkg.zip" ]; then
|
||||
rm -rf test-deploy-pkg.zip test_dir
|
||||
@@ -13,6 +14,7 @@ cleanup() {
|
||||
if [ -e "/tmp/file" ]; then
|
||||
rm -rf /tmp/file
|
||||
fi
|
||||
ps aux | grep -i "kubectl port-forward controller" | awk {'print $2'} | xargs kill -9 || true
|
||||
}
|
||||
|
||||
create_archive() {
|
||||
@@ -38,8 +40,21 @@ get_archive_url_from_package() {
|
||||
url=`kubectl get package $1 -ojsonpath='{.spec.deployment.url}'`
|
||||
}
|
||||
|
||||
port_forward_controller_pod() {
|
||||
log "Trying to port forward controller pod"
|
||||
controller_pod=`kubectl get pods -n $FISSION_NAMESPACE| grep controller| tr -s " "| cut -d" " -f1`
|
||||
controller_port=`kubectl get svc controller -n $FISSION_NAMESPACE -ojsonpath='{.spec.ports[0].targetPort}'`
|
||||
log "controller pod: $controller_pod, controller port : $controller_port"
|
||||
kubectl port-forward $controller_pod 9999:8888 -n $FISSION_NAMESPACE &
|
||||
sleep 4
|
||||
}
|
||||
|
||||
get_archive_from_storage() {
|
||||
http_status=`curl -sw "%{http_code}" $1 -o /tmp/file`
|
||||
storage_service_url=$1
|
||||
controller_proxy_url=`echo $storage_service_url | sed -e "s/storagesvc.$FISSION_NAMESPACE/127.0.0.1:9999\/proxy\/storage/"`
|
||||
log "controller_proxy_url=$controller_proxy_url"
|
||||
http_status=`curl -sw "%{http_code}" $controller_proxy_url -o /tmp/file`
|
||||
echo "http_status: $http_status"
|
||||
}
|
||||
|
||||
#1. declare trap to cleanup for EXIT
|
||||
@@ -75,6 +90,9 @@ main() {
|
||||
delete_package $pkg_2
|
||||
log "deleted packages : $pkg_1 $pkg_2"
|
||||
|
||||
# port forward controller pod
|
||||
port_forward_controller_pod
|
||||
|
||||
# curl on the archive url
|
||||
get_archive_from_storage $url_1
|
||||
log "http_status for $url_1 : $http_status"
|
||||
@@ -111,6 +129,7 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
log "Test archive pruner PASSED"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,5 @@ set -euo pipefail
|
||||
# have the right environment, that's all.
|
||||
|
||||
log "Test test, please ignore."
|
||||
|
||||
log $FISSION_URL
|
||||
log $FISSION_ROUTER
|
||||
which fission
|
||||
|
||||
Reference in New Issue
Block a user