-
Notifications
You must be signed in to change notification settings - Fork 488
/
osd.go
49 lines (39 loc) · 1.26 KB
/
osd.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
// nolint: dupl,golint
package service
import (
"github.com/autonomy/dianemo/src/initramfs/cmd/init/pkg/constants"
"github.com/autonomy/dianemo/src/initramfs/cmd/init/pkg/service/conditions"
"github.com/autonomy/dianemo/src/initramfs/pkg/userdata"
)
// OSD implements the Service interface. It serves as the concrete type with
// the required methods.
type OSD struct{}
// Pre implements the Service interface.
func (p *OSD) Pre(data userdata.UserData) error {
return nil
}
// Post implements the Service interface.
func (p *OSD) Post(data userdata.UserData) (err error) {
return nil
}
// Cmd implements the Service interface.
func (p *OSD) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error {
cmdArgs.Name = "osd"
cmdArgs.Path = "/bin/osd"
cmdArgs.Args = []string{
"--port=50000",
"--userdata=" + constants.UserDataPath,
}
if data.Services.Kubeadm.Init == nil {
cmdArgs.Args = append(cmdArgs.Args, "--generate=true")
}
return nil
}
// Condition implements the Service interface.
func (p *OSD) Condition(data userdata.UserData) func() (bool, error) {
return conditions.None()
}
// Env implements the Service interface.
func (p *OSD) Env() []string { return []string{} }
// Type implements the Service interface.
func (p *OSD) Type() Type { return Forever }