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

* 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

---------

Co-authored-by: inksnw <inksnw@gmail.com>
This commit is contained in:
KubeSphere CI Bot
2025-03-11 11:36:02 +08:00
committed by GitHub
parent c9c856dfda
commit bb60d39434
37 changed files with 679 additions and 318 deletions

View File

@@ -9,6 +9,8 @@ import (
"bytes"
"encoding/json"
k8suitl "kubesphere.io/kubesphere/pkg/utils/k8sutil"
"kubesphere.io/kubesphere/pkg/apiserver/request"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -55,7 +57,7 @@ func (h *appHandler) CreateOrUpdateAppRls(req *restful.Request, resp *restful.Re
}
if createRlsRequest.Spec.AppType != appv2.AppTypeHelm {
runtimeClient, _, _, err := h.getCluster(createRlsRequest.GetRlsCluster())
runtimeClient, _, _, err := h.getCluster(req, createRlsRequest.GetRlsCluster())
if requestDone(err, resp) {
return
}
@@ -111,7 +113,7 @@ func (h *appHandler) DescribeAppRls(req *restful.Request, resp *restful.Response
}
app.SetManagedFields(nil)
if app.Spec.AppType == appv2.AppTypeYaml || app.Spec.AppType == appv2.AppTypeEdge {
data, err := h.getRealTimeYaml(ctx, app)
data, err := h.getRealTimeYaml(ctx, req, app)
if err != nil {
klog.Errorf("getRealTimeYaml: %s", err.Error())
app.Status.RealTimeResources = nil
@@ -123,7 +125,7 @@ func (h *appHandler) DescribeAppRls(req *restful.Request, resp *restful.Response
return
}
data, err := h.getRealTimeHelm(ctx, app)
data, err := h.getRealTimeHelm(ctx, req, app)
if err != nil {
klog.Errorf("getRealTimeHelm: %s", err.Error())
app.Status.RealTimeResources = nil
@@ -135,8 +137,8 @@ func (h *appHandler) DescribeAppRls(req *restful.Request, resp *restful.Response
resp.WriteEntity(app)
}
func (h *appHandler) getRealTimeYaml(ctx context.Context, app *appv2.ApplicationRelease) (data []json.RawMessage, err error) {
runtimeClient, dynamicClient, cluster, err := h.getCluster(app.GetRlsCluster())
func (h *appHandler) getRealTimeYaml(ctx context.Context, req *restful.Request, app *appv2.ApplicationRelease) (data []json.RawMessage, err error) {
runtimeClient, dynamicClient, cluster, err := h.getCluster(req, app.GetRlsCluster())
if err != nil {
klog.Errorf("cluster: %s url: %s: %s", cluster.Name, cluster.Spec.Connection.KubernetesAPIEndpoint, err)
return nil, err
@@ -175,8 +177,8 @@ func (h *appHandler) getRealTimeYaml(ctx context.Context, app *appv2.Application
return data, err
}
func (h *appHandler) getRealTimeHelm(ctx context.Context, app *appv2.ApplicationRelease) (data []json.RawMessage, err error) {
runtimeClient, dynamicClient, cluster, err := h.getCluster(app.GetRlsCluster())
func (h *appHandler) getRealTimeHelm(ctx context.Context, req *restful.Request, app *appv2.ApplicationRelease) (data []json.RawMessage, err error) {
runtimeClient, dynamicClient, cluster, err := h.getCluster(req, app.GetRlsCluster())
if err != nil {
klog.Errorf("cluster: %s url: %s: %s", cluster.Name, cluster.Spec.Connection.KubernetesAPIEndpoint, err)
return nil, err
@@ -292,5 +294,5 @@ func (h *appHandler) ListAppRls(req *restful.Request, resp *restful.Response) {
return
}
resp.WriteEntity(convertToListResult(&appList, req))
resp.WriteEntity(k8suitl.ConvertToListResult(&appList, req))
}