Skip to content

test (e2e) : create ServiceAccount token on newer versions of Kubernetes rather than waiting it to be automatically created (#1436) #1465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

rohanKanojia
Copy link
Member

@rohanKanojia rohanKanojia commented Jul 9, 2025

What does this PR do?

On newer versions of Kubernetes, token is not automatically created for ServiceAccount

https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#manual-secret-management-for-serviceaccounts

To ensure we don't fail waiting for a token on newer versions of Kubernetes, add a check to create a token if we're on newer versions of Kubernetes rather than waiting for the ServiceAccount token to become available.

What issues does this PR fix or reference?

Fix #1436

Is it tested? How?

I tested it on CRC cluster.

With these changes, I was able to run make test_e2e successfully:

> make test_e2e
2025/07/09 23:26:29 Running DevWorkspace Controller e2e tests...
Running Suite: Workspaces Controller Operator Tests - /Users/rokumar/go/src/github.com/devfile/devworkspace-operator
====================================================================================================================
Random Seed: 1752083789

Will run 4 of 4 specs
2025/07/09 23:26:29 Starting to setup objects before run ginkgo suite
2025/07/09 23:26:30 Pod 'devworkspace-webhook-server-7bf6479fd-sq5nl' created in namespace devworkspace-controller... Checking startup data.
2025/07/09 23:26:30 Pod started after 8839.468315 seconds
2025/07/09 23:26:30 Pod 'devworkspace-webhook-server-7bf6479fd-vnf4l' created in namespace devworkspace-controller... Checking startup data.
2025/07/09 23:26:30 Pod started after 8859.469902 seconds
•2025/07/09 23:26:32 Now current status of developer workspace is: Starting. Message: Waiting for workspace deployment
2025/07/09 23:26:34 Now current status of developer workspace is: Running. Message: Workspace is running
•••2025/07/09 23:26:34 Cleaning up test namespace test-terminal-namespace
2025/07/09 23:26:34 If you need resources for investigation, set the following env var CLEAN_UP_AFTER_SUITE=false
2025/07/09 23:26:35 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 59s
2025/07/09 23:26:36 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 58s
2025/07/09 23:26:37 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 57s
2025/07/09 23:26:38 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 56s
2025/07/09 23:26:39 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 55s
2025/07/09 23:26:40 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 54s
2025/07/09 23:26:41 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 53s
2025/07/09 23:26:42 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 52s
2025/07/09 23:26:43 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 51s
2025/07/09 23:26:44 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 50s
2025/07/09 23:26:45 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 49s
2025/07/09 23:26:46 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 48s
2025/07/09 23:26:47 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 47s
2025/07/09 23:26:48 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 46s
2025/07/09 23:26:49 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 45s
2025/07/09 23:26:50 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 44s
2025/07/09 23:26:51 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 43s


Ran 4 of 4 Specs in 23.612 seconds
SUCCESS! -- 4 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Without these changes, I was getting an error:

 1s until it's removed. Will time out in 1s
------------------------------
[SynchronizedBeforeSuite] [FAILED] [10.067 seconds]
[SynchronizedBeforeSuite]
/Users/rokumar/go/src/github.com/devfile/devworkspace-operator/test/e2e/cmd/workspaces_test.go:39

  [FAILED] Cannot get test SA token. Cause: ServiceAccount 'test-terminal-namespace/terminal-test' token is not found after 10
  In [SynchronizedBeforeSuite] at: /Users/rokumar/go/src/github.com/devfile/devworkspace-operator/test/e2e/cmd/workspaces_test.go:84 @ 07/09/25 23:29:48.764
------------------------------
2025/07/09 23:29:48 Cleaning up test namespace test-terminal-namespace
2025/07/09 23:29:48 If you need resources for investigation, set the following env var CLEAN_UP_AFTER_SUITE=false
2025/07/09 23:29:49 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 59s
2025/07/09 23:29:50 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 58s
2025/07/09 23:29:51 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 57s
2025/07/09 23:29:52 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 56s
2025/07/09 23:29:53 Namespace 'test-terminal-namespace' is in Terminating phase. Waiting 1s until it's removed. Will time out in 55s

Summarizing 1 Failure:
  [FAIL] [SynchronizedBeforeSuite]
  /Users/rokumar/go/src/github.com/devfile/devworkspace-operator/test/e2e/cmd/workspaces_test.go:84

Ran 0 of 4 Specs in 16.087 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestWorkspaceController (16.09s)
FAIL
make: *** [test_e2e] Error 1

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

Copy link

openshift-ci bot commented Jul 9, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rohanKanojia rohanKanojia force-pushed the pr/test-e2e-create-token branch from fda3418 to 7d26771 Compare July 9, 2025 18:07
To ensure we don't fail waiting for token on newer versions of Kubernetes,
add a check to create token if we're on newer versions of Kubernetes rather
than waiting for ServiceAccount token to become available.

Signed-off-by: Rohan Kumar <[email protected]>
@rohanKanojia rohanKanojia force-pushed the pr/test-e2e-create-token branch from 7d26771 to b6b66e0 Compare July 9, 2025 18:10
@rohanKanojia
Copy link
Member Author

/ok-to-test

@rohanKanojia rohanKanojia changed the title test : create ServiceAccount token on newer versions of Kubernetes rather than waiting it to be automatically created (#1436) test (e2e) : create ServiceAccount token on newer versions of Kubernetes rather than waiting it to be automatically created (#1436) Jul 9, 2025
@rohanKanojia rohanKanojia marked this pull request as ready for review July 10, 2025 04:38
Copy link

openshift-ci bot commented Jul 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dkwon17, rohanKanojia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dkwon17 dkwon17 merged commit cf4c38d into devfile:main Jul 28, 2025
10 checks passed
@rohanKanojia rohanKanojia deleted the pr/test-e2e-create-token branch July 29, 2025 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to run e2e tests on CRC cluster with OpenShift 4.18.2
2 participants