Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
8b7aaba6
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8b7aaba6
编写于
12月 10, 2019
作者:
T
Thomas Stromberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sync correct Kubernetes versions from kubeadm constants
上级
434648c6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
97 addition
and
177 deletion
+97
-177
cmd/minikube/cmd/start.go
cmd/minikube/cmd/start.go
+2
-2
pkg/minikube/bootstrapper/bootstrapper.go
pkg/minikube/bootstrapper/bootstrapper.go
+3
-4
pkg/minikube/bootstrapper/images/images.go
pkg/minikube/bootstrapper/images/images.go
+40
-165
pkg/minikube/bootstrapper/images/repo.go
pkg/minikube/bootstrapper/images/repo.go
+36
-0
pkg/minikube/bootstrapper/kubeadm/kubeadm.go
pkg/minikube/bootstrapper/kubeadm/kubeadm.go
+5
-2
pkg/minikube/cruntime/containerd.go
pkg/minikube/cruntime/containerd.go
+1
-1
pkg/minikube/cruntime/cri.go
pkg/minikube/cruntime/cri.go
+1
-1
pkg/minikube/machine/cache_images.go
pkg/minikube/machine/cache_images.go
+4
-1
test/integration/a_serial_test.go
test/integration/a_serial_test.go
+5
-1
未找到文件。
cmd/minikube/cmd/start.go
浏览文件 @
8b7aaba6
...
...
@@ -673,7 +673,7 @@ func selectImageRepository(mirrorCountry string, k8sVersion string) (bool, strin
}
checkRepository
:=
func
(
repo
string
)
error
{
pauseImage
:=
images
.
Pause
Image
(
repo
,
k8sVersion
)
pauseImage
:=
images
.
Pause
(
repo
)
ref
,
err
:=
name
.
ParseReference
(
pauseImage
,
name
.
WeakValidation
)
if
err
!=
nil
{
return
err
...
...
@@ -1108,7 +1108,7 @@ func tryRegistry(r command.Runner) {
repo
:=
viper
.
GetString
(
imageRepository
)
if
repo
==
""
{
repo
=
images
.
Default
Image
Repo
repo
=
images
.
Default
Kubernetes
Repo
}
opts
=
append
(
opts
,
fmt
.
Sprintf
(
"https://%s/"
,
repo
))
...
...
pkg/minikube/bootstrapper/bootstrapper.go
浏览文件 @
8b7aaba6
...
...
@@ -64,12 +64,11 @@ func GetCachedBinaryList(bootstrapper string) []string {
}
// GetCachedImageList returns the list of images for a version
func
GetCachedImageList
(
imageRepository
string
,
version
string
,
bootstrapper
string
)
[]
string
{
func
GetCachedImageList
(
imageRepository
string
,
version
string
,
bootstrapper
string
)
([]
string
,
error
)
{
switch
bootstrapper
{
case
BootstrapperTypeKubeadm
:
images
:=
images
.
CachedImages
(
imageRepository
,
version
)
return
images
return
images
.
Kubeadm
(
imageRepository
,
version
)
default
:
return
[]
string
{}
return
[]
string
{}
,
nil
}
}
pkg/minikube/bootstrapper/images/images.go
浏览文件 @
8b7aaba6
/*
Copyright 201
6
The Kubernetes Authors All rights reserved.
Copyright 201
9
The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
...
...
@@ -14,188 +14,63 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package images implements helpers for getting image names
package
images
import
(
"path"
"runtime"
"strings"
"github.com/blang/semver"
"github.com/golang/glog"
minikubeVersion
"k8s.io/minikube/pkg/version"
)
const
(
// DefaultImageRepo is the default repository for images
DefaultImageRepo
=
"k8s.gcr.io"
// DefaultMinikubeRepo is the default repository for minikube
DefaultMinikubeRepo
=
"gcr.io/k8s-minikube"
)
// getImageRepositories returns either the k8s image registry on GCR or a mirror if specified
func
getImageRepository
(
imageRepository
string
)
string
{
if
imageRepository
==
""
{
imageRepository
=
DefaultImageRepo
}
if
!
strings
.
HasSuffix
(
imageRepository
,
"/"
)
{
imageRepository
+=
"/"
// ArchTag returns a CPU architecture suffix for images
func
ArchTag
(
hasTag
bool
)
string
{
if
runtime
.
GOARCH
==
"amd64"
&&
!
hasTag
{
return
":"
}
return
imageRepository
return
"-"
+
runtime
.
GOARCH
+
":"
}
// getMinikubeRepository returns either the minikube image registry on GCR or a mirror if specified
func
getMinikubeRepository
(
imageRepository
string
)
string
{
minikubeRepository
:=
imageRepository
if
minikubeRepository
==
""
{
minikubeRepository
=
DefaultMinikubeRepo
}
if
!
strings
.
HasSuffix
(
minikubeRepository
,
"/"
)
{
minikubeRepository
+=
"/"
// Auxiliary returns images that are helpful for running minikube
func
Auxiliary
(
mirror
string
)
[]
string
{
return
[]
string
{
addonManager
(
mirror
),
storageProvisioner
(
mirror
),
dashboardFrontend
(
mirror
),
dashboardMetrics
(
mirror
),
}
return
minikubeRepository
}
// CachedImages gets the images to cache for kubeadm for a version
func
CachedImages
(
imageRepositoryStr
string
,
kubernetesVersionStr
string
)
[]
string
{
imageRepository
:=
getImageRepository
(
imageRepositoryStr
)
minikubeRepository
:=
getMinikubeRepository
(
imageRepositoryStr
)
v1_16plus
:=
semver
.
MustParseRange
(
">=1.16.0"
)
v1_14plus
:=
semver
.
MustParseRange
(
">=1.14.0 <1.16.0"
)
v1_13
:=
semver
.
MustParseRange
(
">=1.13.0 <1.14.0"
)
v1_12
:=
semver
.
MustParseRange
(
">=1.12.0 <1.13.0"
)
v1_11
:=
semver
.
MustParseRange
(
">=1.11.0 <1.12.0"
)
v1_12plus
:=
semver
.
MustParseRange
(
">=1.12.0"
)
kubernetesVersion
,
err
:=
semver
.
Make
(
strings
.
TrimPrefix
(
kubernetesVersionStr
,
minikubeVersion
.
VersionPrefix
))
if
err
!=
nil
{
glog
.
Errorln
(
"Error parsing version semver: "
,
err
)
}
var
images
[]
string
if
v1_12plus
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
imageRepository
+
"kube-proxy"
+
ArchTag
(
false
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-scheduler"
+
ArchTag
(
false
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-controller-manager"
+
ArchTag
(
false
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-apiserver"
+
ArchTag
(
false
)
+
kubernetesVersionStr
,
}
...
)
}
else
{
images
=
append
(
images
,
[]
string
{
imageRepository
+
"kube-proxy"
+
ArchTag
(
true
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-scheduler"
+
ArchTag
(
true
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-controller-manager"
+
ArchTag
(
true
)
+
kubernetesVersionStr
,
imageRepository
+
"kube-apiserver"
+
ArchTag
(
true
)
+
kubernetesVersionStr
,
}
...
)
}
podInfraContainerImage
:=
PauseImage
(
imageRepository
,
kubernetesVersionStr
)
if
v1_16plus
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
podInfraContainerImage
,
imageRepository
+
"k8s-dns-kube-dns"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"k8s-dns-dnsmasq-nanny"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"k8s-dns-sidecar"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"etcd"
+
ArchTag
(
false
)
+
"3.3.15-0"
,
imageRepository
+
"coredns"
+
ArchTag
(
false
)
+
"1.6.2"
,
}
...
)
}
else
if
v1_14plus
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
podInfraContainerImage
,
imageRepository
+
"k8s-dns-kube-dns"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"k8s-dns-dnsmasq-nanny"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"k8s-dns-sidecar"
+
ArchTag
(
true
)
+
"1.14.13"
,
imageRepository
+
"etcd"
+
ArchTag
(
false
)
+
"3.3.10"
,
imageRepository
+
"coredns"
+
ArchTag
(
false
)
+
"1.3.1"
,
}
...
)
}
else
if
v1_13
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
podInfraContainerImage
,
imageRepository
+
"k8s-dns-kube-dns"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-dnsmasq-nanny"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-sidecar"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"etcd"
+
ArchTag
(
false
)
+
"3.2.24"
,
imageRepository
+
"coredns:1.2.6"
,
}
...
)
}
else
if
v1_12
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
podInfraContainerImage
,
imageRepository
+
"k8s-dns-kube-dns"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-dnsmasq-nanny"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-sidecar"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"etcd"
+
ArchTag
(
false
)
+
"3.2.24"
,
imageRepository
+
"coredns:1.2.2"
,
}
...
)
}
else
if
v1_11
(
kubernetesVersion
)
{
images
=
append
(
images
,
[]
string
{
podInfraContainerImage
,
imageRepository
+
"k8s-dns-kube-dns"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-dnsmasq-nanny"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"k8s-dns-sidecar"
+
ArchTag
(
true
)
+
"1.14.8"
,
imageRepository
+
"etcd"
+
ArchTag
(
true
)
+
"3.2.18"
,
imageRepository
+
"coredns:1.1.3"
,
}
...
)
}
images
=
append
(
images
,
[]
string
{
// This must match deploy/addons/dashboard/dashboard-dp.yaml
"kubernetesui/dashboard:v2.0.0-beta8"
,
imageRepository
+
"kube-addon-manager"
+
ArchTag
(
false
)
+
"v9.0"
,
minikubeRepository
+
"storage-provisioner"
+
ArchTag
(
false
)
+
"v1.8.1"
,
}
...
)
return
images
// Pause returns the image name for the pause image
func
Pause
(
mirror
string
)
string
{
// Should match `PauseVersion` in:
// https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants.go
return
path
.
Join
(
KubernetesRepo
(
mirror
),
"pause"
+
ArchTag
(
false
)
+
"3.1"
)
}
// PauseImage returns the image name for pause image (for pod infra)
func
PauseImage
(
imageRepositoryStr
string
,
kubernetesVersionStr
string
)
string
{
imageRepository
:=
getImageRepository
(
imageRepositoryStr
)
v1_16plus
:=
semver
.
MustParseRange
(
">=1.16.0"
)
v1_14plus
:=
semver
.
MustParseRange
(
">=1.14.0 <1.16.0"
)
v1_13
:=
semver
.
MustParseRange
(
">=1.13.0 <1.14.0"
)
v1_12
:=
semver
.
MustParseRange
(
">=1.12.0 <1.13.0"
)
v1_11
:=
semver
.
MustParseRange
(
">=1.11.0 <1.12.0"
)
kubernetesVersion
,
err
:=
semver
.
Make
(
strings
.
TrimPrefix
(
kubernetesVersionStr
,
minikubeVersion
.
VersionPrefix
))
if
err
!=
nil
{
glog
.
Errorln
(
"Error parsing version semver: "
,
err
)
}
var
podInfraContainerImage
string
switch
{
case
v1_16plus
(
kubernetesVersion
)
:
podInfraContainerImage
=
imageRepository
+
"pause:3.1"
case
v1_14plus
(
kubernetesVersion
)
:
podInfraContainerImage
=
imageRepository
+
"pause:3.1"
case
v1_13
(
kubernetesVersion
)
:
podInfraContainerImage
=
imageRepository
+
"pause"
+
ArchTag
(
false
)
+
"3.1"
case
v1_12
(
kubernetesVersion
)
:
podInfraContainerImage
=
imageRepository
+
"pause:3.1"
// storageProvisioner returns the minikube storage provisioner image
func
storageProvisioner
(
mirror
string
)
string
{
return
path
.
Join
(
minikubeRepo
(
mirror
),
"storage-provisioner"
+
ArchTag
(
false
)
+
"v1.8.1"
)
}
case
v1_11
(
kubernetesVersion
)
:
podInfraContainerImage
=
imageRepository
+
"pause"
+
ArchTag
(
false
)
+
"3.1"
// addonManager returns the Kubernetes addon manager image
func
addonManager
(
mirror
string
)
string
{
return
path
.
Join
(
KubernetesRepo
(
mirror
),
"kube-addon-manager"
+
ArchTag
(
false
)
+
"v9.0.2"
)
}
default
:
podInfraContainerImage
=
imageRepository
+
"pause"
+
ArchTag
(
false
)
+
"3.0"
// dashboardFrontend returns the image used for the dashboard frontend
func
dashboardFrontend
(
repo
string
)
string
{
if
repo
==
""
{
repo
=
"kubernetesui"
}
return
p
odInfraContainerImage
// See 'kubernetes-dashboard' in deploy/addons/dashboard/dashboard-dp.yaml
return
p
ath
.
Join
(
repo
,
"dashboard:v2.0.0-beta8"
)
}
//
ArchTag returns the archtag for images
func
ArchTag
(
hasTag
bool
)
string
{
if
r
untime
.
GOARCH
==
"amd64"
&&
!
hasTag
{
re
turn
":
"
//
dashboardMetrics returns the image used for the dashboard metrics scraper
func
dashboardMetrics
(
repo
string
)
string
{
if
r
epo
==
""
{
re
po
=
"kubernetesui
"
}
return
"-"
+
runtime
.
GOARCH
+
":"
// See 'dashboard-metrics-scraper' in deploy/addons/dashboard/dashboard-dp.yaml
return
path
.
Join
(
repo
,
"metrics-scraper:v1.0.2"
)
}
pkg/minikube/bootstrapper/images/repo.go
0 → 100644
浏览文件 @
8b7aaba6
/*
Copyright 2019 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
images
// DefaultKubernetesRepo is the default Kubernetes repository
const
DefaultKubernetesRepo
=
"k8s.gcr.io"
// KubernetesRepo returns the official Kubernetes repository, or an alternate
func
KubernetesRepo
(
mirror
string
)
string
{
if
mirror
!=
""
{
return
mirror
}
return
DefaultKubernetesRepo
}
// minikubeRepo returns the official minikube repository, or an alternate
func
minikubeRepo
(
mirror
string
)
string
{
if
mirror
!=
""
{
return
mirror
}
return
"gcr.io/k8s-minikube"
}
pkg/minikube/bootstrapper/kubeadm/kubeadm.go
浏览文件 @
8b7aaba6
...
...
@@ -596,7 +596,7 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte,
extraOpts
[
"node-ip"
]
=
k8s
.
NodeIP
}
pauseImage
:=
images
.
Pause
Image
(
k8s
.
ImageRepository
,
k8s
.
KubernetesVersion
)
pauseImage
:=
images
.
Pause
(
k8s
.
ImageRepository
)
if
_
,
ok
:=
extraOpts
[
"pod-infra-container-image"
];
!
ok
&&
k8s
.
ImageRepository
!=
""
&&
pauseImage
!=
""
&&
k8s
.
ContainerRuntime
!=
remoteContainerRuntime
{
extraOpts
[
"pod-infra-container-image"
]
=
pauseImage
}
...
...
@@ -630,7 +630,10 @@ func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) ([]byte,
// UpdateCluster updates the cluster
func
(
k
*
Bootstrapper
)
UpdateCluster
(
cfg
config
.
KubernetesConfig
)
error
{
images
:=
images
.
CachedImages
(
cfg
.
ImageRepository
,
cfg
.
KubernetesVersion
)
images
,
err
:=
images
.
Kubeadm
(
cfg
.
ImageRepository
,
cfg
.
KubernetesVersion
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"kubeadm images"
)
}
if
cfg
.
ShouldLoadCachedImages
{
if
err
:=
machine
.
LoadImages
(
k
.
c
,
images
,
constants
.
ImageCacheDir
);
err
!=
nil
{
out
.
FailureT
(
"Unable to load cached images: {{.error}}"
,
out
.
V
{
"error"
:
err
})
...
...
pkg/minikube/cruntime/containerd.go
浏览文件 @
8b7aaba6
...
...
@@ -175,7 +175,7 @@ func generateContainerdConfig(cr CommandRunner, imageRepository string, k8sVersi
if
err
!=
nil
{
return
err
}
pauseImage
:=
images
.
Pause
Image
(
imageRepository
,
k8sVersion
)
pauseImage
:=
images
.
Pause
(
imageRepository
)
opts
:=
struct
{
PodInfraContainerImage
string
}{
PodInfraContainerImage
:
pauseImage
}
var
b
bytes
.
Buffer
if
err
:=
t
.
Execute
(
&
b
,
opts
);
err
!=
nil
{
...
...
pkg/minikube/cruntime/cri.go
浏览文件 @
8b7aaba6
...
...
@@ -413,7 +413,7 @@ func generateCRIOConfig(cr CommandRunner, imageRepository string, k8sVersion str
if
err
!=
nil
{
return
err
}
pauseImage
:=
images
.
Pause
Image
(
imageRepository
,
k8sVersion
)
pauseImage
:=
images
.
Pause
(
imageRepository
)
opts
:=
struct
{
PodInfraContainerImage
string
}{
PodInfraContainerImage
:
pauseImage
}
var
b
bytes
.
Buffer
if
err
:=
t
.
Execute
(
&
b
,
opts
);
err
!=
nil
{
...
...
pkg/minikube/machine/cache_images.go
浏览文件 @
8b7aaba6
...
...
@@ -55,7 +55,10 @@ var loadImageLock sync.Mutex
// CacheImagesForBootstrapper will cache images for a bootstrapper
func
CacheImagesForBootstrapper
(
imageRepository
string
,
version
string
,
clusterBootstrapper
string
)
error
{
images
:=
bootstrapper
.
GetCachedImageList
(
imageRepository
,
version
,
clusterBootstrapper
)
images
,
err
:=
bootstrapper
.
GetCachedImageList
(
imageRepository
,
version
,
clusterBootstrapper
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"cached images list"
)
}
if
err
:=
CacheImages
(
images
,
constants
.
ImageCacheDir
);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"Caching images for %s"
,
clusterBootstrapper
)
...
...
test/integration/a_serial_test.go
浏览文件 @
8b7aaba6
...
...
@@ -67,7 +67,11 @@ func TestDownloadOnly(t *testing.T) {
t
.
Errorf
(
"%s failed: %v"
,
args
,
err
)
}
imgs
:=
images
.
CachedImages
(
""
,
v
)
imgs
,
err
:=
images
.
Kubeadm
(
""
,
v
)
if
err
!=
nil
{
t
.
Errorf
(
"kubeadm images: %v"
,
v
)
}
for
_
,
img
:=
range
imgs
{
img
=
strings
.
Replace
(
img
,
":"
,
"_"
,
1
)
// for example kube-scheduler:v1.15.2 --> kube-scheduler_v1.15.2
fp
:=
filepath
.
Join
(
localpath
.
MiniPath
(),
"cache"
,
"images"
,
img
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录