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
+23 -7
View File
@@ -18,10 +18,29 @@ package main
import (
"os"
"path/filepath"
"github.com/urfave/cli"
)
func getFissionNamespace() string {
fissionNamespace := os.Getenv("FISSION_NAMESPACE")
if len(fissionNamespace) == 0 {
// TODO make this smarter, perhaps based on helm releases
fissionNamespace = "fission"
}
return fissionNamespace
}
func getKubeConfigPath() string {
kubeConfig := os.Getenv("KUBECONFIG")
if len(kubeConfig) == 0 {
home := os.Getenv("HOME")
kubeConfig = filepath.Join(home, ".kube", "config")
}
return kubeConfig
}
func main() {
app := cli.NewApp()
app.Name = "fission"
@@ -32,13 +51,10 @@ func main() {
var value string
fissionUrl := os.Getenv("FISSION_URL")
if len(fissionUrl) == 0 {
// check here to specify env var for KUBECONFIG and FISSION_NAMESPACE
fissionNamespace := os.Getenv("FISSION_NAMESPACE")
kubeConfig := os.Getenv("KUBECONFIG")
if len(kubeConfig) == 0 || len(fissionNamespace) == 0 {
fatal("Environment variables KUBECONFIG and FISSION_NAMESPACE are mandatory if the serviceType is ClusterIP")
}
localPort := controllerPodPortForward(fissionNamespace)
fissionNamespace := getFissionNamespace()
kubeConfig := getKubeConfigPath()
localPort := setupPortForward(
kubeConfig, fissionNamespace, "application=fission-api")
value = "http://127.0.0.1:" + localPort
} else {
value = fissionUrl