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:
+23
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user