Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 606cbb9

Browse files
author
David Chung
authored
Discovery cleanup to better separate local and remote discovery of plugins (#446)
Signed-off-by: David Chung <[email protected]>
1 parent c569045 commit 606cbb9

File tree

23 files changed

+53
-48
lines changed

23 files changed

+53
-48
lines changed

cmd/cli/event.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
log "github.com/Sirupsen/logrus"
88
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
910
metadata_template "github.com/docker/infrakit/pkg/plugin/metadata/template"
1011
"github.com/docker/infrakit/pkg/rpc/client"
1112
event_rpc "github.com/docker/infrakit/pkg/rpc/event"
@@ -193,7 +194,7 @@ func eventCommand(plugins func() discovery.Plugins) *cobra.Command {
193194

194195
log.Infof("Using %v for rendering view.", templateURL)
195196
engine, err := template.NewTemplate(templateURL, template.Options{
196-
SocketDir: discovery.Dir(),
197+
SocketDir: local.Dir(),
197198
})
198199
if err != nil {
199200
return err

cmd/cli/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/docker/infrakit/pkg/cli"
1010
"github.com/docker/infrakit/pkg/discovery"
11+
"github.com/docker/infrakit/pkg/discovery/local"
1112
"github.com/docker/infrakit/pkg/discovery/remote"
1213
logutil "github.com/docker/infrakit/pkg/log"
1314
"github.com/spf13/cobra"
@@ -58,7 +59,7 @@ func main() {
5859
cmd.SilenceErrors = true
5960
f := func() discovery.Plugins {
6061
if len(ulist) == 0 {
61-
d, err := discovery.NewPluginDiscovery()
62+
d, err := local.NewPluginDiscovery()
6263
if err != nil {
6364
log.Crit("Failed to initialize plugin discovery", "err", err)
6465
os.Exit(1)

cmd/cli/manager.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
log "github.com/Sirupsen/logrus"
88
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
910
"github.com/docker/infrakit/pkg/manager"
1011
"github.com/docker/infrakit/pkg/plugin"
1112
metadata_template "github.com/docker/infrakit/pkg/plugin/metadata/template"
@@ -87,7 +88,7 @@ func managerCommand(plugins func() discovery.Plugins) *cobra.Command {
8788

8889
log.Infof("Using %v for reading template\n", templateURL)
8990
engine, err := template.NewTemplate(templateURL, template.Options{
90-
SocketDir: discovery.Dir(),
91+
SocketDir: local.Dir(),
9192
})
9293
if err != nil {
9394
return err

cmd/cli/plugin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
log "github.com/Sirupsen/logrus"
1313
"github.com/docker/infrakit/pkg/discovery"
14+
"github.com/docker/infrakit/pkg/discovery/local"
1415
"github.com/docker/infrakit/pkg/launch"
1516
"github.com/docker/infrakit/pkg/launch/os"
1617
"github.com/docker/infrakit/pkg/plugin"
@@ -59,7 +60,7 @@ func pluginCommand(plugins func() discovery.Plugins) *cobra.Command {
5960
start.RunE = func(c *cobra.Command, args []string) error {
6061

6162
configTemplate, err := template.NewTemplate(*configURL, template.Options{
62-
SocketDir: discovery.Dir(),
63+
SocketDir: local.Dir(),
6364
})
6465
if err != nil {
6566
return err

cmd/cli/resource.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
log "github.com/Sirupsen/logrus"
88
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
910
"github.com/docker/infrakit/pkg/plugin"
1011
resource_plugin "github.com/docker/infrakit/pkg/rpc/resource"
1112
"github.com/docker/infrakit/pkg/spi/resource"
@@ -139,7 +140,7 @@ func resourcePluginCommand(plugins func() discovery.Plugins) *cobra.Command {
139140
func readSpecFromTemplateURL(templateURL string) (*resource.Spec, error) {
140141
log.Infof("Reading template from %v", templateURL)
141142
engine, err := template.NewTemplate(templateURL, template.Options{
142-
SocketDir: discovery.Dir(),
143+
SocketDir: local.Dir(),
143144
})
144145
if err != nil {
145146
return nil, err

cmd/cli/template.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
log "github.com/Sirupsen/logrus"
88
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
910
metadata_template "github.com/docker/infrakit/pkg/plugin/metadata/template"
1011
"github.com/docker/infrakit/pkg/template"
1112
"github.com/spf13/cobra"
@@ -22,7 +23,7 @@ func templateCommand(plugins func() discovery.Plugins) *cobra.Command {
2223

2324
log.Infof("Using %v for reading template\n", templateURL)
2425
engine, err := template.NewTemplate(templateURL, template.Options{
25-
SocketDir: discovery.Dir(),
26+
SocketDir: local.Dir(),
2627
})
2728
if err != nil {
2829
return err

cmd/group/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
log "github.com/Sirupsen/logrus"
88
"github.com/docker/infrakit/pkg/cli"
9-
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
1010
"github.com/docker/infrakit/pkg/plugin"
1111
"github.com/docker/infrakit/pkg/plugin/group"
1212
metadata_plugin "github.com/docker/infrakit/pkg/plugin/metadata"
@@ -33,7 +33,7 @@ func main() {
3333

3434
cli.SetLogLevel(*logLevel)
3535

36-
plugins, err := discovery.NewPluginDiscovery()
36+
plugins, err := local.NewPluginDiscovery()
3737
if err != nil {
3838
return err
3939
}

cmd/manager/etcd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/coreos/etcd/clientv3"
77
"github.com/docker/go-connections/tlsconfig"
8-
"github.com/docker/infrakit/pkg/discovery"
8+
"github.com/docker/infrakit/pkg/discovery/local"
99
etcd_leader "github.com/docker/infrakit/pkg/leader/etcd/v3"
1010
etcd_store "github.com/docker/infrakit/pkg/store/etcd/v3"
1111
etcd "github.com/docker/infrakit/pkg/util/etcd/v3"
@@ -66,7 +66,7 @@ func etcdEnvironment(getConfig func() config) *cobra.Command {
6666
return err
6767
}
6868

69-
plugins, err := discovery.NewPluginDiscovery()
69+
plugins, err := local.NewPluginDiscovery()
7070
if err != nil {
7171
return err
7272
}

cmd/manager/os.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path/filepath"
77
"time"
88

9-
"github.com/docker/infrakit/pkg/discovery"
9+
"github.com/docker/infrakit/pkg/discovery/local"
1010
file_leader "github.com/docker/infrakit/pkg/leader/file"
1111
file_store "github.com/docker/infrakit/pkg/store/file"
1212
"github.com/spf13/cobra"
@@ -52,7 +52,7 @@ func osEnvironment(getConfig func() config) *cobra.Command {
5252
pollInterval := cmd.Flags().Duration("poll-interval", 5*time.Second, "Leader polling interval")
5353
cmd.RunE = func(c *cobra.Command, args []string) error {
5454

55-
plugins, err := discovery.NewPluginDiscovery()
55+
plugins, err := local.NewPluginDiscovery()
5656
if err != nil {
5757
return err
5858
}

cmd/manager/swarm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
log "github.com/Sirupsen/logrus"
77
"github.com/docker/go-connections/tlsconfig"
8-
"github.com/docker/infrakit/pkg/discovery"
8+
"github.com/docker/infrakit/pkg/discovery/local"
99
swarm_leader "github.com/docker/infrakit/pkg/leader/swarm"
1010
swarm_store "github.com/docker/infrakit/pkg/store/swarm"
1111
"github.com/docker/infrakit/pkg/util/docker"
@@ -44,7 +44,7 @@ func swarmEnvironment(getConfig func() config) *cobra.Command {
4444
return err
4545
}
4646

47-
plugins, err := discovery.NewPluginDiscovery()
47+
plugins, err := local.NewPluginDiscovery()
4848
if err != nil {
4949
return err
5050
}

0 commit comments

Comments
 (0)