1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-18 16:36:41 +00:00

Add k8s services options based on k8s version

This commit is contained in:
moelsayed
2018-04-11 19:28:26 +02:00
parent e00cba778a
commit 493d296c28

View File

@@ -114,6 +114,14 @@ func (c *Cluster) BuildKubeAPIProcess() v3.Process {
if len(c.CloudProvider.Name) > 0 {
CommandArgs["cloud-config"] = CloudConfigPath
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.KubeAPI != nil {
for k, v := range serviceOptions.KubeAPI {
CommandArgs[k] = v
}
}
args := []string{
"--etcd-cafile=" + etcdCAClientCert,
"--etcd-certfile=" + etcdClientCert,
@@ -196,6 +204,15 @@ func (c *Cluster) BuildKubeControllerProcess() v3.Process {
if len(c.CloudProvider.Name) > 0 {
CommandArgs["cloud-config"] = CloudConfigPath
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.KubeController != nil {
for k, v := range serviceOptions.KubeController {
CommandArgs[k] = v
}
}
args := []string{}
if c.Authorization.Mode == services.RBACAuthorizationMode {
args = append(args, "--use-service-account-credentials=true")
@@ -275,6 +292,15 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host) v3.Process {
if len(c.CloudProvider.Name) > 0 {
CommandArgs["cloud-config"] = CloudConfigPath
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Kubelet != nil {
for k, v := range serviceOptions.Kubelet {
CommandArgs[k] = v
}
}
VolumesFrom := []string{
services.SidekickContainerName,
}
@@ -340,6 +366,14 @@ func (c *Cluster) BuildKubeProxyProcess() v3.Process {
"kubeconfig": pki.GetConfigPath(pki.KubeProxyCertName),
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Kubeproxy != nil {
for k, v := range serviceOptions.Kubeproxy {
CommandArgs[k] = v
}
}
VolumesFrom := []string{
services.SidekickContainerName,
}
@@ -415,6 +449,14 @@ func (c *Cluster) BuildSchedulerProcess() v3.Process {
"kubeconfig": pki.GetConfigPath(pki.KubeSchedulerCertName),
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Scheduler != nil {
for k, v := range serviceOptions.Scheduler {
CommandArgs[k] = v
}
}
VolumesFrom := []string{
services.SidekickContainerName,
}