Default values for FISSION_* env vars (#518)

This makes set up easier for new users.  Users can still set
FISSION_NAMESPACE but it will default to "fission".  Users can also
still set KUBECONFIG, but it will default to $HOME/.kube/config.

Also, update the post-install chart notes.txt and the install guide to
use "fission function test" as the first step after install.  This
means that if there's anything wrong with the setup, the user will see
useful errors instead of "internal server error".  Also, they can test
their setup without worrying about nodeports or ingresses or whatever.

All existing functionality of FISSION_URL and FISSION_ROUTER continues
to work.
This commit is contained in:
Soam Vasani
2018-02-28 18:14:57 -08:00
committed by GitHub
parent b895f98e88
commit 7ddbea59a2
10 changed files with 90 additions and 166 deletions
+6 -22
View File
@@ -21,10 +21,10 @@ import (
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"strings"
"text/tabwriter"
"time"
@@ -690,7 +690,6 @@ func fnPods(c *cli.Context) error {
}
func fnTest(c *cli.Context) error {
//we can port-forward the router specifically for this method
fnName := c.String("name")
if len(fnName) == 0 {
fatal("Need function name to be specified with --name")
@@ -698,27 +697,12 @@ func fnTest(c *cli.Context) error {
routerURL := os.Getenv("FISSION_ROUTER")
if len(routerURL) == 0 {
localRouterPort, err := findFreePort()
if err != nil {
fatal(fmt.Sprintf("Error finding unused port for router :%s", err.Error()))
}
fissionNamespace := os.Getenv("FISSION_NAMESPACE")
go func() {
err := runportForward("router", localRouterPort, fissionNamespace)
if err != nil {
fatal(err.Error())
}
}()
for {
conn, _ := net.DialTimeout("tcp", net.JoinHostPort("", localRouterPort), time.Second)
if conn != nil {
conn.Close()
break
}
}
// Portforward to the fission router
localRouterPort := setupPortForward(getKubeConfigPath(),
getFissionNamespace(), "application=fission-router")
routerURL = "127.0.0.1:" + localRouterPort
} else {
routerURL = strings.TrimPrefix(routerURL, "http://")
}
url := fmt.Sprintf("http://%s/fission-function/%s", routerURL, fnName)