Skip to content

Commit

Permalink
add cli option for starting fake api server
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarreira authored and wpjunior committed May 16, 2022
1 parent ccbdc24 commit fff1ba8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"

"github.com/google/gops/agent"
"github.com/spf13/viper"

"github.com/tsuru/rpaas-operator/internal/config"
"github.com/tsuru/rpaas-operator/pkg/web"
Expand All @@ -25,11 +26,18 @@ func main() {
defer agent.Close()

cfg := config.Get()
isFakeServerAPI := viper.GetBool("fake-api")

var targetFactory target.Factory
var err error
if cfg.MultiCluster {
targetFactory = target.NewMultiClustersFactory(cfg.Clusters)
} else if isFakeServerAPI {
log.Println("Starting a Fake API Server (without K8s)...")
targetFactory, err = target.NewFakeServerFactory()
if err != nil {
log.Fatalf("could not initialize fake cluster target: %v", err)
}
} else {
targetFactory, err = target.NewKubeConfigFactory()
if err != nil {
Expand Down

0 comments on commit fff1ba8

Please sign in to comment.