1
0
mirror of https://github.com/rancher/rke.git synced 2025-05-10 09:24:32 +00:00

use docker versions from k8s metadata

This commit is contained in:
kinarashah 2019-07-15 10:58:09 -07:00 committed by Alena Prokharchyk
parent e1e98a84d8
commit b4a7b7aa70
3 changed files with 11 additions and 14 deletions

View File

@ -20,6 +20,7 @@ import (
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"github.com/rancher/rke/log"
"github.com/rancher/rke/metadata"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/sets"
@ -35,17 +36,6 @@ const (
RetryCount = 3
)
var K8sDockerVersions = map[string][]string{
"1.8": {"1.11.x", "1.12.x", "1.13.x", "17.03.x"},
"1.9": {"1.11.x", "1.12.x", "1.13.x", "17.03.x", "18.06.x", "18.09.x"},
"1.10": {"1.11.x", "1.12.x", "1.13.x", "17.03.x", "18.06.x", "18.09.x"},
"1.11": {"1.11.x", "1.12.x", "1.13.x", "17.03.x", "18.06.x", "18.09.x"},
"1.12": {"1.11.x", "1.12.x", "1.13.x", "17.03.x", "17.06.x", "17.09.x", "18.06.x", "18.09.x"},
"1.13": {"1.11.x", "1.12.x", "1.13.x", "17.03.x", "17.06.x", "17.09.x", "18.06.x", "18.09.x"},
"1.14": {"1.13.x", "17.03.x", "17.06.x", "17.09.x", "18.06.x", "18.09.x"},
"1.15": {"1.13.x", "17.03.x", "17.06.x", "17.09.x", "18.06.x", "18.09.x"},
}
type dockerConfig struct {
Auths map[string]authConfig `json:"auths,omitempty"`
}
@ -533,7 +523,7 @@ func IsSupportedDockerVersion(info types.Info, K8sVersion string) (bool, error)
if err != nil {
return false, err
}
for _, DockerVersion := range K8sDockerVersions[K8sVersion] {
for _, DockerVersion := range metadata.K8sVersionToDockerVersions[K8sVersion] {
supportedDockerVersion, err := convertToSemver(DockerVersion)
if err != nil {
return false, err

View File

@ -3,6 +3,7 @@ package hosts
import (
"context"
"fmt"
"github.com/rancher/rke/metadata"
"io/ioutil"
"os"
"path/filepath"
@ -76,9 +77,9 @@ func checkDockerVersion(ctx context.Context, h *Host, clusterVersion string) err
}
if !isvalid && !h.IgnoreDockerVersion {
return fmt.Errorf("Unsupported Docker version found [%s], supported versions are %v", info.ServerVersion, docker.K8sDockerVersions[K8sVersion])
return fmt.Errorf("Unsupported Docker version found [%s], supported versions are %v", info.ServerVersion, metadata.K8sVersionToDockerVersions[K8sVersion])
} else if !isvalid {
log.Warnf(ctx, "Unsupported Docker version found [%s], supported versions are %v", info.ServerVersion, docker.K8sDockerVersions[K8sVersion])
log.Warnf(ctx, "Unsupported Docker version found [%s], supported versions are %v", info.ServerVersion, metadata.K8sVersionToDockerVersions[K8sVersion])
}
return nil
}

View File

@ -15,6 +15,7 @@ var (
K8sVersionToTemplates map[string]map[string]string
K8sVersionToRKESystemImages map[string]v3.RKESystemImages
K8sVersionToServiceOptions map[string]v3.KubernetesServicesOptions
K8sVersionToDockerVersions map[string][]string
K8sVersionsCurrent []string
K8sBadVersions = map[string]bool{}
)
@ -23,6 +24,7 @@ func InitMetadata(ctx context.Context) error {
initK8sRKESystemImages()
initAddonTemplates()
initServiceOptions()
initDockerOptions()
return nil
}
@ -36,6 +38,10 @@ func initServiceOptions() {
K8sVersionToServiceOptions = interface{}(rke.DriverData.K8sVersionServiceOptions).(map[string]v3.KubernetesServicesOptions)
}
func initDockerOptions() {
K8sVersionToDockerVersions = rke.DriverData.K8sVersionDockerInfo
}
func initK8sRKESystemImages() {
K8sVersionToRKESystemImages = map[string]v3.RKESystemImages{}
rkeData := rke.DriverData