2017-10-29 11:45:21 +02:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
2018-01-09 15:10:56 -07:00
|
|
|
"context"
|
2017-11-14 20:11:21 +02:00
|
|
|
|
2017-10-31 15:55:35 +02:00
|
|
|
"github.com/rancher/rke/docker"
|
2017-10-29 11:45:21 +02:00
|
|
|
"github.com/rancher/rke/hosts"
|
2017-12-05 09:55:58 -07:00
|
|
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
2017-10-29 11:45:21 +02:00
|
|
|
)
|
|
|
|
|
2018-03-21 19:20:58 +02:00
|
|
|
func runScheduler(ctx context.Context, host *hosts.Host, df hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, schedulerProcess v3.Process, alpineImage string) error {
|
2018-02-26 16:27:54 -07:00
|
|
|
imageCfg, hostCfg, healthCheckURL := GetProcessConfig(schedulerProcess)
|
2018-01-31 19:50:55 +02:00
|
|
|
if err := docker.DoRunContainer(ctx, host.DClient, imageCfg, hostCfg, SchedulerContainerName, host.Address, ControlRole, prsMap); err != nil {
|
2017-12-20 00:18:27 +02:00
|
|
|
return err
|
|
|
|
}
|
2018-03-21 19:20:58 +02:00
|
|
|
if err := runHealthcheck(ctx, host, SchedulerContainerName, df, healthCheckURL, nil); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return createLogLink(ctx, host, SchedulerContainerName, ControlRole, alpineImage, prsMap)
|
2017-10-29 11:45:21 +02:00
|
|
|
}
|
2017-11-20 20:08:50 +02:00
|
|
|
|
2018-01-09 15:10:56 -07:00
|
|
|
func removeScheduler(ctx context.Context, host *hosts.Host) error {
|
|
|
|
return docker.DoRemoveContainer(ctx, host.DClient, SchedulerContainerName, host.Address)
|
2017-11-20 20:08:50 +02:00
|
|
|
}
|
2018-08-20 06:37:04 +02:00
|
|
|
|
2019-01-14 19:51:20 +02:00
|
|
|
func RestartScheduler(ctx context.Context, host *hosts.Host) error {
|
2018-08-20 06:37:04 +02:00
|
|
|
return docker.DoRestartContainer(ctx, host.DClient, SchedulerContainerName, host.Address)
|
|
|
|
}
|