Skip to content

Commit

Permalink
Enable support to create app in any namespace (#43)
Browse files Browse the repository at this point in the history
* Enable support to create app in any namespace

Before this PR, the Kube deployer was able to deploy an app only in the
default namespace. With this PR, the user can deploy an app in any
namespace. The custom namespace can be specified through config.

* fixed Srdjan's comments
  • Loading branch information
rgrandl authored Aug 7, 2023
1 parent 3a6f8f1 commit e2c2239
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 76 deletions.
3 changes: 3 additions & 0 deletions cmd/weaver-kube/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ func deploy(ctx context.Context, args []string) error {
if config.Image == "" {
return fmt.Errorf("No image name provided in config file. See `weaver kube deploy --help` for details")
}
if config.Namespace == "" {
config.Namespace = "default"
}
binListeners, err := bin.ReadListeners(app.Binary)
if err != nil {
return fmt.Errorf("cannot read listeners from binary %s: %w", app.Binary, err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ServiceWeaver/weaver-kube
go 1.21

require (
github.com/ServiceWeaver/weaver v0.18.0
github.com/ServiceWeaver/weaver v0.18.1
github.com/google/uuid v1.3.0
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/exporters/jaeger v1.16.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ github.com/DataDog/hyperloglog v0.0.0-20220804205443-1806d9b66146 h1:S5WsRc58vIe
github.com/DataDog/hyperloglog v0.0.0-20220804205443-1806d9b66146/go.mod h1:hFPkswc42pKhRbeKDKXy05mRi7J1kJ2vMNbvd9erH0M=
github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 h1:EbzDX8HPk5uE2FsJYxD74QmMw0/3CqSKhEr6teh0ncQ=
github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49/go.mod h1:SvsjzyJlSg0rKsqYgdcFxeEVflx3ZNAyFfkUHP0TxXg=
github.com/ServiceWeaver/weaver v0.18.0 h1:b62r1E9mYnCaPEH+KOT34FsMjSZNLFSlXEnNLTR0pyM=
github.com/ServiceWeaver/weaver v0.18.0/go.mod h1:/tJzitb+h8nLeHa4Mk7iIGU5ZV4OGB4C9IvIfD8n/1I=
github.com/ServiceWeaver/weaver v0.18.1 h1:SE3YhFO58xm3zjYY1wF4Lbz928m27tmQdnbEsdagil4=
github.com/ServiceWeaver/weaver v0.18.1/go.mod h1:/tJzitb+h8nLeHa4Mk7iIGU5ZV4OGB4C9IvIfD8n/1I=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/babysitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (b *babysitter) watchPods(ctx context.Context, component string) error {
rs := replicaSet(component, b.cfg.Deployment)
name := name{b.cfg.Deployment.App.Name, rs, b.cfg.Deployment.Id[:8]}.DNSLabel()
opts := metav1.ListOptions{LabelSelector: fmt.Sprintf("depName=%s", name)}
watcher, err := b.clientset.CoreV1().Pods("default").Watch(ctx, opts)
watcher, err := b.clientset.CoreV1().Pods(b.cfg.Namespace).Watch(ctx, opts)
if err != nil {
return fmt.Errorf("watch pods for component %s: %w", component, err)
}
Expand Down
Loading

0 comments on commit e2c2239

Please sign in to comment.