1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-18 08:06:20 +00:00

Merge pull request #514 from moelsayed/fix_511

Use kubernetes major version for service options
This commit is contained in:
Alena Prokharchyk
2018-04-17 16:54:00 -07:00
committed by GitHub
4 changed files with 27 additions and 12 deletions

View File

@@ -122,8 +122,8 @@ func (c *Cluster) BuildKubeAPIProcess(prefixPath string) v3.Process {
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 {
serviceOptions := GetKubernetesServicesOptions(c.Version)
if serviceOptions.KubeAPI != nil {
for k, v := range serviceOptions.KubeAPI {
CommandArgs[k] = v
}
@@ -213,8 +213,8 @@ func (c *Cluster) BuildKubeControllerProcess(prefixPath string) v3.Process {
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.KubeController != nil {
serviceOptions := GetKubernetesServicesOptions(c.Version)
if serviceOptions.KubeController != nil {
for k, v := range serviceOptions.KubeController {
CommandArgs[k] = v
}
@@ -302,8 +302,8 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string) v3.Pr
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Kubelet != nil {
serviceOptions := GetKubernetesServicesOptions(c.Version)
if serviceOptions.Kubelet != nil {
for k, v := range serviceOptions.Kubelet {
CommandArgs[k] = v
}
@@ -375,8 +375,8 @@ func (c *Cluster) BuildKubeProxyProcess(prefixPath string) v3.Process {
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Kubeproxy != nil {
serviceOptions := GetKubernetesServicesOptions(c.Version)
if serviceOptions.Kubeproxy != nil {
for k, v := range serviceOptions.Kubeproxy {
CommandArgs[k] = v
}
@@ -458,8 +458,8 @@ func (c *Cluster) BuildSchedulerProcess(prefixPath string) v3.Process {
}
// check if our version has specific options for this component
serviceOptions, ok := v3.K8sVersionServiceOptions[c.Version]
if ok && serviceOptions.Scheduler != nil {
serviceOptions := GetKubernetesServicesOptions(c.Version)
if serviceOptions.Scheduler != nil {
for k, v := range serviceOptions.Scheduler {
CommandArgs[k] = v
}
@@ -609,3 +609,13 @@ func (c *Cluster) getPrefixPath(osType string) string {
}
return prefixPath
}
func GetKubernetesServicesOptions(version string) v3.KubernetesServicesOptions {
splitVersion := strings.Split(version, ".")
majorVersion := strings.Join(splitVersion[:2], ".")
serviceOptions, ok := v3.K8sVersionServiceOptions[majorVersion]
if ok {
return serviceOptions
}
return v3.KubernetesServicesOptions{}
}

View File

@@ -24,4 +24,4 @@ github.com/coreos/go-semver e214231b295a8ea9479f11b70b35d5acf3556d9
github.com/ugorji/go/codec ccfe18359b55b97855cee1d3f74e5efbda4869dc
github.com/rancher/norman ff60298f31f081b06d198815b4c178a578664f7d
github.com/rancher/types 32ed9ccfe5b3ffd6acff15e354c0dd713f5b88d7
github.com/rancher/types 681245a6f5e7b007ae58f0eb3e9f956d93930368

View File

@@ -28,6 +28,9 @@ const (
ClusterConditionconditionDefautlProjectCreated condition.Cond = "DefaultProjectCreated"
// ClusterConditionDefaultNamespaceAssigned true when cluster's default namespace has been initially assigned
ClusterConditionDefaultNamespaceAssigned condition.Cond = "DefaultNamespaceAssigned"
// ClusterConditionSystemNamespacesAssigned true when cluster's system namespaces has been initially assigned to
// a system project
ClusterConditionSystemNamespacesAssigned condition.Cond = "SystemNamespacesAssigned"
ClusterConditionAddonDeploy condition.Cond = "AddonDeploy"
ClusterConditionSystemAccountCreated condition.Cond = "SystemAccountCreated"
ClusterConditionAgentDeployed condition.Cond = "AgentDeployed"

View File

@@ -4,6 +4,8 @@ const (
K8sV18 = "v1.8.10-rancher1-1"
K8sV19 = "v1.9.5-rancher1-1"
K8sV110 = "v1.10.0-rancher1-1"
MajorK8sV110 = "v1.10"
)
var (
@@ -16,7 +18,7 @@ var (
// K8sVersionServiceOptions - service options per k8s version
K8sVersionServiceOptions = map[string]KubernetesServicesOptions{
K8sV110: v110ServiceOptions,
MajorK8sV110: v110ServiceOptions,
}
// K8SVersionToSystemImages16 - images map for 1.6. Keeping it sepate in case we have to diverge