mirror of https://github.com/knative/func.git
FaasNamespace to DefaultNamespace
This commit is contained in:
parent
a6c10fdaa8
commit
724b64b51a
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
const FaasNamespace = "faas"
|
const DefaultNamespace = "faas"
|
||||||
|
|
||||||
// Client for a given Service Function.
|
// Client for a given Service Function.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
|
@ -224,7 +224,7 @@ func WithDomainSearchLimit(limit int) Option {
|
||||||
// Name and Root are optional:
|
// Name and Root are optional:
|
||||||
// Name is derived from root if possible.
|
// Name is derived from root if possible.
|
||||||
// Root is defaulted to the current working directory.
|
// 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.
|
// Create an instance of a function representation at the given root.
|
||||||
f, err := NewFunction(root)
|
f, err := NewFunction(root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/boson-project/faas/client"
|
"github.com/boson-project/faas/client"
|
||||||
|
@ -25,18 +26,18 @@ var describeCmd = &cobra.Command{
|
||||||
Short: "Describe Service Function",
|
Short: "Describe Service Function",
|
||||||
Long: `Describe Service Function`,
|
Long: `Describe Service Function`,
|
||||||
SuggestFor: []string{"desc"},
|
SuggestFor: []string{"desc"},
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: describe,
|
RunE: describe,
|
||||||
}
|
}
|
||||||
|
|
||||||
func describe(cmd *cobra.Command, args []string) (err error) {
|
func describe(cmd *cobra.Command, args []string) (err error) {
|
||||||
var (
|
var (
|
||||||
verbose = viper.GetBool("verbose")
|
verbose = viper.GetBool("verbose")
|
||||||
format = viper.GetString("output")
|
format = viper.GetString("output")
|
||||||
)
|
)
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
describer, err := knative.NewDescriber(client.FaasNamespace)
|
describer, err := knative.NewDescriber(client.DefaultNamespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -55,11 +56,10 @@ func describe(cmd *cobra.Command, args []string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formatFunctions := map[string]func(interface{}) ([]byte, error){
|
||||||
formatFunctions := map[string] func(interface{})([]byte, error) {
|
"json": json.Marshal,
|
||||||
"json" : json.Marshal,
|
"yaml": yaml.Marshal,
|
||||||
"yaml" : yaml.Marshal,
|
"xml": xml.Marshal,
|
||||||
"xml" : xml.Marshal,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
formatFun, found := formatFunctions[format]
|
formatFun, found := formatFunctions[format]
|
||||||
|
@ -71,6 +71,6 @@ func describe(cmd *cobra.Command, args []string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println(string(data))
|
fmt.Println(string(data))
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func list(cmd *cobra.Command, args []string) (err error) {
|
||||||
verbose = viper.GetBool("verbose")
|
verbose = viper.GetBool("verbose")
|
||||||
)
|
)
|
||||||
|
|
||||||
lister, err := knative.NewLister(client.FaasNamespace)
|
lister, err := knative.NewLister(client.DefaultNamespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ func (d *Updater) Update(name, image string) (err error) {
|
||||||
|
|
||||||
// TODO: use knative client directly.
|
// TODO: use knative client directly.
|
||||||
// TODO: use tags and traffic splitting.
|
// 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 verbose logging is enabled, echo appsody's chatty stdout.
|
||||||
if d.Verbose {
|
if d.Verbose {
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (d *Deployer) Deploy(name, image string) (address string, err error) {
|
||||||
// Write out the final service yaml
|
// Write out the final service yaml
|
||||||
err = t.Execute(f, map[string]string{
|
err = t.Execute(f, map[string]string{
|
||||||
"Project": project,
|
"Project": project,
|
||||||
"Namespace": faasclient.FaasNamespace,
|
"Namespace": faasclient.DefaultNamespace,
|
||||||
"Subdomain": subdomain,
|
"Subdomain": subdomain,
|
||||||
"Domain": domain,
|
"Domain": domain,
|
||||||
"Image": image,
|
"Image": image,
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (d *Remover) Remove(name string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command to run
|
// 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 verbose logging is enabled, echo appsody's chatty stdout.
|
||||||
if d.Verbose {
|
if d.Verbose {
|
||||||
|
|
Loading…
Reference in New Issue