Closed MinyiZ closed 3 weeks ago
Regarding the tests here and from #10945, a
resource
template should correctly fail ifautomountServiceAccountToken: false
since, well, there is no SA token for it to use
I've fixed the tests from https://github.com/argoproj/argo-workflows/pull/10945 to demonstrate that it is possible to explicitly mount a token to container and script template workflows even if automountServiceAccountToken: false
so the code change was not needed.
I believe resource
templates shouldn't fail if automountServiceAccountToken: false
because the exec token is mounted at https://github.com/argoproj/argo-workflows/blob/25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee/workflow/controller/operator.go#L3453 and I've added an e2e test to demonstrate that.
I believe
resource
templates shouldn't fail ifautomountServiceAccountToken: false
because the exec token is mounted at
Ah nice, I wasn't sure if resource
templates handled executor.serviceAccountName
since they use a main
container.
I've fixed the tests from #10945 to demonstrate that it is possible to explicitly mount a token to container and script template workflows even if
automountServiceAccountToken: false
so the code change was not needed.
I saw that, but I don't think that test is very functional / necessary. Basically you're manually mounting the token instead of automount
ing it. A user shouldn't really ever do that manually though, they should just automount
. That is also testing k8s behavior rather than Argo behavior at that point.
I think both those tests should just be removed.
agilgur5 changed the title ~fix: resource template etting duplicate exec-sa-token volume mounts with automountServiceAccountToken: false. Fixes #12848~ fix: don't mount SA token when
automountServiceAccountToken: false
. Fixes #12848 12 hours agoMinyiZ changed the title ~fix: don't mount SA token when
automountServiceAccountToken: false
. Fixes #12848~ fix: resource template getting duplicate exec-sa-token volume mounts with automountServiceAccountToken: false. Fixes #12848 5 hours ago
Regarding the PR title, my change was intentional. The PR title should summarize what the PR does, not what the issue is. The PR title and issue title should not be equivalent, as they are now.
The actual source code change is not specific to resource
templates either, as the code path does not check for a resource
template, which is why I did not label it as such
I think both those tests should just be removed.
Yep agreed. Done.
Regarding the PR title, my change was intentional.
Ooops sorry about that. I unintentionally reverted your change when I was fixing up a typo. I've changed it back now.
Fixes #12848
Motivation
https://github.com/argoproj/argo-workflows/pull/10945 introduced a regression as it is mounting a serviceaccount token on the main container when
automountServiceAccountToken: false
.The security docs say
https://github.com/argoproj/argo-workflows/issues/10937 was not a bug. It is possible to explicitly mount a token to container and script template workflows even if
automountServiceAccountToken: false
so the code change was not needed.Modifications
resource
template withautomountServiceAccountToken: false
andexecutor.serviceAccountName
setVerification
Tests passed