diff --git a/client.go b/client.go index 1c48f72e..a1ca0d85 100644 --- a/client.go +++ b/client.go @@ -7,7 +7,7 @@ import ( "os" ) -const FaasNamespace = "faas" +const DefaultNamespace = "faas" // Client for a given Service Function. type Client struct { @@ -224,7 +224,7 @@ func WithDomainSearchLimit(limit int) Option { // Name and Root are optional: // Name is derived from root if possible. // Root is defaulted to the current working directory. -func (c *Client) Create(language string) (err error) { +func (c *Client) Create(language, name, root string) (err error) { // Create an instance of a function representation at the given root. f, err := NewFunction(root) if err != nil { diff --git a/cmd/describe.go b/cmd/describe.go index c7bdc699..f68eaa79 100644 --- a/cmd/describe.go +++ b/cmd/describe.go @@ -5,6 +5,7 @@ import ( "encoding/xml" "errors" "fmt" + "gopkg.in/yaml.v2" "github.com/boson-project/faas/client" @@ -25,18 +26,18 @@ var describeCmd = &cobra.Command{ Short: "Describe Service Function", Long: `Describe Service Function`, SuggestFor: []string{"desc"}, - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(1), RunE: describe, } func describe(cmd *cobra.Command, args []string) (err error) { var ( - verbose = viper.GetBool("verbose") - format = viper.GetString("output") + verbose = viper.GetBool("verbose") + format = viper.GetString("output") ) name := args[0] - describer, err := knative.NewDescriber(client.FaasNamespace) + describer, err := knative.NewDescriber(client.DefaultNamespace) if err != nil { return } @@ -55,11 +56,10 @@ func describe(cmd *cobra.Command, args []string) (err error) { return } - - formatFunctions := map[string] func(interface{})([]byte, error) { - "json" : json.Marshal, - "yaml" : yaml.Marshal, - "xml" : xml.Marshal, + formatFunctions := map[string]func(interface{}) ([]byte, error){ + "json": json.Marshal, + "yaml": yaml.Marshal, + "xml": xml.Marshal, } formatFun, found := formatFunctions[format] @@ -71,6 +71,6 @@ func describe(cmd *cobra.Command, args []string) (err error) { return } fmt.Println(string(data)) - + return } diff --git a/cmd/list.go b/cmd/list.go index 8f36fc8d..f5620a38 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -26,7 +26,7 @@ func list(cmd *cobra.Command, args []string) (err error) { verbose = viper.GetBool("verbose") ) - lister, err := knative.NewLister(client.FaasNamespace) + lister, err := knative.NewLister(client.DefaultNamespace) if err != nil { return } diff --git a/kn/updater.go b/kn/updater.go index add7bb90..4f656752 100644 --- a/kn/updater.go +++ b/kn/updater.go @@ -42,7 +42,7 @@ func (d *Updater) Update(name, image string) (err error) { // TODO: use knative client directly. // TODO: use tags and traffic splitting. - cmd := exec.Command("kn", "service", "update", project, "--env", timestamp, "--namespace", faasclient.FaasNamespace) + cmd := exec.Command("kn", "service", "update", project, "--env", timestamp, "--namespace", faasclient.DefaultNamespace) // If verbose logging is enabled, echo appsody's chatty stdout. if d.Verbose { diff --git a/kubectl/deployer.go b/kubectl/deployer.go index 1d8eb169..6008178a 100644 --- a/kubectl/deployer.go +++ b/kubectl/deployer.go @@ -97,7 +97,7 @@ func (d *Deployer) Deploy(name, image string) (address string, err error) { // Write out the final service yaml err = t.Execute(f, map[string]string{ "Project": project, - "Namespace": faasclient.FaasNamespace, + "Namespace": faasclient.DefaultNamespace, "Subdomain": subdomain, "Domain": domain, "Image": image, diff --git a/kubectl/remover.go b/kubectl/remover.go index 4599d15f..f53c802c 100644 --- a/kubectl/remover.go +++ b/kubectl/remover.go @@ -39,7 +39,7 @@ func (d *Remover) Remove(name string) (err error) { } // Command to run - cmd := exec.Command("kubectl", "delete", "kservice", serviceName, "--namespace", faasclient.FaasNamespace) + cmd := exec.Command("kubectl", "delete", "kservice", serviceName, "--namespace", faasclient.DefaultNamespace) // If verbose logging is enabled, echo appsody's chatty stdout. if d.Verbose {