commit
295c4362bc
|
@ -30,6 +30,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/out"
|
"k8s.io/minikube/pkg/minikube/out"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ErrorCodes generates error codes
|
||||||
func ErrorCodes(docPath string, pathsToCheck []string) error {
|
func ErrorCodes(docPath string, pathsToCheck []string) error {
|
||||||
buf := bytes.NewBuffer([]byte{})
|
buf := bytes.NewBuffer([]byte{})
|
||||||
date := time.Now().Format("2006-01-02")
|
date := time.Now().Format("2006-01-02")
|
||||||
|
|
|
@ -33,6 +33,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/out"
|
"k8s.io/minikube/pkg/minikube/out"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TestDocs generates list of tests
|
||||||
func TestDocs(docPath string, pathToCheck string) error {
|
func TestDocs(docPath string, pathToCheck string) error {
|
||||||
buf := bytes.NewBuffer([]byte{})
|
buf := bytes.NewBuffer([]byte{})
|
||||||
date := time.Now().Format("2006-01-02")
|
date := time.Now().Format("2006-01-02")
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"k8s.io/minikube/deploy/addons"
|
"k8s.io/minikube/deploy/addons"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AliyunMirror list of images from Aliyun mirror
|
||||||
var AliyunMirror = loadAliyunMirror()
|
var AliyunMirror = loadAliyunMirror()
|
||||||
|
|
||||||
func loadAliyunMirror() map[string]string {
|
func loadAliyunMirror() map[string]string {
|
||||||
|
@ -39,6 +40,7 @@ func loadAliyunMirror() map[string]string {
|
||||||
return mirror
|
return mirror
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FixAddonImagesAndRegistries fixes images & registries in addon
|
||||||
func FixAddonImagesAndRegistries(addon *Addon, images map[string]string, registries map[string]string) (customImages, customRegistries map[string]string) {
|
func FixAddonImagesAndRegistries(addon *Addon, images map[string]string, registries map[string]string) (customImages, customRegistries map[string]string) {
|
||||||
customImages = make(map[string]string)
|
customImages = make(map[string]string)
|
||||||
customRegistries = make(map[string]string)
|
customRegistries = make(map[string]string)
|
||||||
|
|
|
@ -60,6 +60,8 @@ type CopyableFile interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type writeFn func(d []byte) (n int, err error)
|
type writeFn func(d []byte) (n int, err error)
|
||||||
|
|
||||||
|
// BaseCopyableFile is something that can be copied and written
|
||||||
type BaseCopyableFile struct {
|
type BaseCopyableFile struct {
|
||||||
ReadableFile
|
ReadableFile
|
||||||
|
|
||||||
|
@ -69,26 +71,32 @@ type BaseCopyableFile struct {
|
||||||
targetName string
|
targetName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write is for write something into the file
|
||||||
func (r *BaseCopyableFile) Write(d []byte) (n int, err error) {
|
func (r *BaseCopyableFile) Write(d []byte) (n int, err error) {
|
||||||
return r.writer(d)
|
return r.writer(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLength is for setting the length
|
||||||
func (r *BaseCopyableFile) SetLength(length int) {
|
func (r *BaseCopyableFile) SetLength(length int) {
|
||||||
r.length = length
|
r.length = length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTargetPath returns target path
|
||||||
func (r *BaseCopyableFile) GetTargetPath() string {
|
func (r *BaseCopyableFile) GetTargetPath() string {
|
||||||
return filepath.Join(r.GetTargetDir(), r.GetTargetName())
|
return filepath.Join(r.GetTargetDir(), r.GetTargetName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTargetDir returns target dir
|
||||||
func (r *BaseCopyableFile) GetTargetDir() string {
|
func (r *BaseCopyableFile) GetTargetDir() string {
|
||||||
return r.targetDir
|
return r.targetDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTargetName returns target name
|
||||||
func (r *BaseCopyableFile) GetTargetName() string {
|
func (r *BaseCopyableFile) GetTargetName() string {
|
||||||
return r.targetName
|
return r.targetName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewBaseCopyableFile creates a new instance of BaseCopyableFile
|
||||||
func NewBaseCopyableFile(source ReadableFile, writer writeFn, targetDir, targetName string) *BaseCopyableFile {
|
func NewBaseCopyableFile(source ReadableFile, writer writeFn, targetDir, targetName string) *BaseCopyableFile {
|
||||||
return &BaseCopyableFile{
|
return &BaseCopyableFile{
|
||||||
ReadableFile: source,
|
ReadableFile: source,
|
||||||
|
|
|
@ -58,9 +58,9 @@ type mountRunner interface {
|
||||||
const (
|
const (
|
||||||
// MountErrorUnknown failed with unknown error
|
// MountErrorUnknown failed with unknown error
|
||||||
MountErrorUnknown = iota
|
MountErrorUnknown = iota
|
||||||
// MountErrorConnect
|
// MountErrorConnect failed to connect
|
||||||
MountErrorConnect
|
MountErrorConnect
|
||||||
// MountErrorChmod
|
// MountErrorChmod failed to chmod
|
||||||
MountErrorChmod
|
MountErrorChmod
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -808,7 +808,7 @@ func (c Cilium) CIDR() string {
|
||||||
return DefaultPodCIDR
|
return DefaultPodCIDR
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateKubeadmYAML generates the .yaml file
|
// GenerateCiliumYAML generates the .yaml file
|
||||||
func GenerateCiliumYAML() ([]byte, error) {
|
func GenerateCiliumYAML() ([]byte, error) {
|
||||||
|
|
||||||
podCIDR := DefaultPodCIDR
|
podCIDR := DefaultPodCIDR
|
||||||
|
|
|
@ -142,6 +142,7 @@ func (f *FakeCommandRunner) Copy(file assets.CopyableFile) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CopyFrom copy content from file to the stored map.
|
||||||
func (f *FakeCommandRunner) CopyFrom(file assets.CopyableFile) error {
|
func (f *FakeCommandRunner) CopyFrom(file assets.CopyableFile) error {
|
||||||
v, ok := f.fileMap.Load(file.GetSourcePath())
|
v, ok := f.fileMap.Load(file.GetSourcePath())
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -161,6 +162,7 @@ func (f *FakeCommandRunner) Remove(file assets.CopyableFile) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadableFile implements interface (without implementation)
|
||||||
func (f *FakeCommandRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) {
|
func (f *FakeCommandRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SSHRunner runs commands through SSH.
|
// SSHRunner runs commands through SSH.
|
||||||
|
//
|
||||||
// It implements the CommandRunner interface.
|
// It implements the CommandRunner interface.
|
||||||
type SSHRunner struct {
|
type SSHRunner struct {
|
||||||
d drivers.Driver
|
d drivers.Driver
|
||||||
|
@ -499,6 +499,7 @@ func (s *SSHRunner) CopyFrom(f assets.CopyableFile) error {
|
||||||
return g.Wait()
|
return g.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadableFile returns assets.ReadableFile for the sourcePath (via `stat` command)
|
||||||
func (s *SSHRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) {
|
func (s *SSHRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) {
|
||||||
klog.V(4).Infof("NewsshReadableFile: %s -> %s", sourcePath)
|
klog.V(4).Infof("NewsshReadableFile: %s -> %s", sourcePath)
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ func IsSSH(name string) bool {
|
||||||
return name == SSH
|
return name == SSH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AllowsPreload returns if preload is allowed for the driver
|
||||||
func AllowsPreload(driverName string) bool {
|
func AllowsPreload(driverName string) bool {
|
||||||
return !BareMetal(driverName) && !IsSSH(driverName)
|
return !BareMetal(driverName) && !IsSSH(driverName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,7 @@ func imagePathInCache(img string) string {
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UploadCachedImage uploads cached image
|
||||||
func UploadCachedImage(imgName string) error {
|
func UploadCachedImage(imgName string) error {
|
||||||
tag, err := name.NewTag(imgName, name.WeakValidation)
|
tag, err := name.NewTag(imgName, name.WeakValidation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -47,7 +47,7 @@ func MaybePrintUpdateTextFromGithub() {
|
||||||
maybePrintUpdateText(GithubMinikubeReleasesURL, GithubMinikubeBetaReleasesURL, lastUpdateCheckFilePath)
|
maybePrintUpdateText(GithubMinikubeReleasesURL, GithubMinikubeBetaReleasesURL, lastUpdateCheckFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaybePrintUpdateTextFromGithub prints update text if needed, from Aliyun mirror
|
// MaybePrintUpdateTextFromAliyunMirror prints update text if needed, from Aliyun mirror
|
||||||
func MaybePrintUpdateTextFromAliyunMirror() {
|
func MaybePrintUpdateTextFromAliyunMirror() {
|
||||||
maybePrintUpdateText(GithubMinikubeReleasesAliyunURL, GithubMinikubeBetaReleasesAliyunURL, lastUpdateCheckFilePath)
|
maybePrintUpdateText(GithubMinikubeReleasesAliyunURL, GithubMinikubeBetaReleasesAliyunURL, lastUpdateCheckFilePath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue