Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KubeSphere
kubesphere
提交
a7cbc6f8
K
kubesphere
项目概览
KubeSphere
/
kubesphere
通知
138
Star
33
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a7cbc6f8
编写于
3月 31, 2021
作者:
K
KubeSphere CI Bot
提交者:
GitHub
3月 31, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3651 from xyz-li/app-fix
Fix: fix app repo and helm app bugs
上级
20106d9f
610393bb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
30 addition
and
24 deletion
+30
-24
pkg/controller/openpitrix/helmapplication/helm_application_controller.go
...openpitrix/helmapplication/helm_application_controller.go
+3
-5
pkg/kapis/openpitrix/v1/handler.go
pkg/kapis/openpitrix/v1/handler.go
+5
-1
pkg/models/openpitrix/applications.go
pkg/models/openpitrix/applications.go
+1
-0
pkg/models/openpitrix/applicationversions.go
pkg/models/openpitrix/applicationversions.go
+5
-1
pkg/models/openpitrix/repos.go
pkg/models/openpitrix/repos.go
+7
-13
pkg/models/openpitrix/types.go
pkg/models/openpitrix/types.go
+2
-2
pkg/models/openpitrix/utils.go
pkg/models/openpitrix/utils.go
+7
-2
未找到文件。
pkg/controller/openpitrix/helmapplication/helm_application_controller.go
浏览文件 @
a7cbc6f8
...
...
@@ -87,6 +87,9 @@ func (r *ReconcileHelmApplication) Reconcile(request reconcile.Request) (reconci
return
reconcile
.
Result
{},
nil
}
}
// app has changed, update app status
return
reconcile
.
Result
{},
updateHelmApplicationStatus
(
r
.
Client
,
strings
.
TrimSuffix
(
app
.
Name
,
v1alpha1
.
HelmApplicationAppStoreSuffix
),
inAppStore
(
app
))
}
else
{
// delete app copy in appStore
if
!
inAppStore
(
app
)
{
...
...
@@ -164,11 +167,6 @@ func (r *ReconcileHelmApplication) createAppCopyInAppStore(ctx context.Context,
}
}
if
app
.
Status
.
State
==
""
{
// update status if needed
return
updateHelmApplicationStatus
(
r
.
Client
,
originApp
.
Name
,
true
)
}
return
nil
}
...
...
pkg/kapis/openpitrix/v1/handler.go
浏览文件 @
a7cbc6f8
...
...
@@ -218,7 +218,11 @@ func (h *openpitrixHandler) DescribeRepo(req *restful.Request, resp *restful.Res
if
err
!=
nil
{
klog
.
Errorln
(
err
)
handleOpenpitrixError
(
resp
,
err
)
if
apierrors
.
IsNotFound
(
err
)
{
api
.
HandleNotFound
(
resp
,
nil
,
err
)
return
}
api
.
HandleInternalError
(
resp
,
nil
,
err
)
return
}
...
...
pkg/models/openpitrix/applications.go
浏览文件 @
a7cbc6f8
...
...
@@ -242,6 +242,7 @@ func (c *applicationOperator) CreateApp(req *CreateAppRequest) (*CreateAppRespon
Spec
:
v1alpha1
.
HelmApplicationSpec
{
Name
:
req
.
Name
,
Description
:
stringutils
.
ShortenString
(
chrt
.
GetDescription
(),
v1alpha1
.
MsgLen
),
Icon
:
stringutils
.
ShortenString
(
chrt
.
GetIcon
(),
v1alpha1
.
MsgLen
),
},
}
app
,
err
:=
c
.
createApp
(
helmApp
,
req
.
Icon
)
...
...
pkg/models/openpitrix/applicationversions.go
浏览文件 @
a7cbc6f8
...
...
@@ -230,7 +230,11 @@ func (c *applicationOperator) ListAppVersionReviews(conditions *params.Condition
items
:=
make
([]
interface
{},
0
,
len
(
filtered
))
for
i
,
j
:=
offset
,
0
;
i
<
len
(
filtered
)
&&
j
<
limit
;
i
,
j
=
i
+
1
,
j
+
1
{
review
:=
convertAppVersionReview
(
filtered
[
i
])
app
,
err
:=
c
.
appLister
.
Get
(
filtered
[
i
]
.
GetHelmApplicationId
())
if
err
!=
nil
{
return
nil
,
err
}
review
:=
convertAppVersionReview
(
app
,
filtered
[
i
])
items
=
append
(
items
,
review
)
}
...
...
pkg/models/openpitrix/repos.go
浏览文件 @
a7cbc6f8
...
...
@@ -20,7 +20,6 @@ import (
"sort"
"strings"
"github.com/go-openapi/strfmt"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
...
...
@@ -160,7 +159,8 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
repoCopy
.
Spec
.
Description
=
stringutils
.
ShortenString
(
*
request
.
Description
,
DescriptionLen
)
}
if
request
.
Name
!=
nil
&&
len
(
*
request
.
Name
)
>
0
&&
*
request
.
Name
!=
repoCopy
.
Name
{
// modify name of the repo
if
request
.
Name
!=
nil
&&
len
(
*
request
.
Name
)
>
0
&&
*
request
.
Name
!=
repoCopy
.
Spec
.
Name
{
items
,
err
:=
c
.
repoLister
.
List
(
labels
.
SelectorFromSet
(
map
[
string
]
string
{
constants
.
WorkspaceLabelKey
:
repo
.
GetWorkspace
()}))
if
err
!=
nil
&&
!
apierrors
.
IsNotFound
(
err
)
{
klog
.
Errorf
(
"list helm repo failed: %s"
,
err
)
...
...
@@ -207,10 +207,12 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
repoCopy
.
Spec
.
Credential
=
*
cred
repoCopy
.
Spec
.
Url
=
parsedUrl
.
String
()
// change repo name and description won't change version
repoCopy
.
Spec
.
Version
+=
1
}
patch
:=
client
.
MergeFrom
(
repo
)
repoCopy
.
Spec
.
Version
+=
1
data
,
err
:=
patch
.
Data
(
repoCopy
)
if
err
!=
nil
{
klog
.
Error
(
"create patch failed"
,
err
)
...
...
@@ -238,16 +240,8 @@ func (c *repoOperator) DescribeRepo(id string) (*Repo, error) {
return
nil
,
err
}
var
desRepo
Repo
desRepo
.
URL
=
repo
.
Spec
.
Url
desRepo
.
Description
=
repo
.
Spec
.
Description
desRepo
.
Name
=
repo
.
GetTrueName
()
desRepo
.
RepoId
=
repo
.
Name
dt
,
_
:=
strfmt
.
ParseDateTime
(
repo
.
CreationTimestamp
.
String
())
desRepo
.
CreateTime
=
&
dt
return
&
desRepo
,
nil
retRepo
:=
convertRepo
(
repo
)
return
retRepo
,
nil
}
func
(
c
*
repoOperator
)
ListRepos
(
conditions
*
params
.
Conditions
,
orderBy
string
,
reverse
bool
,
limit
,
offset
int
)
(
*
models
.
PageableResponse
,
error
)
{
...
...
pkg/models/openpitrix/types.go
浏览文件 @
a7cbc6f8
...
...
@@ -690,8 +690,8 @@ type Repo struct {
// repository name
Name
string
`json:"name,omitempty"`
//
owne
r
Owner
string
`json:"owne
r,omitempty"`
//
creato
r
Creator
string
`json:"creato
r,omitempty"`
// runtime provider eg.[qingcloud|aliyun|aws|kubernetes]
Providers
[]
string
`json:"providers"`
...
...
pkg/models/openpitrix/utils.go
浏览文件 @
a7cbc6f8
...
...
@@ -17,6 +17,7 @@ limitations under the License.
package
openpitrix
import
(
"encoding/json"
"fmt"
"path"
"regexp"
...
...
@@ -406,6 +407,10 @@ func convertRepo(in *v1alpha1.HelmRepo) *Repo {
out
.
CreateTime
=
&
date
out
.
Description
=
in
.
Spec
.
Description
out
.
Creator
=
in
.
GetCreator
()
cred
,
_
:=
json
.
Marshal
(
in
.
Spec
.
Credential
)
out
.
Credential
=
string
(
cred
)
out
.
URL
=
in
.
Spec
.
Url
return
&
out
...
...
@@ -754,7 +759,7 @@ func attachmentKeyInStorage(ws, id string) string {
return
path
.
Join
(
ws
,
id
)
}
func
convertAppVersionReview
(
appVersion
*
v1alpha1
.
HelmApplicationVersion
)
*
AppVersionReview
{
func
convertAppVersionReview
(
app
*
v1alpha1
.
HelmApplication
,
app
Version
*
v1alpha1
.
HelmApplicationVersion
)
*
AppVersionReview
{
review
:=
&
AppVersionReview
{}
status
:=
appVersion
.
Status
review
.
Reviewer
=
status
.
Audit
[
0
]
.
Operator
...
...
@@ -766,7 +771,7 @@ func convertAppVersionReview(appVersion *v1alpha1.HelmApplicationVersion) *AppVe
review
.
VersionName
=
appVersion
.
GetVersionName
()
review
.
StatusTime
=
strfmt
.
DateTime
(
status
.
Audit
[
0
]
.
Time
.
Time
)
review
.
AppName
=
app
Version
.
GetTrueName
()
review
.
AppName
=
app
.
GetTrueName
()
return
review
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录