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, })