mirror of
https://github.com/rancher/rke.git
synced 2025-05-06 07:17:10 +00:00
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package services
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rancher/rke/docker"
|
|
"github.com/rancher/rke/hosts"
|
|
"github.com/rancher/rke/pki"
|
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
|
)
|
|
|
|
func runKubeAPI(ctx context.Context, host *hosts.Host, df hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, kubeAPIProcess v3.Process, alpineImage string, certMap map[string]pki.CertificatePKI) error {
|
|
|
|
imageCfg, hostCfg, healthCheckURL := GetProcessConfig(kubeAPIProcess)
|
|
if err := docker.DoRunContainer(ctx, host.DClient, imageCfg, hostCfg, KubeAPIContainerName, host.Address, ControlRole, prsMap); err != nil {
|
|
return err
|
|
}
|
|
if err := runHealthcheck(ctx, host, KubeAPIContainerName, df, healthCheckURL, certMap); err != nil {
|
|
return err
|
|
}
|
|
return createLogLink(ctx, host, KubeAPIContainerName, ControlRole, alpineImage, prsMap)
|
|
}
|
|
|
|
func removeKubeAPI(ctx context.Context, host *hosts.Host) error {
|
|
return docker.DoRemoveContainer(ctx, host.DClient, KubeAPIContainerName, host.Address)
|
|
}
|
|
|
|
func RestartKubeAPI(ctx context.Context, host *hosts.Host) error {
|
|
return docker.DoRestartContainer(ctx, host.DClient, KubeAPIContainerName, host.Address)
|
|
}
|