Skip to content

Commit 4445188

Browse files
committed
Merge branch 'master' of github.com:KubeOperator/KubePi
2 parents 478177b + cc549f1 commit 4445188

File tree

4 files changed

+32
-51
lines changed

4 files changed

+32
-51
lines changed

Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM node:14-alpine as stage-web-build
1+
FROM node:14.18.1 as stage-web-build
22

33
LABEL stage=stage-web-build
44

5-
RUN apk add make python gcc g++
5+
RUN apt-get install -y make python gcc g++
66

77
WORKDIR /build/kubepi/web
88

@@ -12,7 +12,6 @@ RUN make build_web
1212

1313
RUN rm -fr web
1414

15-
1615
FROM golang:1.16 as stage-bin-build
1716

1817
ENV GOPROXY="https://goproxy.cn,direct"
@@ -27,7 +26,6 @@ WORKDIR /build/kubepi/bin
2726

2827
COPY --from=stage-web-build /build/kubepi/web .
2928

30-
3129
RUN go mod download
3230

3331
RUN make build_gotty
@@ -56,7 +54,6 @@ RUN ARCH=$(uname -m) && case $ARCH in aarch64) ARCH="arm64";; x86_64) ARCH="amd6
5654

5755
COPY vimrc.local /etc/vim
5856

59-
6057
EXPOSE 80
6158

6259
USER root

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ KubePi 允许管理员导入多个 Kubernetes 集群,并且通过权限控制
2020

2121
sudo docker run --privileged -d --restart=unless-stopped -p 80:80 kubeoperator/kubepi-server
2222

23-
打开浏览器访问http://localhost
23+
打开浏览器访问:http://localhost:80/
2424

2525
### 在线体验
2626

@@ -41,7 +41,7 @@ KubePi 允许管理员导入多个 Kubernetes 集群,并且通过权限控制
4141
### 致谢
4242

4343
- [Vue](https://cn.vuejs.org) 前端框架
44-
- [FIT2CLOUD UI](https://github.com/fit2cloud-ui/fit2cloud-ui/) FIT2CLOUD UI组件库
44+
- [FIT2CLOUD UI](https://github.com/fit2cloud-ui/fit2cloud-ui/) FIT2CLOUD UI 组件库
4545
- [Vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) 项目脚手架
4646

4747
### License & Copyright

pkg/util/helm/helm.go

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ type Config struct {
4242
KubeConfig *rest.Config
4343
}
4444
type Client struct {
45-
installActionConfig *action.Configuration
46-
unInstallActionConfig *action.Configuration
47-
listActionConfig *action.Configuration
48-
getActionConfig *action.Configuration
49-
Namespace string
50-
settings *cli.EnvSettings
51-
Architectures string
52-
ClusterName string
45+
//installActionConfig *action.Configuration
46+
//unInstallActionConfig *action.Configuration
47+
//listActionConfig *action.Configuration
48+
//getActionConfig *action.Configuration
49+
actionConfig *action.Configuration
50+
Namespace string
51+
settings *cli.EnvSettings
52+
Architectures string
53+
ClusterName string
5354
}
5455

5556
func GetSettings(cluster string) *cli.EnvSettings {
@@ -74,11 +75,9 @@ func checkFiles(cluster string) {
7475
}
7576
if _, err := os.Stat(repositoryPath); os.IsNotExist(err) {
7677
os.Create(repositoryPath)
77-
os.Create(repositoryPath)
7878
}
7979
if _, err := os.Stat(registryPath); os.IsNotExist(err) {
8080
os.Create(registryPath)
81-
os.Create(registryPath)
8281
}
8382
return
8483
}
@@ -89,44 +88,29 @@ func NewClient(config *Config) (*Client, error) {
8988
}
9089
client.settings = GetSettings(config.ClusterName)
9190
cf := genericclioptions.NewConfigFlags(true)
92-
inscure := true
9391
apiServer := config.Host
9492
cf.APIServer = &apiServer
95-
cf.BearerToken = &config.BearerToken
96-
cf.Insecure = &inscure
97-
if config.Namespace == "" {
98-
client.Namespace = "default"
99-
} else {
93+
kubeConfig := config.KubeConfig
94+
cf.WrapConfigFn = func(config *rest.Config) *rest.Config {
95+
return kubeConfig
96+
}
97+
cf.CacheDir = nil
98+
if config.Namespace != "" {
10099
client.Namespace = config.Namespace
100+
cf.Namespace = &client.Namespace
101101
}
102-
cf.Namespace = &client.Namespace
103102
client.ClusterName = config.ClusterName
104-
installActionConfig := new(action.Configuration)
105-
if err := installActionConfig.Init(cf, client.Namespace, helmDriver, nolog); err != nil {
103+
actionConfig := new(action.Configuration)
104+
if err := actionConfig.Init(cf, config.Namespace, helmDriver, nolog); err != nil {
106105
return nil, err
107106
}
108-
client.installActionConfig = installActionConfig
109-
unInstallActionConfig := new(action.Configuration)
110-
if err := unInstallActionConfig.Init(cf, config.OldNamespace, helmDriver, nolog); err != nil {
111-
return nil, err
112-
}
113-
client.unInstallActionConfig = installActionConfig
114-
listActionConfig := new(action.Configuration)
115-
if err := listActionConfig.Init(cf, config.Namespace, helmDriver, nolog); err != nil {
116-
return nil, err
117-
}
118-
client.listActionConfig = listActionConfig
107+
client.actionConfig = actionConfig
119108

120-
getActionConfig := new(action.Configuration)
121-
if err := getActionConfig.Init(cf, config.Namespace, helmDriver, nolog); err != nil {
122-
return nil, err
123-
}
124-
client.getActionConfig = getActionConfig
125109
return &client, nil
126110
}
127111

128112
func (c Client) List(limit, offset int, pattern string) ([]*release.Release, int, error) {
129-
client := action.NewList(c.listActionConfig)
113+
client := action.NewList(c.actionConfig)
130114
if c.Namespace == "" {
131115
client.AllNamespaces = true
132116
client.All = true
@@ -150,7 +134,7 @@ func (c Client) List(limit, offset int, pattern string) ([]*release.Release, int
150134
}
151135

152136
func (c Client) GetDetail(name string) (*release.Release, error) {
153-
client := action.NewGet(c.getActionConfig)
137+
client := action.NewGet(c.actionConfig)
154138
result, err := client.Run(name)
155139
if err != nil {
156140
return nil, err
@@ -172,7 +156,7 @@ func (c Client) Install(name, repoName, chartName, chartVersion string, values m
172156
if rp == nil {
173157
return nil, errors.New("get chart detail failed, repo not found")
174158
}
175-
client := action.NewInstall(c.installActionConfig)
159+
client := action.NewInstall(c.actionConfig)
176160
client.ReleaseName = name
177161
client.Namespace = c.Namespace
178162
client.RepoURL = rp.URL
@@ -212,7 +196,7 @@ func (c Client) Upgrade(name, repoName, chartName, chartVersion string, values m
212196
return nil, errors.New("get chart detail failed, repo not found")
213197
}
214198

215-
client := action.NewUpgrade(c.installActionConfig)
199+
client := action.NewUpgrade(c.actionConfig)
216200
client.Namespace = c.Namespace
217201
client.RepoURL = rp.URL
218202
client.Username = rp.Username
@@ -238,7 +222,7 @@ func (c Client) Upgrade(name, repoName, chartName, chartVersion string, values m
238222
}
239223

240224
func (c Client) Uninstall(name string) (*release.UninstallReleaseResponse, error) {
241-
client := action.NewUninstall(c.unInstallActionConfig)
225+
client := action.NewUninstall(c.actionConfig)
242226
res, err := client.Run(name)
243227
if err != nil {
244228
return nil, errors.Wrap(err, fmt.Sprintf("uninstall tool %s failed: %v", name, err))

web/dashboard/src/components/detail/detail-key-value.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
</el-link>
66
<div v-if="showItem">
77
<div v-for="(value,key,index) in valueObj" v-bind:key="index" class="myTag">
8-
<el-tag type="info" size="small" v-if="value.length < 100">
8+
<el-tag type="info" size="small" v-if="value.length < 50">
99
{{ key }} = {{ value }}
1010
</el-tag>
11-
<el-tooltip v-if="value.length > 100" :content="value" placement="top">
12-
<el-tag type="info" size="small" v-if="value.length >= 100">
13-
{{ key }} = {{ value.substring(0, 100) + "..." }}
11+
<el-tooltip v-if="value.length > 50" :content="value" placement="top">
12+
<el-tag type="info" size="small" v-if="value.length >= 50">
13+
{{ key }} = {{ value.substring(0, 50) + "..." }}
1414
</el-tag>
1515
</el-tooltip>
1616
</div>

0 commit comments

Comments
 (0)