Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package swarm
package main

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package swarm
package main

import (
"encoding/json"
Expand Down
3 changes: 1 addition & 2 deletions pkg/example/flavor/swarm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/docker/go-connections/tlsconfig"
"github.com/docker/infrakit/pkg/cli"
"github.com/docker/infrakit/pkg/plugin/flavor/swarm"
flavor_plugin "github.com/docker/infrakit/pkg/rpc/flavor"
"github.com/docker/infrakit/pkg/util/docker/1.24"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -40,7 +39,7 @@ func main() {
return err
}

cli.RunPlugin(*name, flavor_plugin.PluginServer(swarm.NewSwarmFlavor(dockerClient)))
cli.RunPlugin(*name, flavor_plugin.PluginServer(NewSwarmFlavor(dockerClient)))
return nil
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vanilla
package main

import (
"encoding/json"
Expand Down
3 changes: 1 addition & 2 deletions pkg/example/flavor/vanilla/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/docker/infrakit/pkg/cli"
"github.com/docker/infrakit/pkg/plugin/flavor/vanilla"
flavor_plugin "github.com/docker/infrakit/pkg/rpc/flavor"
"github.com/spf13/cobra"
)
Expand All @@ -20,7 +19,7 @@ func main() {
name := cmd.Flags().String("name", "flavor-vanilla", "Plugin name to advertise for discovery")
cmd.Run = func(c *cobra.Command, args []string) {
cli.SetLogLevel(*logLevel)
cli.RunPlugin(*name, flavor_plugin.PluginServer(vanilla.NewPlugin()))
cli.RunPlugin(*name, flavor_plugin.PluginServer(NewPlugin()))
}

cmd.AddCommand(cli.VersionCommand())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zookeeper
package main

import (
"bytes"
Expand Down
3 changes: 1 addition & 2 deletions pkg/example/flavor/zookeeper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/docker/infrakit/pkg/cli"
zk "github.com/docker/infrakit/pkg/plugin/flavor/zookeeper"
flavor_plugin "github.com/docker/infrakit/pkg/rpc/flavor"
"github.com/spf13/cobra"
)
Expand All @@ -20,7 +19,7 @@ func main() {
logLevel := cmd.Flags().Int("log", cli.DefaultLogLevel, "Logging level. 0 is least verbose. Max is 5")
cmd.Run = func(c *cobra.Command, args []string) {
cli.SetLogLevel(*logLevel)
cli.RunPlugin(*name, flavor_plugin.PluginServer(zk.NewPlugin()))
cli.RunPlugin(*name, flavor_plugin.PluginServer(NewPlugin()))
}

cmd.AddCommand(cli.VersionCommand())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vagrant
package main

import (
"bytes"
Expand All @@ -14,19 +14,6 @@ import (
"github.com/docker/infrakit/pkg/spi/instance"
)

// VagrantFile is the minimum definition of the vagrant file
const VagrantFile = `
Vagrant.configure("2") do |config|
config.vm.box = "{{.Properties.Box}}"
config.vm.hostname = "infrakit.box"
config.vm.network "private_network"{{.NetworkOptions}}
config.vm.provision :shell, path: "boot.sh"
config.vm.provider :virtualbox do |vb|
vb.memory = {{.Properties.Memory}}
vb.cpus = {{.Properties.CPUs}}
end
end`

// NewVagrantPlugin creates an instance plugin for vagrant.
func NewVagrantPlugin(dir string, template *template.Template) instance.Plugin {
return &vagrantPlugin{VagrantfilesDir: dir, VagrantTmpl: template}
Expand Down
18 changes: 15 additions & 3 deletions pkg/example/instance/vagrant/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/docker/infrakit/pkg/cli"
"github.com/docker/infrakit/pkg/plugin/instance/vagrant"
instance_plugin "github.com/docker/infrakit/pkg/rpc/instance"
"github.com/spf13/cobra"
)
Expand All @@ -30,7 +29,7 @@ func main() {

var templ *template.Template
if *templFile == "" {
templ = template.Must(template.New("").Parse(vagrant.VagrantFile))
templ = template.Must(template.New("").Parse(VagrantFile))
} else {
var err error
templ, err = template.ParseFiles()
Expand All @@ -40,7 +39,7 @@ func main() {
}

cli.SetLogLevel(*logLevel)
cli.RunPlugin(*name, instance_plugin.PluginServer(vagrant.NewVagrantPlugin(*dir, templ)))
cli.RunPlugin(*name, instance_plugin.PluginServer(NewVagrantPlugin(*dir, templ)))
return nil
}

Expand All @@ -51,3 +50,16 @@ func main() {
os.Exit(1)
}
}

// VagrantFile is the minimum definition of the vagrant file
const VagrantFile = `
Vagrant.configure("2") do |config|
config.vm.box = "{{.Properties.Box}}"
config.vm.hostname = "infrakit.box"
config.vm.network "private_network"{{.NetworkOptions}}
config.vm.provision :shell, path: "boot.sh"
config.vm.provider :virtualbox do |vb|
vb.memory = {{.Properties.Memory}}
vb.cpus = {{.Properties.CPUs}}
end
end`