This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
/
runnerinstall.go
71 lines (54 loc) · 2 KB
/
runnerinstall.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package runnerinstall
import (
"context"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/waypoint-plugin-sdk/terminal"
"github.com/hashicorp/waypoint/internal/pkg/flag"
"github.com/hashicorp/waypoint/pkg/serverconfig"
)
const (
defaultRunnerImage = "hashicorp/waypoint"
runnerName = "waypoint-runner"
)
type RunnerInstaller interface {
// Install expects a Waypoint Runner to be installed
Install(context.Context, *InstallOpts) error
// InstallFlags is called prior to Install and allows the installer to
// specify flags for the install CLI. The flags should be prefixed with
// the platform name to avoid conflicts with other flags.
InstallFlags(*flag.Set)
// Uninstall should remove the runner(s) installed via Install.
Uninstall(context.Context, *InstallOpts) error
// UninstallFlags is called prior to Uninstall and allows the Uninstaller to
// specify flags for the uninstall CLI. The flags should be prefixed with the
// platform name to avoid conflicts with other flags.
UninstallFlags(*flag.Set)
}
// InstallOpts are the options sent to RunnerInstaller.Install.
type InstallOpts struct {
Log hclog.Logger
UI terminal.UI
// Cookie is the server cookie that can be used for this runner
Cookie string
// ServerAddr is the address of the server to which the runner
// connects
ServerAddr string
// AdvertiseClient is the serverconfig.Client information for connecting
// to the server via the AdvertiseAddr information. This also has the auth
// token already set. This is provided as a convenience since it is common
// to build this immediately.
AdvertiseClient *serverconfig.Client
// Unique ID for the runner.
Id string
// Flags which will be supplied to the `waypoint runner agent` command
RunnerAgentFlags []string
}
var Platforms = map[string]RunnerInstaller{
"ecs": &ECSRunnerInstaller{},
"kubernetes": &K8sRunnerInstaller{},
"nomad": &NomadRunnerInstaller{},
"docker": &DockerRunnerInstaller{},
}
const (
defaultRunnerTagName = "waypoint-runner"
)