Now, the agent calls the service script with bash with the assumptions that the agent is running together with the service:
- with same hostname
- sharing same filesystem, home path & service was started with
scripts/nebula.service stop
|
func (d *ServiceDaemon) Stop() error { |
|
cmdStr := fmt.Sprintf("cd %s && scripts/nebula.service stop %s", d.s.dir, d.s.name) |
|
log.WithField("cmd", cmdStr).Debug("Try to stop service...") |
|
cmd := exec.Command("bash", "-c", cmdStr) |
|
err := cmd.Run() |
|
if err != nil { |
For 1. it's do able like a sidecar design in both docker and k8s:
https://github.com/wey-gu/nebula-up/blob/9bd28601f9cb156d77009c724f09164b02f07393/backup_restore/docker-compose.yaml#L54-L59
While for 2. it's really hard to mitigate, introducing hooks to make this work is too hacky.
We need to revisit the design to enable service stop/start w/o assuming leveraging scripts.
Now, the agent calls the service script with bash with the assumptions that the agent is running together with the service:
scripts/nebula.service stopnebula-agent/internal/clients/daemon.go
Lines 95 to 100 in 96646b8
For 1. it's do able like a sidecar design in both docker and k8s:
https://github.com/wey-gu/nebula-up/blob/9bd28601f9cb156d77009c724f09164b02f07393/backup_restore/docker-compose.yaml#L54-L59
While for 2. it's really hard to mitigate, introducing hooks to make this work is too hacky.
We need to revisit the design to enable service stop/start w/o assuming leveraging scripts.