mirror of
https://github.com/rancher/rke.git
synced 2025-08-12 12:13:25 +00:00
Refactor types
This commit is contained in:
parent
4a17ce82e3
commit
df7e40188e
@ -9,16 +9,16 @@ import (
|
|||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/rke/services"
|
"github.com/rancher/rke/services"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
yaml "gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
"k8s.io/client-go/util/cert"
|
"k8s.io/client-go/util/cert"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
v1.RancherKubernetesEngineConfig `yaml:",inline"`
|
v3.RancherKubernetesEngineConfig `yaml:",inline"`
|
||||||
ConfigPath string `yaml:"config_path"`
|
ConfigPath string `yaml:"config_path"`
|
||||||
LocalKubeConfigPath string
|
LocalKubeConfigPath string
|
||||||
EtcdHosts []*hosts.Host
|
EtcdHosts []*hosts.Host
|
||||||
|
@ -10,10 +10,10 @@ import (
|
|||||||
|
|
||||||
"github.com/rancher/rke/cluster"
|
"github.com/rancher/rke/cluster"
|
||||||
"github.com/rancher/rke/services"
|
"github.com/rancher/rke/services"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
yaml "gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConfigCommand() cli.Command {
|
func ConfigCommand() cli.Command {
|
||||||
@ -60,7 +60,7 @@ func getConfig(reader *bufio.Reader, text, def string) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeConfig(cluster *v1.RancherKubernetesEngineConfig, configFile string, print bool) error {
|
func writeConfig(cluster *v3.RancherKubernetesEngineConfig, configFile string, print bool) error {
|
||||||
yamlConfig, err := yaml.Marshal(*cluster)
|
yamlConfig, err := yaml.Marshal(*cluster)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -78,14 +78,14 @@ func writeConfig(cluster *v1.RancherKubernetesEngineConfig, configFile string, p
|
|||||||
func clusterConfig(ctx *cli.Context) error {
|
func clusterConfig(ctx *cli.Context) error {
|
||||||
configFile := ctx.String("name")
|
configFile := ctx.String("name")
|
||||||
print := ctx.Bool("print")
|
print := ctx.Bool("print")
|
||||||
cluster := v1.RancherKubernetesEngineConfig{}
|
cluster := v3.RancherKubernetesEngineConfig{}
|
||||||
|
|
||||||
// Get cluster config from user
|
// Get cluster config from user
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
||||||
// Generate empty configuration file
|
// Generate empty configuration file
|
||||||
if ctx.Bool("empty") {
|
if ctx.Bool("empty") {
|
||||||
cluster.Nodes = make([]v1.RKEConfigNode, 1)
|
cluster.Nodes = make([]v3.RKEConfigNode, 1)
|
||||||
return writeConfig(&cluster, configFile, print)
|
return writeConfig(&cluster, configFile, print)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ func clusterConfig(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Hosts config
|
// Get Hosts config
|
||||||
cluster.Nodes = make([]v1.RKEConfigNode, 0)
|
cluster.Nodes = make([]v3.RKEConfigNode, 0)
|
||||||
for i := 0; i < numberOfHostsInt; i++ {
|
for i := 0; i < numberOfHostsInt; i++ {
|
||||||
hostCfg, err := getHostConfig(reader, i)
|
hostCfg, err := getHostConfig(reader, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -139,8 +139,8 @@ func clusterConfig(ctx *cli.Context) error {
|
|||||||
return writeConfig(&cluster, configFile, print)
|
return writeConfig(&cluster, configFile, print)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHostConfig(reader *bufio.Reader, index int) (*v1.RKEConfigNode, error) {
|
func getHostConfig(reader *bufio.Reader, index int) (*v3.RKEConfigNode, error) {
|
||||||
host := v1.RKEConfigNode{}
|
host := v3.RKEConfigNode{}
|
||||||
|
|
||||||
address, err := getConfig(reader, fmt.Sprintf("SSH Address of host (%d)", index+1), "")
|
address, err := getConfig(reader, fmt.Sprintf("SSH Address of host (%d)", index+1), "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -210,14 +210,14 @@ func getHostConfig(reader *bufio.Reader, index int) (*v1.RKEConfigNode, error) {
|
|||||||
return &host, nil
|
return &host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getServiceConfig(reader *bufio.Reader) (*v1.RKEConfigServices, error) {
|
func getServiceConfig(reader *bufio.Reader) (*v3.RKEConfigServices, error) {
|
||||||
servicesConfig := v1.RKEConfigServices{}
|
servicesConfig := v3.RKEConfigServices{}
|
||||||
servicesConfig.Etcd = v1.ETCDService{}
|
servicesConfig.Etcd = v3.ETCDService{}
|
||||||
servicesConfig.KubeAPI = v1.KubeAPIService{}
|
servicesConfig.KubeAPI = v3.KubeAPIService{}
|
||||||
servicesConfig.KubeController = v1.KubeControllerService{}
|
servicesConfig.KubeController = v3.KubeControllerService{}
|
||||||
servicesConfig.Scheduler = v1.SchedulerService{}
|
servicesConfig.Scheduler = v3.SchedulerService{}
|
||||||
servicesConfig.Kubelet = v1.KubeletService{}
|
servicesConfig.Kubelet = v3.KubeletService{}
|
||||||
servicesConfig.Kubeproxy = v1.KubeproxyService{}
|
servicesConfig.Kubeproxy = v3.KubeproxyService{}
|
||||||
|
|
||||||
etcdImage, err := getConfig(reader, "Etcd Docker Image", "quay.io/coreos/etcd:latest")
|
etcdImage, err := getConfig(reader, "Etcd Docker Image", "quay.io/coreos/etcd:latest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -268,8 +268,8 @@ func getServiceConfig(reader *bufio.Reader) (*v1.RKEConfigServices, error) {
|
|||||||
return &servicesConfig, nil
|
return &servicesConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAuthConfig(reader *bufio.Reader) (*v1.AuthConfig, error) {
|
func getAuthConfig(reader *bufio.Reader) (*v3.AuthConfig, error) {
|
||||||
authConfig := v1.AuthConfig{}
|
authConfig := v3.AuthConfig{}
|
||||||
|
|
||||||
authType, err := getConfig(reader, "Authentication Strategy", "x509")
|
authType, err := getConfig(reader, "Authentication Strategy", "x509")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -279,8 +279,8 @@ func getAuthConfig(reader *bufio.Reader) (*v1.AuthConfig, error) {
|
|||||||
return &authConfig, nil
|
return &authConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNetworkConfig(reader *bufio.Reader) (*v1.NetworkConfig, error) {
|
func getNetworkConfig(reader *bufio.Reader) (*v3.NetworkConfig, error) {
|
||||||
networkConfig := v1.NetworkConfig{}
|
networkConfig := v3.NetworkConfig{}
|
||||||
|
|
||||||
networkPlugin, err := getConfig(reader, "Network Plugin Type", "flannel")
|
networkPlugin, err := getConfig(reader, "Network Plugin Type", "flannel")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,14 +7,14 @@ import (
|
|||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/k8s"
|
"github.com/rancher/rke/k8s"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Host struct {
|
type Host struct {
|
||||||
v1.RKEConfigNode
|
v3.RKEConfigNode
|
||||||
DClient *client.Client
|
DClient *client.Client
|
||||||
IsControl bool
|
IsControl bool
|
||||||
IsWorker bool
|
IsWorker bool
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -18,7 +18,7 @@ const (
|
|||||||
func TestPKI(t *testing.T) {
|
func TestPKI(t *testing.T) {
|
||||||
cpHosts := []*hosts.Host{
|
cpHosts := []*hosts.Host{
|
||||||
&hosts.Host{
|
&hosts.Host{
|
||||||
RKEConfigNode: v1.RKEConfigNode{
|
RKEConfigNode: v3.RKEConfigNode{
|
||||||
Address: "1.1.1.1",
|
Address: "1.1.1.1",
|
||||||
InternalAddress: "192.168.1.5",
|
InternalAddress: "192.168.1.5",
|
||||||
Role: []string{"controlplane"},
|
Role: []string{"controlplane"},
|
||||||
|
@ -2,11 +2,11 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunControlPlane(controlHosts []*hosts.Host, etcdHosts []*hosts.Host, controlServices v1.RKEConfigServices) error {
|
func RunControlPlane(controlHosts []*hosts.Host, etcdHosts []*hosts.Host, controlServices v3.RKEConfigServices) error {
|
||||||
logrus.Infof("[%s] Building up Controller Plane..", ControlRole)
|
logrus.Infof("[%s] Building up Controller Plane..", ControlRole)
|
||||||
for _, host := range controlHosts {
|
for _, host := range controlHosts {
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@ import (
|
|||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunEtcdPlane(etcdHosts []*hosts.Host, etcdService v1.ETCDService) error {
|
func RunEtcdPlane(etcdHosts []*hosts.Host, etcdService v3.ETCDService) error {
|
||||||
logrus.Infof("[%s] Building up Etcd Plane..", ETCDRole)
|
logrus.Infof("[%s] Building up Etcd Plane..", ETCDRole)
|
||||||
initCluster := getEtcdInitialCluster(etcdHosts)
|
initCluster := getEtcdInitialCluster(etcdHosts)
|
||||||
for _, host := range etcdHosts {
|
for _, host := range etcdHosts {
|
||||||
@ -37,7 +37,7 @@ func RemoveEtcdPlane(etcdHosts []*hosts.Host) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildEtcdConfig(host *hosts.Host, etcdService v1.ETCDService, initCluster string) (*container.Config, *container.HostConfig) {
|
func buildEtcdConfig(host *hosts.Host, etcdService v3.ETCDService, initCluster string) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: etcdService.Image,
|
Image: etcdService.Image,
|
||||||
Cmd: []string{"/usr/local/bin/etcd",
|
Cmd: []string{"/usr/local/bin/etcd",
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runKubeAPI(host *hosts.Host, etcdHosts []*hosts.Host, kubeAPIService v1.KubeAPIService) error {
|
func runKubeAPI(host *hosts.Host, etcdHosts []*hosts.Host, kubeAPIService v3.KubeAPIService) error {
|
||||||
etcdConnString := GetEtcdConnString(etcdHosts)
|
etcdConnString := GetEtcdConnString(etcdHosts)
|
||||||
imageCfg, hostCfg := buildKubeAPIConfig(host, kubeAPIService, etcdConnString)
|
imageCfg, hostCfg := buildKubeAPIConfig(host, kubeAPIService, etcdConnString)
|
||||||
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeAPIContainerName, host.Address, ControlRole)
|
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeAPIContainerName, host.Address, ControlRole)
|
||||||
@ -21,7 +21,7 @@ func removeKubeAPI(host *hosts.Host) error {
|
|||||||
return docker.DoRemoveContainer(host.DClient, KubeAPIContainerName, host.Address)
|
return docker.DoRemoveContainer(host.DClient, KubeAPIContainerName, host.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildKubeAPIConfig(host *hosts.Host, kubeAPIService v1.KubeAPIService, etcdConnString string) (*container.Config, *container.HostConfig) {
|
func buildKubeAPIConfig(host *hosts.Host, kubeAPIService v3.KubeAPIService, etcdConnString string) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: kubeAPIService.Image,
|
Image: kubeAPIService.Image,
|
||||||
Entrypoint: []string{"kube-apiserver",
|
Entrypoint: []string{"kube-apiserver",
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runKubeController(host *hosts.Host, kubeControllerService v1.KubeControllerService) error {
|
func runKubeController(host *hosts.Host, kubeControllerService v3.KubeControllerService) error {
|
||||||
imageCfg, hostCfg := buildKubeControllerConfig(kubeControllerService)
|
imageCfg, hostCfg := buildKubeControllerConfig(kubeControllerService)
|
||||||
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeControllerContainerName, host.Address, ControlRole)
|
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeControllerContainerName, host.Address, ControlRole)
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ func removeKubeController(host *hosts.Host) error {
|
|||||||
return docker.DoRemoveContainer(host.DClient, KubeControllerContainerName, host.Address)
|
return docker.DoRemoveContainer(host.DClient, KubeControllerContainerName, host.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildKubeControllerConfig(kubeControllerService v1.KubeControllerService) (*container.Config, *container.HostConfig) {
|
func buildKubeControllerConfig(kubeControllerService v3.KubeControllerService) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: kubeControllerService.Image,
|
Image: kubeControllerService.Image,
|
||||||
Entrypoint: []string{"kube-controller-manager",
|
Entrypoint: []string{"kube-controller-manager",
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runKubelet(host *hosts.Host, kubeletService v1.KubeletService) error {
|
func runKubelet(host *hosts.Host, kubeletService v3.KubeletService) error {
|
||||||
imageCfg, hostCfg := buildKubeletConfig(host, kubeletService)
|
imageCfg, hostCfg := buildKubeletConfig(host, kubeletService)
|
||||||
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeletContainerName, host.Address, WorkerRole)
|
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeletContainerName, host.Address, WorkerRole)
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ func removeKubelet(host *hosts.Host) error {
|
|||||||
return docker.DoRemoveContainer(host.DClient, KubeletContainerName, host.Address)
|
return docker.DoRemoveContainer(host.DClient, KubeletContainerName, host.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildKubeletConfig(host *hosts.Host, kubeletService v1.KubeletService) (*container.Config, *container.HostConfig) {
|
func buildKubeletConfig(host *hosts.Host, kubeletService v3.KubeletService) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: kubeletService.Image,
|
Image: kubeletService.Image,
|
||||||
Entrypoint: []string{"kubelet",
|
Entrypoint: []string{"kubelet",
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runKubeproxy(host *hosts.Host, kubeproxyService v1.KubeproxyService) error {
|
func runKubeproxy(host *hosts.Host, kubeproxyService v3.KubeproxyService) error {
|
||||||
imageCfg, hostCfg := buildKubeproxyConfig(host, kubeproxyService)
|
imageCfg, hostCfg := buildKubeproxyConfig(host, kubeproxyService)
|
||||||
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeproxyContainerName, host.Address, WorkerRole)
|
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, KubeproxyContainerName, host.Address, WorkerRole)
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ func removeKubeproxy(host *hosts.Host) error {
|
|||||||
return docker.DoRemoveContainer(host.DClient, KubeproxyContainerName, host.Address)
|
return docker.DoRemoveContainer(host.DClient, KubeproxyContainerName, host.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildKubeproxyConfig(host *hosts.Host, kubeproxyService v1.KubeproxyService) (*container.Config, *container.HostConfig) {
|
func buildKubeproxyConfig(host *hosts.Host, kubeproxyService v3.KubeproxyService) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: kubeproxyService.Image,
|
Image: kubeproxyService.Image,
|
||||||
Entrypoint: []string{"kube-proxy",
|
Entrypoint: []string{"kube-proxy",
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
"github.com/rancher/rke/docker"
|
"github.com/rancher/rke/docker"
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/rke/pki"
|
"github.com/rancher/rke/pki"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runScheduler(host *hosts.Host, schedulerService v1.SchedulerService) error {
|
func runScheduler(host *hosts.Host, schedulerService v3.SchedulerService) error {
|
||||||
imageCfg, hostCfg := buildSchedulerConfig(host, schedulerService)
|
imageCfg, hostCfg := buildSchedulerConfig(host, schedulerService)
|
||||||
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, SchedulerContainerName, host.Address, ControlRole)
|
return docker.DoRunContainer(host.DClient, imageCfg, hostCfg, SchedulerContainerName, host.Address, ControlRole)
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ func removeScheduler(host *hosts.Host) error {
|
|||||||
return docker.DoRemoveContainer(host.DClient, SchedulerContainerName, host.Address)
|
return docker.DoRemoveContainer(host.DClient, SchedulerContainerName, host.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSchedulerConfig(host *hosts.Host, schedulerService v1.SchedulerService) (*container.Config, *container.HostConfig) {
|
func buildSchedulerConfig(host *hosts.Host, schedulerService v3.SchedulerService) (*container.Config, *container.HostConfig) {
|
||||||
imageCfg := &container.Config{
|
imageCfg := &container.Config{
|
||||||
Image: schedulerService.Image,
|
Image: schedulerService.Image,
|
||||||
Entrypoint: []string{"kube-scheduler",
|
Entrypoint: []string{"kube-scheduler",
|
||||||
|
@ -2,11 +2,11 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rancher/rke/hosts"
|
"github.com/rancher/rke/hosts"
|
||||||
"github.com/rancher/types/apis/cluster.cattle.io/v1"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunWorkerPlane(controlHosts []*hosts.Host, workerHosts []*hosts.Host, workerServices v1.RKEConfigServices) error {
|
func RunWorkerPlane(controlHosts []*hosts.Host, workerHosts []*hosts.Host, workerServices v3.RKEConfigServices) error {
|
||||||
logrus.Infof("[%s] Building up Worker Plane..", WorkerRole)
|
logrus.Infof("[%s] Building up Worker Plane..", WorkerRole)
|
||||||
for _, host := range controlHosts {
|
for _, host := range controlHosts {
|
||||||
// only one master for now
|
// only one master for now
|
||||||
|
Loading…
Reference in New Issue
Block a user