-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to connect cluster when AutomountServiceAccountToken is d…
- Loading branch information
1 parent
131a854
commit 3dbb9dc
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/e2e/manifests/mixins/argo.service-account-token-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: argo.service-account-token | ||
annotations: | ||
kubernetes.io/service-account.name: argo | ||
type: kubernetes.io/service-account-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
//go:build functional | ||
// +build functional | ||
|
||
package e2e | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/suite" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" | ||
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures" | ||
) | ||
|
||
type WorkflowSuite struct { | ||
fixtures.E2ESuite | ||
} | ||
|
||
func (s *WorkflowSuite) TestContainerTemplateAutomountServiceAccountTokenDisabled() { | ||
s.Given().Workflow(` | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: get-resources-via-container-template- | ||
namespace: argo | ||
spec: | ||
serviceAccountName: argo | ||
automountServiceAccountToken: false | ||
executor: | ||
serviceAccountName: argo | ||
entrypoint: main | ||
templates: | ||
- name: main | ||
container: | ||
name: main | ||
image: bitnami/kubectl | ||
command: | ||
- sh | ||
args: | ||
- -c | ||
- | | ||
kubectl get cm | ||
`). | ||
When(). | ||
SubmitWorkflow(). | ||
WaitForWorkflow(fixtures.ToBeSucceeded, time.Minute*10). | ||
Then(). | ||
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { | ||
assert.Equal(t, wfv1.WorkflowSucceeded, status.Phase) | ||
}) | ||
} | ||
|
||
func (s *WorkflowSuite) TestScriptTemplateAutomountServiceAccountTokenDisabled() { | ||
s.Given().Workflow(` | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: get-resources-via-script-template- | ||
namespace: argo | ||
spec: | ||
serviceAccountName: argo | ||
automountServiceAccountToken: false | ||
executor: | ||
serviceAccountName: argo | ||
entrypoint: main | ||
templates: | ||
- name: main | ||
script: | ||
name: main | ||
image: bitnami/kubectl | ||
command: | ||
- sh | ||
source: | ||
kubectl get cm | ||
`). | ||
When(). | ||
SubmitWorkflow(). | ||
WaitForWorkflow(fixtures.ToBeSucceeded, time.Minute*10). | ||
Then(). | ||
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { | ||
assert.Equal(t, wfv1.WorkflowSucceeded, status.Phase) | ||
}) | ||
} | ||
|
||
func TestWorkflowSuite(t *testing.T) { | ||
suite.Run(t, new(WorkflowSuite)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters