Support manual triggering of a repository update. (#6280)

* Support manual triggering of a repository update.

* cherry pick add api for workload template (#1982)

* cherry pick (add operator application (#1970))

* Modify routing implementation to improve readability

* cherry pick from kse dfc40e5adf5aa2e67d1

* Filter by Routing Parameter Namespace (#1990)

* add doc for workloadtemplates
This commit is contained in:
inksnw
2024-11-25 10:56:35 +08:00
committed by GitHub
parent 096e0ca868
commit bac3bc62f9
37 changed files with 679 additions and 318 deletions

View File

@@ -9,6 +9,8 @@ import (
"fmt"
"net/url"
k8suitl "kubesphere.io/kubesphere/pkg/utils/k8sutil"
"kubesphere.io/kubesphere/pkg/simple/client/application"
"kubesphere.io/kubesphere/pkg/api"
@@ -115,6 +117,24 @@ func (h *appHandler) DeleteRepo(req *restful.Request, resp *restful.Response) {
resp.WriteEntity(errors.None)
}
func (h *appHandler) ManualSync(req *restful.Request, resp *restful.Response) {
repoId := req.PathParameter("repo")
key := runtimeclient.ObjectKey{Name: repoId}
repo := &appv2.Repo{}
err := h.client.Get(req.Request.Context(), key, repo)
if requestDone(err, resp) {
return
}
repo.Status.State = appv2.StatusManualTrigger
err = h.client.Status().Update(req.Request.Context(), repo)
if err != nil {
api.HandleInternalError(resp, nil, err)
return
}
resp.WriteEntity(errors.None)
}
func (h *appHandler) DescribeRepo(req *restful.Request, resp *restful.Response) {
repoId := req.PathParameter("repo")
@@ -146,7 +166,7 @@ func (h *appHandler) ListRepos(req *restful.Request, resp *restful.Response) {
filteredList.Items = append(filteredList.Items, repo)
}
resp.WriteEntity(convertToListResult(filteredList, req))
resp.WriteEntity(k8suitl.ConvertToListResult(filteredList, req))
}
func (h *appHandler) ListRepoEvents(req *restful.Request, resp *restful.Response) {
@@ -163,5 +183,5 @@ func (h *appHandler) ListRepoEvents(req *restful.Request, resp *restful.Response
return
}
resp.WriteEntity(convertToListResult(&list, req))
resp.WriteEntity(k8suitl.ConvertToListResult(&list, req))
}