Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kt Connect
Commits
ac34839b
Commit
ac34839b
authored
3 years ago
by
金戟
Browse files
Options
Download
Email Patches
Plain Diff
fix: .ktctl folder permission issue
parent
6ddc84bd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
docs/zh-cn/changelog.md
+4
-3
docs/zh-cn/changelog.md
docs/zh-cn/todo.md
+1
-1
docs/zh-cn/todo.md
pkg/kt/cmd/init.go
+0
-17
pkg/kt/cmd/init.go
pkg/kt/cmd/types.go
+3
-3
pkg/kt/cmd/types.go
pkg/kt/options/options.go
+2
-7
pkg/kt/options/options.go
pkg/kt/util/init.go
+6
-0
pkg/kt/util/init.go
pkg/kt/util/system.go
+20
-0
pkg/kt/util/system.go
with
36 additions
and
31 deletions
+36
-31
docs/zh-cn/changelog.md
+
4
-
3
View file @
ac34839b
...
...
@@ -6,10 +6,11 @@
> 发布时间:待定
*
发布包从
`tar.gz`
格式改为
`zip`
格式,方便Windows用户使用
*
支持指定代理Pod使用的ServiceAccount
*
修复Kubernetes地址有上下文路径会导致无法连接的问题
*
增强
`clean`
命令支持清理残留的ConfigMap和注册表数据
*
新增
`--serviceAccount`
参数支持指定代理Pod使用的ServiceAccount
*
新增
`--useKubectl`
参数支持使用本地
`kubectl`
工具连接集群
*
增强
`clean`
命令支持清理残留的ConfigMap和注册表数据
*
修复Kubernetes地址有上下文路径会导致无法连接的问题
*
修复执行connect使用sudo导致.ktctl目录owner变成root的问题
### 0.1.0
...
...
This diff is collapsed.
Click to expand it.
docs/zh-cn/todo.md
+
1
-
1
View file @
ac34839b
...
...
@@ -12,7 +12,7 @@ v1.0 版本计划
#### v0.2.x
-
支持WireGuard协议连接,进一步优化Windows体验
*
支持WireGuard协议连接,进一步优化Windows体验
*
`exchange`
和
`mesh`
命令使用Service名作为目标
*
支持对StatefulSet资源的
`exchange`
和
`mesh`
操作
...
...
This diff is collapsed.
Click to expand it.
pkg/kt/cmd/init.go
deleted
100644 → 0
+
0
-
17
View file @
6ddc84bd
package
cmd
import
(
"fmt"
"github.com/alibaba/kt-connect/pkg/kt/util"
)
var
(
userHome
=
util
.
UserHome
appHome
=
fmt
.
Sprintf
(
"%s/.ktctl"
,
userHome
)
pidFile
=
fmt
.
Sprintf
(
"%s/pid"
,
appHome
)
)
func
init
()
{
util
.
CreateDirIfNotExist
(
appHome
)
}
This diff is collapsed.
Click to expand it.
pkg/kt/cmd/types.go
+
3
-
3
View file @
ac34839b
...
...
@@ -2,6 +2,7 @@ package cmd
import
(
"github.com/alibaba/kt-connect/pkg/kt/options"
"github.com/alibaba/kt-connect/pkg/kt/util"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
...
...
@@ -90,9 +91,8 @@ func (o *GlobalOptions) transportGlobalOptions() *options.DaemonOptions {
Namespace
:
o
.
currentNs
,
WaitTime
:
o
.
Timeout
,
RuntimeOptions
:
&
options
.
RuntimeOptions
{
UserHome
:
userHome
,
AppHome
:
appHome
,
PidFile
:
pidFile
,
UserHome
:
util
.
UserHome
,
AppHome
:
util
.
KtHome
,
Clientset
:
o
.
clientset
,
RestConfig
:
o
.
restConfig
,
},
...
...
This diff is collapsed.
Click to expand it.
pkg/kt/options/options.go
+
2
-
7
View file @
ac34839b
...
...
@@ -61,8 +61,6 @@ type RuntimeOptions struct {
UserHome
string
// AppHome path of kt config folder, default to ${UserHome}/.ktctl
AppHome
string
// PidFile path of kt pid file, default to ${AppHome}/pid
PidFile
string
// Component current sub-command
Component
string
// Shadow deployment name
...
...
@@ -110,16 +108,13 @@ type DaemonOptions struct {
// NewDaemonOptions return new cli default options
func
NewDaemonOptions
()
*
DaemonOptions
{
userHome
:=
util
.
UserHome
appHome
:=
util
.
KtHome
util
.
CreateDirIfNotExist
(
appHome
)
return
&
DaemonOptions
{
Namespace
:
common
.
DefNamespace
,
KubeConfig
:
util
.
KubeConfig
(),
WaitTime
:
5
,
RuntimeOptions
:
&
RuntimeOptions
{
UserHome
:
userHome
,
AppHome
:
app
Home
,
UserHome
:
u
til
.
U
serHome
,
AppHome
:
util
.
Kt
Home
,
},
ConnectOptions
:
&
ConnectOptions
{},
ExchangeOptions
:
&
ExchangeOptions
{},
...
...
This diff is collapsed.
Click to expand it.
pkg/kt/util/init.go
0 → 100644
+
6
-
0
View file @
ac34839b
package
util
func
init
()
{
CreateDirIfNotExist
(
KtHome
)
FixFileOwner
(
KtHome
)
}
This diff is collapsed.
Click to expand it.
pkg/kt/util/system.go
+
20
-
0
View file @
ac34839b
...
...
@@ -85,6 +85,26 @@ func GetJvmrcFilePath(jvmrcDir string) string {
return
""
}
// FixFileOwner set owner to original user when run with sudo
func
FixFileOwner
(
path
string
)
{
var
uid
int
var
gid
int
sudoUid
:=
os
.
Getenv
(
"SUDO_UID"
)
if
sudoUid
==
""
{
uid
=
os
.
Getuid
()
}
else
{
uid
,
_
=
strconv
.
Atoi
(
sudoUid
)
}
sudoGid
:=
os
.
Getenv
(
"SUDO_GID"
)
if
sudoGid
==
""
{
gid
=
os
.
Getuid
()
}
else
{
gid
,
_
=
strconv
.
Atoi
(
sudoGid
)
}
_
=
os
.
Chown
(
path
,
uid
,
gid
)
}
// GetTimestamp get current time stamp
func
GetTimestamp
()
string
{
return
strconv
.
FormatInt
(
time
.
Now
()
.
Unix
(),
10
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help