Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
452054bf
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,发现更多精彩内容 >>
提交
452054bf
编写于
2月 11, 2019
作者:
T
Thomas Stromberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement PR comments
上级
deb31b42
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
66 addition
and
64 deletion
+66
-64
cmd/minikube/cmd/ssh.go
cmd/minikube/cmd/ssh.go
+1
-1
cmd/minikube/cmd/start.go
cmd/minikube/cmd/start.go
+8
-2
cmd/minikube/cmd/update-context.go
cmd/minikube/cmd/update-context.go
+4
-4
cmd/minikube/main.go
cmd/minikube/main.go
+0
-4
pkg/minikube/bootstrapper/command_runner.go
pkg/minikube/bootstrapper/command_runner.go
+1
-1
pkg/minikube/console/console.go
pkg/minikube/console/console.go
+10
-11
pkg/minikube/console/style.go
pkg/minikube/console/style.go
+42
-41
未找到文件。
cmd/minikube/cmd/ssh.go
浏览文件 @
452054bf
...
...
@@ -45,7 +45,7 @@ var sshCmd = &cobra.Command{
}
if
host
.
Driver
.
DriverName
()
==
"none"
{
console
.
Fatal
(
`'none' driver does not support 'minikube ssh' command`
)
os
.
Exit
(
0
)
os
.
Exit
(
1
)
}
err
=
cluster
.
CreateSSHShell
(
api
,
args
)
if
err
!=
nil
{
...
...
cmd/minikube/cmd/start.go
浏览文件 @
452054bf
...
...
@@ -360,14 +360,20 @@ func validateNetwork(h *host.Host) string {
if
err
!=
nil
{
reportErrAndExit
(
"Unable to get VM IP address"
,
err
)
}
console
.
OutStyle
(
"connectivity"
,
"%q IP address is %s
.
"
,
cfg
.
GetMachineName
(),
ip
)
console
.
OutStyle
(
"connectivity"
,
"%q IP address is %s"
,
cfg
.
GetMachineName
(),
ip
)
// Here is where we should be checking connectivity to/from the VM
optSeen
:=
false
for
_
,
k
:=
range
[]
string
{
"HTTP_PROXY"
,
"HTTPS_PROXY"
,
"NO_PROXY"
}
{
if
v
:=
os
.
Getenv
(
k
);
v
!=
""
{
if
!
optSeen
{
console
.
OutStyle
(
"internet"
,
"Found network options:"
)
optSeen
=
true
}
console
.
OutStyle
(
"option"
,
"%s=%s"
,
k
,
v
)
}
}
// Here is where we should be checking connectivity to/from the VM
return
ip
}
...
...
cmd/minikube/cmd/update-context.go
浏览文件 @
452054bf
...
...
@@ -49,15 +49,15 @@ var updateContextCmd = &cobra.Command{
glog
.
Errorln
(
"Error host driver ip status:"
,
err
)
cmdUtil
.
MaybeReportErrorAndExit
(
err
)
}
ok
,
err
:=
kcfg
.
UpdateKubeconfigIP
(
ip
,
constants
.
KubeconfigPath
,
machineName
)
updated
,
err
:=
kcfg
.
UpdateKubeconfigIP
(
ip
,
constants
.
KubeconfigPath
,
machineName
)
if
err
!=
nil
{
glog
.
Errorln
(
"Error kubeconfig status:"
,
err
)
cmdUtil
.
MaybeReportErrorAndExit
(
err
)
}
if
ok
{
console
.
Fatal
(
"Reconfigured kubeconfig IP, now pointing
at %s"
,
ip
)
if
updated
{
console
.
OutStyle
(
"celebrate"
,
"IP has been updated to point
at %s"
,
ip
)
}
else
{
console
.
OutStyle
(
"
celebrate"
,
"Kubeconfig IP has been updated to point at
%s"
,
ip
)
console
.
OutStyle
(
"
meh"
,
"IP was already correctly configured for
%s"
,
ip
)
}
},
...
...
cmd/minikube/main.go
浏览文件 @
452054bf
...
...
@@ -40,9 +40,5 @@ func main() {
}
console
.
SetOutFile
(
os
.
Stdout
)
console
.
SetErrFile
(
os
.
Stderr
)
err
:=
console
.
SetPreferredLanguage
(
os
.
Getenv
(
"LANG"
))
if
err
!=
nil
{
glog
.
Warningf
(
"unable to detect language: %v"
,
err
)
}
cmd
.
Execute
()
}
pkg/minikube/bootstrapper/command_runner.go
浏览文件 @
452054bf
...
...
@@ -34,7 +34,7 @@ type CommandRunner interface {
//
// var b bytes.Buffer
// CombinedOutput(cmd, &b)
//
console.Fatal
(b.Bytes())
//
fmt.Println
(b.Bytes())
//
// Or, you can set out to os.Stdout, the command output and
// error would show on your terminal immediately before you
...
...
pkg/minikube/console/console.go
浏览文件 @
452054bf
...
...
@@ -153,11 +153,13 @@ func SetPreferredLanguageTag(l language.Tag) {
// SetPreferredLanguage configures which language future messages should use, based on a LANG string.
func
SetPreferredLanguage
(
s
string
)
error
{
// "C" is commonly used to denote a neutral POSIX locale. See http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_02
if
s
==
""
||
s
==
"C"
{
SetPreferredLanguageTag
(
defaultLanguage
)
return
nil
}
// Ignore encoding preferences: we always output utf8. Handles "de_DE.utf8"
// Handles "de_DE" or "de_DE.utf8"
// We don't process encodings, since Rob Pike invented utf8 and we're mostly stuck with it.
parts
:=
strings
.
Split
(
s
,
"."
)
l
,
err
:=
language
.
Parse
(
parts
[
0
])
if
err
!=
nil
{
...
...
@@ -187,25 +189,22 @@ func wantsColor(fd uintptr) bool {
//
// MINIKUBE_IN_COLOR=[1, T, true, TRUE]
// MINIKUBE_IN_COLOR=[0, f, false, FALSE]
//
// If unset, we try to automatically determine suitability from the environment.
val
:=
os
.
Getenv
(
OverrideEnv
)
if
val
!=
""
{
glog
.
Infof
(
"%s=%q
\n
"
,
OverrideEnv
,
os
.
Getenv
(
OverrideEnv
))
override
,
err
:=
strconv
.
ParseBool
(
val
)
if
err
!=
nil
{
// That's OK, we will just fall-back to automatic detection.
glog
.
Errorf
(
"ParseBool(%s): %v"
,
OverrideEnv
,
err
)
}
else
{
return
override
}
return
override
}
glog
.
Infof
(
"%s=%q
\n
"
,
OverrideEnv
,
os
.
Getenv
(
OverrideEnv
))
switch
os
.
Getenv
(
OverrideEnv
)
{
case
"0"
:
return
false
case
"1"
:
return
true
}
term
:=
os
.
Getenv
(
"TERM"
)
//
As in
: term-256color
//
Example
: term-256color
if
!
strings
.
Contains
(
term
,
"color"
)
{
glog
.
Infof
(
"TERM=%s, which probably does not support color"
,
term
)
return
false
...
...
pkg/minikube/console/style.go
浏览文件 @
452054bf
...
...
@@ -33,48 +33,49 @@ type style struct {
// styles is a map of style name to style struct
// For consistency, ensure that emojis added render with the same width across platforms.
var
styles
=
map
[
string
]
style
{
"happy"
:
{
Prefix
:
"😄"
},
"success"
:
{
Prefix
:
"✅"
},
"failure"
:
{
Prefix
:
"❌"
},
"conflict"
:
{
Prefix
:
"💥"
},
"fatal"
:
{
Prefix
:
"💣"
},
"notice"
:
{
Prefix
:
"📌"
},
"ready"
:
{
Prefix
:
"🏄"
},
"restarting"
:
{
Prefix
:
"🔄"
},
"stopping"
:
{
Prefix
:
"✋"
},
"stopped"
:
{
Prefix
:
"🛑"
},
"warning"
:
{
Prefix
:
"⚠️"
},
"waiting"
:
{
Prefix
:
"⌛"
},
"usage"
:
{
Prefix
:
"💡"
},
"launch"
:
{
Prefix
:
"🚀"
},
"thumbs-up"
:
{
Prefix
:
"👍"
},
"option"
:
{
Prefix
:
"
▪ "
},
"crushed"
:
{
Prefix
:
"💔"
},
"happy"
:
{
Prefix
:
"😄
"
},
"success"
:
{
Prefix
:
"✅
"
},
"failure"
:
{
Prefix
:
"❌
"
},
"conflict"
:
{
Prefix
:
"💥
"
},
"fatal"
:
{
Prefix
:
"💣
"
},
"notice"
:
{
Prefix
:
"📌
"
},
"ready"
:
{
Prefix
:
"🏄
"
},
"restarting"
:
{
Prefix
:
"🔄
"
},
"stopping"
:
{
Prefix
:
"✋
"
},
"stopped"
:
{
Prefix
:
"🛑
"
},
"warning"
:
{
Prefix
:
"⚠️
"
},
"waiting"
:
{
Prefix
:
"⌛
"
},
"usage"
:
{
Prefix
:
"💡
"
},
"launch"
:
{
Prefix
:
"🚀
"
},
"thumbs-up"
:
{
Prefix
:
"👍
"
},
"option"
:
{
Prefix
:
"
▪ "
},
// Indented bullet
"crushed"
:
{
Prefix
:
"💔
"
},
// Specialized purpose styles
"iso-download"
:
{
Prefix
:
"💿"
},
"file-download"
:
{
Prefix
:
"💾"
},
"caching"
:
{
Prefix
:
"🤹"
},
"starting-vm"
:
{
Prefix
:
"🔥"
},
"starting-none"
:
{
Prefix
:
"🤹"
},
"deleting-vm"
:
{
Prefix
:
"🔥"
},
"copying"
:
{
Prefix
:
"✨"
},
"connectivity"
:
{
Prefix
:
"📶"
},
"mounting"
:
{
Prefix
:
"📁"
},
"celebrate"
:
{
Prefix
:
"🎉"
},
"container-runtime"
:
{
Prefix
:
"🎁"
},
"Docker"
:
{
Prefix
:
"🐳"
},
"CRIO"
:
{
Prefix
:
"🎁"
},
// This should be a snow-flake, but the emoji has a strange width on macOS
"containerd"
:
{
Prefix
:
"📦"
},
"permissions"
:
{
Prefix
:
"🔑"
},
"enabling"
:
{
Prefix
:
"🔌"
},
"pulling"
:
{
Prefix
:
"🚜"
},
"verifying"
:
{
Prefix
:
"🤔"
},
"verifying-noline"
:
{
Prefix
:
"🤔"
,
OmitNewline
:
true
},
"kubectl"
:
{
Prefix
:
"💗"
},
"meh"
:
{
Prefix
:
"🙄"
},
"embarassed"
:
{
Prefix
:
"🤦"
},
"tip"
:
{
Prefix
:
"💡"
},
"iso-download"
:
{
Prefix
:
"💿 "
},
"file-download"
:
{
Prefix
:
"💾 "
},
"caching"
:
{
Prefix
:
"🤹 "
},
"starting-vm"
:
{
Prefix
:
"🔥 "
},
"starting-none"
:
{
Prefix
:
"🤹 "
},
"deleting-vm"
:
{
Prefix
:
"🔥 "
},
"copying"
:
{
Prefix
:
"✨ "
},
"connectivity"
:
{
Prefix
:
"📶 "
},
"internet"
:
{
Prefix
:
"🌐 "
},
"mounting"
:
{
Prefix
:
"📁 "
},
"celebrate"
:
{
Prefix
:
"🎉 "
},
"container-runtime"
:
{
Prefix
:
"🎁 "
},
"Docker"
:
{
Prefix
:
"🐳 "
},
"CRIO"
:
{
Prefix
:
"🎁 "
},
// This should be a snow-flake, but the emoji has a strange width on macOS
"containerd"
:
{
Prefix
:
"📦 "
},
"permissions"
:
{
Prefix
:
"🔑 "
},
"enabling"
:
{
Prefix
:
"🔌 "
},
"pulling"
:
{
Prefix
:
"🚜 "
},
"verifying"
:
{
Prefix
:
"🤔 "
},
"verifying-noline"
:
{
Prefix
:
"🤔 "
,
OmitNewline
:
true
},
"kubectl"
:
{
Prefix
:
"💗 "
},
"meh"
:
{
Prefix
:
"🙄 "
},
"embarassed"
:
{
Prefix
:
"🤦 "
},
"tip"
:
{
Prefix
:
"💡 "
},
}
// Add a prefix to a string
...
...
@@ -83,7 +84,7 @@ func applyPrefix(prefix, format string) string {
return
format
}
// TODO(tstromberg): Ensure compatibility with RTL languages.
return
prefix
+
" "
+
format
return
prefix
+
format
}
// Apply styling to a format string
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录