2017-10-29 09:45:21 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
2018-01-09 22:10:56 +00:00
|
|
|
"context"
|
2017-11-14 18:11:21 +00:00
|
|
|
|
2017-10-31 13:55:35 +00:00
|
|
|
"github.com/rancher/rke/docker"
|
2017-10-29 09:45:21 +00:00
|
|
|
"github.com/rancher/rke/hosts"
|
2017-12-05 16:55:58 +00:00
|
|
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
2017-10-29 09:45:21 +00:00
|
|
|
)
|
|
|
|
|
2018-02-13 00:47:56 +00:00
|
|
|
func runKubelet(ctx context.Context, host *hosts.Host, df hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, kubeletProcess v3.Process) error {
|
2018-02-26 23:27:54 +00:00
|
|
|
imageCfg, hostCfg, healthCheckURL := GetProcessConfig(kubeletProcess)
|
2018-01-31 17:50:55 +00:00
|
|
|
if err := docker.DoRunContainer(ctx, host.DClient, imageCfg, hostCfg, KubeletContainerName, host.Address, WorkerRole, prsMap); err != nil {
|
2017-12-19 22:18:27 +00:00
|
|
|
return err
|
|
|
|
}
|
2018-02-13 00:47:56 +00:00
|
|
|
return runHealthcheck(ctx, host, KubeletContainerName, df, healthCheckURL)
|
2017-10-29 09:45:21 +00:00
|
|
|
}
|
|
|
|
|
2018-01-09 22:10:56 +00:00
|
|
|
func removeKubelet(ctx context.Context, host *hosts.Host) error {
|
|
|
|
return docker.DoRemoveContainer(ctx, host.DClient, KubeletContainerName, host.Address)
|
2017-11-20 18:08:50 +00:00
|
|
|
}
|