Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions cmd/mtbroker/filter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
package main

import (
"flag"
"fmt"
"log"
"time"

"github.com/google/uuid"
"github.com/kelseyhightower/envconfig"
"go.opencensus.io/stats/view"
"go.uber.org/zap"

broker "knative.dev/eventing/cmd/mtbroker"
Expand All @@ -48,11 +45,6 @@ import (
eventinginformers "knative.dev/eventing/pkg/client/informers/externalversions"
)

var (
masterURL = flag.String("master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
kubeconfig = flag.String("kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
)

const (
defaultMetricsPort = 9092
component = "mt_broker_filter"
Expand All @@ -67,21 +59,12 @@ type envConfig struct {
}

func main() {
flag.Parse()

ctx := signals.NewContext()

// Report stats on Go memory usage every 30 seconds.
msp := metrics.NewMemStatsAll()
msp.Start(ctx, 30*time.Second)
if err := view.Register(msp.DefaultViews()...); err != nil {
log.Fatalf("Error exporting go memstats view: %v", err)
}
sharedmain.MemStatsOrDie(ctx)

cfg, err := sharedmain.GetConfig(*masterURL, *kubeconfig)
if err != nil {
log.Fatal("Error building kubeconfig", err)
}
cfg := sharedmain.ParseAndGetConfigOrDie()

var env envConfig
if err := envconfig.Process("", &env); err != nil {
Expand Down
21 changes: 2 additions & 19 deletions cmd/mtbroker/ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@
package main

import (
"flag"
"fmt"
"log"
"time"

// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

"github.com/google/uuid"
"github.com/kelseyhightower/envconfig"
"go.opencensus.io/stats/view"
"go.uber.org/zap"

cmdbroker "knative.dev/eventing/cmd/mtbroker"
Expand All @@ -50,11 +47,6 @@ import (
tracingconfig "knative.dev/pkg/tracing/config"
)

var (
masterURL = flag.String("master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
kubeconfig = flag.String("kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
)

// TODO make these constants configurable (either as env variables, config map, or part of broker spec).
// Issue: https://github.com/knative/eventing/issues/1777
const (
Expand All @@ -77,21 +69,12 @@ type envConfig struct {
}

func main() {
flag.Parse()

ctx := signals.NewContext()

// Report stats on Go memory usage every 30 seconds.
msp := metrics.NewMemStatsAll()
msp.Start(ctx, 30*time.Second)
if err := view.Register(msp.DefaultViews()...); err != nil {
log.Fatalf("Error exporting go memstats view: %v", err)
}
sharedmain.MemStatsOrDie(ctx)

cfg, err := sharedmain.GetConfig(*masterURL, *kubeconfig)
if err != nil {
log.Fatal("Error building kubeconfig", err)
}
cfg := sharedmain.ParseAndGetConfigOrDie()

var env envConfig
if err := envconfig.Process("", &env); err != nil {
Expand Down