From a55d0743eee9fb955a4880b31a452284d93ef15a Mon Sep 17 00:00:00 2001 From: renxiangyu Date: Mon, 1 Apr 2024 10:03:33 +0800 Subject: [PATCH] fix: fix 'automountServiceAccountToken' flag in the projected Signed-off-by: renxiangyu --- .../controllers/pod/root_pod_controller.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go b/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go index 934fec2d2..eace6c084 100644 --- a/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go +++ b/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go @@ -565,15 +565,15 @@ func (r *RootPodReconciler) changeToMasterCoreDNS(ctx context.Context, pod *core // projectedHandler Process the project volume, creating and mounting secret, configmap, DownwardAPI, // and ServiceAccountToken from the project volume in the member cluster to the pod of the host cluster func (r *RootPodReconciler) projectedHandler(ctx context.Context, lr *leafUtils.LeafResource, pod *corev1.Pod) { - if pod.Spec.Volumes == nil { + falseValue := false + pod.Spec.AutomountServiceAccountToken = &falseValue + + if len(pod.Spec.Volumes) == 0 { return } for _, volume := range pod.Spec.Volumes { if volume.Projected != nil { - falseValue := false - pod.Spec.AutomountServiceAccountToken = &falseValue - saName := pod.Spec.ServiceAccountName var sources []corev1.VolumeProjection