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
小 白蛋
KubePi
Commits
4445188f
Commit
4445188f
authored
3 years ago
by
ssongliu
Browse files
Options
Download
Plain Diff
Merge branch 'master' of github.com:KubeOperator/KubePi
parents
478177be
cc549f10
master
arm-test
dev
rest-api
v1.2
v1.3
v1.4
v1.5
v1.6
v1.6.2
v1.6.1
v1.6.0
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.2
v1.4.1
v1.4.0
v1.3.0
v1.2.2
v1.2.1
v1.2.0
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+2
-5
Dockerfile
README.md
+2
-2
README.md
pkg/util/helm/helm.go
+24
-40
pkg/util/helm/helm.go
web/dashboard/src/components/detail/detail-key-value.vue
+4
-4
web/dashboard/src/components/detail/detail-key-value.vue
with
32 additions
and
51 deletions
+32
-51
Dockerfile
+
2
-
5
View file @
4445188f
FROM
node:14
-alpine
as
stage-web-build
FROM
node:14
.18.1
as
stage-web-build
LABEL
stage=stage-web-build
RUN
ap
k add
make python
gcc g++
RUN
ap
t-get
install
-y
make python gcc g++
WORKDIR
/build/kubepi/web
...
...
@@ -12,7 +12,6 @@ RUN make build_web
RUN
rm
-fr
web
FROM
golang:1.16
as
stage-bin-build
ENV
GOPROXY="https://goproxy.cn,direct"
...
...
@@ -27,7 +26,6 @@ WORKDIR /build/kubepi/bin
COPY
--from=stage-web-build /build/kubepi/web .
RUN
go mod download
RUN
make build_gotty
...
...
@@ -56,7 +54,6 @@ RUN ARCH=$(uname -m) && case $ARCH in aarch64) ARCH="arm64";; x86_64) ARCH="amd6
COPY
vimrc.local /etc/vim
EXPOSE
80
USER
root
...
...
This diff is collapsed.
Click to expand it.
README.md
+
2
-
2
View file @
4445188f
...
...
@@ -20,7 +20,7 @@ KubePi 允许管理员导入多个 Kubernetes 集群,并且通过权限控制
sudo docker run --privileged -d --restart=unless-stopped -p 80:80 kubeoperator/kubepi-server
打开浏览器访问http://localhost
打开浏览器访问
:
http://localhost
:80/
### 在线体验
...
...
@@ -41,7 +41,7 @@ KubePi 允许管理员导入多个 Kubernetes 集群,并且通过权限控制
### 致谢
-
[
Vue
](
https://cn.vuejs.org
)
前端框架
-
[
FIT2CLOUD UI
](
https://github.com/fit2cloud-ui/fit2cloud-ui/
)
FIT2CLOUD UI组件库
-
[
FIT2CLOUD UI
](
https://github.com/fit2cloud-ui/fit2cloud-ui/
)
FIT2CLOUD UI
组件库
-
[
Vue-element-admin
](
https://github.com/PanJiaChen/vue-element-admin
)
项目脚手架
### License & Copyright
...
...
This diff is collapsed.
Click to expand it.
pkg/util/helm/helm.go
+
24
-
40
View file @
4445188f
...
...
@@ -42,14 +42,15 @@ type Config struct {
KubeConfig
*
rest
.
Config
}
type
Client
struct
{
installActionConfig
*
action
.
Configuration
unInstallActionConfig
*
action
.
Configuration
listActionConfig
*
action
.
Configuration
getActionConfig
*
action
.
Configuration
Namespace
string
settings
*
cli
.
EnvSettings
Architectures
string
ClusterName
string
//installActionConfig *action.Configuration
//unInstallActionConfig *action.Configuration
//listActionConfig *action.Configuration
//getActionConfig *action.Configuration
actionConfig
*
action
.
Configuration
Namespace
string
settings
*
cli
.
EnvSettings
Architectures
string
ClusterName
string
}
func
GetSettings
(
cluster
string
)
*
cli
.
EnvSettings
{
...
...
@@ -74,11 +75,9 @@ func checkFiles(cluster string) {
}
if
_
,
err
:=
os
.
Stat
(
repositoryPath
);
os
.
IsNotExist
(
err
)
{
os
.
Create
(
repositoryPath
)
os
.
Create
(
repositoryPath
)
}
if
_
,
err
:=
os
.
Stat
(
registryPath
);
os
.
IsNotExist
(
err
)
{
os
.
Create
(
registryPath
)
os
.
Create
(
registryPath
)
}
return
}
...
...
@@ -89,44 +88,29 @@ func NewClient(config *Config) (*Client, error) {
}
client
.
settings
=
GetSettings
(
config
.
ClusterName
)
cf
:=
genericclioptions
.
NewConfigFlags
(
true
)
inscure
:=
true
apiServer
:=
config
.
Host
cf
.
APIServer
=
&
apiServer
cf
.
BearerToken
=
&
config
.
BearerToken
cf
.
Insecure
=
&
inscure
if
config
.
Namespace
==
""
{
client
.
Namespace
=
"default"
}
else
{
kubeConfig
:=
config
.
KubeConfig
cf
.
WrapConfigFn
=
func
(
config
*
rest
.
Config
)
*
rest
.
Config
{
return
kubeConfig
}
cf
.
CacheDir
=
nil
if
config
.
Namespace
!=
""
{
client
.
Namespace
=
config
.
Namespace
cf
.
Namespace
=
&
client
.
Namespace
}
cf
.
Namespace
=
&
client
.
Namespace
client
.
ClusterName
=
config
.
ClusterName
installA
ctionConfig
:=
new
(
action
.
Configuration
)
if
err
:=
installA
ctionConfig
.
Init
(
cf
,
c
lient
.
Namespace
,
helmDriver
,
nolog
);
err
!=
nil
{
a
ctionConfig
:=
new
(
action
.
Configuration
)
if
err
:=
a
ctionConfig
.
Init
(
cf
,
c
onfig
.
Namespace
,
helmDriver
,
nolog
);
err
!=
nil
{
return
nil
,
err
}
client
.
installActionConfig
=
installActionConfig
unInstallActionConfig
:=
new
(
action
.
Configuration
)
if
err
:=
unInstallActionConfig
.
Init
(
cf
,
config
.
OldNamespace
,
helmDriver
,
nolog
);
err
!=
nil
{
return
nil
,
err
}
client
.
unInstallActionConfig
=
installActionConfig
listActionConfig
:=
new
(
action
.
Configuration
)
if
err
:=
listActionConfig
.
Init
(
cf
,
config
.
Namespace
,
helmDriver
,
nolog
);
err
!=
nil
{
return
nil
,
err
}
client
.
listActionConfig
=
listActionConfig
client
.
actionConfig
=
actionConfig
getActionConfig
:=
new
(
action
.
Configuration
)
if
err
:=
getActionConfig
.
Init
(
cf
,
config
.
Namespace
,
helmDriver
,
nolog
);
err
!=
nil
{
return
nil
,
err
}
client
.
getActionConfig
=
getActionConfig
return
&
client
,
nil
}
func
(
c
Client
)
List
(
limit
,
offset
int
,
pattern
string
)
([]
*
release
.
Release
,
int
,
error
)
{
client
:=
action
.
NewList
(
c
.
listA
ctionConfig
)
client
:=
action
.
NewList
(
c
.
a
ctionConfig
)
if
c
.
Namespace
==
""
{
client
.
AllNamespaces
=
true
client
.
All
=
true
...
...
@@ -150,7 +134,7 @@ func (c Client) List(limit, offset int, pattern string) ([]*release.Release, int
}
func
(
c
Client
)
GetDetail
(
name
string
)
(
*
release
.
Release
,
error
)
{
client
:=
action
.
NewGet
(
c
.
getA
ctionConfig
)
client
:=
action
.
NewGet
(
c
.
a
ctionConfig
)
result
,
err
:=
client
.
Run
(
name
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -172,7 +156,7 @@ func (c Client) Install(name, repoName, chartName, chartVersion string, values m
if
rp
==
nil
{
return
nil
,
errors
.
New
(
"get chart detail failed, repo not found"
)
}
client
:=
action
.
NewInstall
(
c
.
installA
ctionConfig
)
client
:=
action
.
NewInstall
(
c
.
a
ctionConfig
)
client
.
ReleaseName
=
name
client
.
Namespace
=
c
.
Namespace
client
.
RepoURL
=
rp
.
URL
...
...
@@ -212,7 +196,7 @@ func (c Client) Upgrade(name, repoName, chartName, chartVersion string, values m
return
nil
,
errors
.
New
(
"get chart detail failed, repo not found"
)
}
client
:=
action
.
NewUpgrade
(
c
.
installA
ctionConfig
)
client
:=
action
.
NewUpgrade
(
c
.
a
ctionConfig
)
client
.
Namespace
=
c
.
Namespace
client
.
RepoURL
=
rp
.
URL
client
.
Username
=
rp
.
Username
...
...
@@ -238,7 +222,7 @@ func (c Client) Upgrade(name, repoName, chartName, chartVersion string, values m
}
func
(
c
Client
)
Uninstall
(
name
string
)
(
*
release
.
UninstallReleaseResponse
,
error
)
{
client
:=
action
.
NewUninstall
(
c
.
unInstallA
ctionConfig
)
client
:=
action
.
NewUninstall
(
c
.
a
ctionConfig
)
res
,
err
:=
client
.
Run
(
name
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
fmt
.
Sprintf
(
"uninstall tool %s failed: %v"
,
name
,
err
))
...
...
This diff is collapsed.
Click to expand it.
web/dashboard/src/components/detail/detail-key-value.vue
+
4
-
4
View file @
4445188f
...
...
@@ -5,12 +5,12 @@
</el-link>
<div
v-if=
"showItem"
>
<div
v-for=
"(value,key,index) in valueObj"
v-bind:key=
"index"
class=
"myTag"
>
<el-tag
type=
"info"
size=
"small"
v-if=
"value.length
<
10
0"
>
<el-tag
type=
"info"
size=
"small"
v-if=
"value.length
<
5
0"
>
{{
key
}}
=
{{
value
}}
</el-tag>
<el-tooltip
v-if=
"value.length >
10
0"
:content=
"value"
placement=
"top"
>
<el-tag
type=
"info"
size=
"small"
v-if=
"value.length >=
10
0"
>
{{
key
}}
=
{{
value
.
substring
(
0
,
10
0
)
+
"
...
"
}}
<el-tooltip
v-if=
"value.length >
5
0"
:content=
"value"
placement=
"top"
>
<el-tag
type=
"info"
size=
"small"
v-if=
"value.length >=
5
0"
>
{{
key
}}
=
{{
value
.
substring
(
0
,
5
0
)
+
"
...
"
}}
</el-tag>
</el-tooltip>
</div>
...
...
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