Skip to content

Commit

Permalink
fix: resource template getting duplicate exec-sa-token volume mounts …
Browse files Browse the repository at this point in the history
…with automountServiceAccountToken: false. Fixes argoproj#12848

reverts 2f63f6c
Signed-off-by: Minyi Zhong <[email protected]>
  • Loading branch information
Minyi Zhong committed Oct 26, 2024
1 parent 3a05962 commit 601a5e6
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,22 +216,6 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
// container's PID and root filesystem.
pod.Spec.Containers = append(pod.Spec.Containers, mainCtrs...)

// Configure service account token volume for the main container when AutomountServiceAccountToken is disabled
if (woc.execWf.Spec.AutomountServiceAccountToken != nil && !*woc.execWf.Spec.AutomountServiceAccountToken) ||
(tmpl.AutomountServiceAccountToken != nil && !*tmpl.AutomountServiceAccountToken) {
for i, c := range pod.Spec.Containers {
if c.Name == common.WaitContainerName {
continue
}
c.VolumeMounts = append(c.VolumeMounts, apiv1.VolumeMount{
Name: common.ServiceAccountTokenVolumeName,
MountPath: common.ServiceAccountTokenMountPath,
ReadOnly: true,
})
pod.Spec.Containers[i] = c
}
}

// Configuring default container to be used with commands like "kubectl exec/logs".
// Select "main" container if it's available. In other case use the last container (can happent when pod created from ContainerSet).
defaultContainer := pod.Spec.Containers[len(pod.Spec.Containers)-1].Name
Expand Down

0 comments on commit 601a5e6

Please sign in to comment.