Merge pull request #6 from matejvasek/fixing-namespace

Fix namespace
This commit is contained in:
lkingland 2020-05-04 00:19:28 +09:00 committed by GitHub
commit 130751b01e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View File

@ -13,6 +13,8 @@ import (
"gopkg.in/yaml.v2"
)
const FaasNamespace = "faas"
// Client for a given Service Function.
type Client struct {
verbose bool // print verbose logs

View File

@ -8,6 +8,7 @@ import (
"os/exec"
"time"
faasclient "github.com/boson-project/faas/client"
"github.com/boson-project/faas/k8s"
)
@ -41,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)
cmd := exec.Command("kn", "service", "update", project, "--env", timestamp, "--namespace", faasclient.FaasNamespace)
// If verbose logging is enabled, echo appsody's chatty stdout.
if d.Verbose {

View File

@ -11,6 +11,7 @@ import (
"os/exec"
"strings"
faasclient "github.com/boson-project/faas/client"
"github.com/boson-project/faas/k8s"
)
@ -19,7 +20,7 @@ apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: {{ .Project }}
namespace: default
namespace: {{ .Namespace }}
labels:
# Will be exposed as this domain as per the knative service domains config.
# Configured in config-domain
@ -96,6 +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,
"Subdomain": subdomain,
"Domain": domain,
"Image": image,

View File

@ -7,6 +7,7 @@ import (
"os"
"os/exec"
faasclient "github.com/boson-project/faas/client"
"github.com/boson-project/faas/k8s"
)
@ -38,7 +39,7 @@ func (d *Remover) Remove(name string) (err error) {
}
// Command to run
cmd := exec.Command("kubectl", "delete", "kservice", serviceName)
cmd := exec.Command("kubectl", "delete", "kservice", serviceName, "--namespace", faasclient.FaasNamespace)
// If verbose logging is enabled, echo appsody's chatty stdout.
if d.Verbose {