From 45110b9d7e63caa857daa63776c05dd6a5d7e9d9 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Mon, 26 Aug 2024 18:54:37 +0800 Subject: [PATCH] fix: mixed the minioJob/policybinding/sts namespace (#2291) --- pkg/controller/job-controller.go | 4 ++-- pkg/utils/miniojob/types.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controller/job-controller.go b/pkg/controller/job-controller.go index 1db9d42a816..f0f9fcd905d 100644 --- a/pkg/controller/job-controller.go +++ b/pkg/controller/job-controller.go @@ -248,7 +248,7 @@ func (c *JobController) SyncHandler(key string) (_ Result, err error) { } // check sa pbs := &stsv1beta1.PolicyBindingList{} - err = c.k8sClient.List(ctx, pbs, client.InNamespace(namespace)) + err = c.k8sClient.List(ctx, pbs, client.InNamespace(tenant.Namespace)) if err != nil { return WrapResult(Result{}, fmt.Errorf("list policybinding error: %w", err)) } @@ -257,7 +257,7 @@ func (c *JobController) SyncHandler(key string) (_ Result, err error) { } saFound := false for _, pb := range pbs.Items { - if pb.Spec.Application.Namespace == namespace && pb.Spec.Application.ServiceAccount == jobCR.Spec.ServiceAccountName { + if pb.Spec.Application.Namespace == jobCR.Namespace && pb.Spec.Application.ServiceAccount == jobCR.Spec.ServiceAccountName { saFound = true } } diff --git a/pkg/utils/miniojob/types.go b/pkg/utils/miniojob/types.go index bf2b162f73e..8f597b6d36a 100644 --- a/pkg/utils/miniojob/types.go +++ b/pkg/utils/miniojob/types.go @@ -200,7 +200,7 @@ func (jobCommand *MinIOIntervalJobCommand) createJob(_ context.Context, _ client }, StringData: map[string]string{ "MC_HOST_myminio": fmt.Sprintf("%s://$(ACCESS_KEY):$(SECRET_KEY)@minio.%s.svc.%s", scheme, jobCR.Namespace, miniov2.GetClusterDomain()), - "MC_STS_ENDPOINT_myminio": fmt.Sprintf("https://sts.%s.svc.%s:%d/sts/%s", miniov2.GetNSFromFile(), miniov2.GetClusterDomain(), stsPort, jobCR.Namespace), + "MC_STS_ENDPOINT_myminio": fmt.Sprintf("https://sts.%s.svc.%s:%d/sts/%s", miniov2.GetNSFromFile(), miniov2.GetClusterDomain(), stsPort, t.Namespace), "MC_WEB_IDENTITY_TOKEN_FILE_myminio": "/var/run/secrets/kubernetes.io/serviceaccount/token", }, }