FaasNamespace to DefaultNamespace

This commit is contained in:
Luke K 2020-05-11 00:17:39 +00:00
parent a6c10fdaa8
commit 724b64b51a
No known key found for this signature in database
GPG Key ID: 4896F75BAF2E1966
6 changed files with 16 additions and 16 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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,

View File

@ -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 {