From 4d2b75fcf0f832c53ad61ee640e48211a90ee3f2 Mon Sep 17 00:00:00 2001 From: LidolLxf <13660354959@163.com> Date: Tue, 14 Jan 2025 15:24:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20context=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bcs-helm-manager/internal/actions/release/listv1.go | 2 +- .../bcs-helm-manager/internal/actions/release/listv2.go | 2 +- .../bcs-helm-manager/internal/component/project/project.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bcs-services/bcs-helm-manager/internal/actions/release/listv1.go b/bcs-services/bcs-helm-manager/internal/actions/release/listv1.go index 978b6f7f61..7034e337e5 100644 --- a/bcs-services/bcs-helm-manager/internal/actions/release/listv1.go +++ b/bcs-services/bcs-helm-manager/internal/actions/release/listv1.go @@ -129,7 +129,7 @@ func (l *ListReleaseV1Action) list() (*helmmanager.ReleaseListData, error) { // 共享集群支持查询集群下所有命名空间的release func (l *ListReleaseV1Action) listReleaseByNamespaces() ([]*helmmanager.Release, error) { - namespaces, err := project.ListNamespaces(l.req.GetProjectCode(), l.req.GetClusterID()) + namespaces, err := project.ListNamespaces(l.ctx, l.req.GetProjectCode(), l.req.GetClusterID()) if err != nil { return nil, err } diff --git a/bcs-services/bcs-helm-manager/internal/actions/release/listv2.go b/bcs-services/bcs-helm-manager/internal/actions/release/listv2.go index 2e7911aa5a..a221d293f7 100644 --- a/bcs-services/bcs-helm-manager/internal/actions/release/listv2.go +++ b/bcs-services/bcs-helm-manager/internal/actions/release/listv2.go @@ -119,7 +119,7 @@ func (l *ListReleaseV2Action) list() (*helmmanager.ReleaseListData, error) { // 共享集群支持查询集群下所有命名空间的release func (l *ListReleaseV2Action) listReleaseByNamespaces() ([]*helmmanager.Release, error) { - namespaces, err := project.ListNamespaces(l.req.GetProjectCode(), l.req.GetClusterID()) + namespaces, err := project.ListNamespaces(l.ctx, l.req.GetProjectCode(), l.req.GetClusterID()) if err != nil { return nil, err } diff --git a/bcs-services/bcs-helm-manager/internal/component/project/project.go b/bcs-services/bcs-helm-manager/internal/component/project/project.go index ad6433faee..6933f9dc1e 100644 --- a/bcs-services/bcs-helm-manager/internal/component/project/project.go +++ b/bcs-services/bcs-helm-manager/internal/component/project/project.go @@ -113,7 +113,7 @@ func GetProjectByCode(projectCode string) (*bcsproject.Project, error) { } // ListNamespaces list namespaces -func ListNamespaces(projectCode, clusterID string) ([]*bcsproject.NamespaceData, error) { +func ListNamespaces(ctx context.Context, projectCode, clusterID string) ([]*bcsproject.NamespaceData, error) { cli, close, err := client.getProjectClient() defer func() { if close != nil { @@ -123,7 +123,7 @@ func ListNamespaces(projectCode, clusterID string) ([]*bcsproject.NamespaceData, if err != nil { return nil, err } - p, err := cli.Namespace.ListNamespaces(context.Background(), &bcsproject.ListNamespacesRequest{ + p, err := cli.Namespace.ListNamespaces(ctx, &bcsproject.ListNamespacesRequest{ ProjectCode: projectCode, ClusterID: clusterID, })