Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
WakeupTsai committed Jun 27, 2018
1 parent 4a7bfc1 commit 0ad7fa8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 98 deletions.
62 changes: 0 additions & 62 deletions src/networkcontroller/networkcontroller.go

This file was deleted.

43 changes: 7 additions & 36 deletions src/serviceprovider/serviceprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,8 @@ func New(cf config.Config) *Container {
logger.Infof("Connecting to mongodb: %s", cf.Mongo.Url)
mongo := mongo.New(cf.Mongo.Url)

kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
k8s, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
k8s, err = rest.InClusterConfig()
if err != nil {
panic(fmt.Errorf("Load the kubernetes config fail"))
}
}

clientset := kubernetes.NewForConfigOrDie(k8s)
logger.Infof("Connecting to prometheus: %s", cf.Prometheus.Url)
prometheus := prometheus.New(cf.Prometheus.Url)

kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
k8s, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
Expand Down Expand Up @@ -92,32 +84,11 @@ func NewForTesting(cf config.Config) *Container {
clientset := fakeclientset.NewSimpleClientset()

sp := &Container{
Config: cf,
Redis: redisService,
Mongo: mongo,
KubeCtl: kubeCtl.New(clientset, "default"),
}

return sp
}

func NewForTesting(cf config.Config) *Container {
// setup logger configuration
logger.Setup(cf.Logger)

logger.Infof("Connecting to redis: %s", cf.Redis.Addr())
redisService := redis.New(cf.Redis)

logger.Infof("Connecting to mongodb: %s", cf.Mongo.Url)
mongo := mongo.New(cf.Mongo.Url)

clientset := fakeclientset.NewSimpleClientset()

sp := &Container{
Config: cf,
Redis: redisService,
Mongo: mongo,
KubeCtl: kubeCtl.New(clientset, "default"),
Config: cf,
Redis: redisService,
Mongo: mongo,
Prometheus: prometheus,
KubeCtl: kubeCtl.New(clientset, "default"),
}

return sp
Expand Down

0 comments on commit 0ad7fa8

Please sign in to comment.