-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ (go/v4): Add optional kubectl context locking for e2e tests #5336
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
base: master
Are you sure you want to change the base?
✨ (go/v4): Add optional kubectl context locking for e2e tests #5336
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
049342e to
aa0c6e4
Compare
e664caa to
c8fa24a
Compare
|
@mandarjog could you please give a look on this one? |
c8fa24a to
1df6ec6
Compare
E2E tests now support optional context locking via KUBE_CONTEXT environment variable. When set, tests validate and lock to the specified kubectl context, preventing context switching during execution. Features: - Display current kubectl context at test startup - Validate context matches KUBE_CONTEXT if set - Add --context flag to all kubectl commands when locked - 100% backward compatible (opt-in feature) Usage: KUBE_CONTEXT=kind-test make test-e2e This addresses feedback from PR kubernetes-sigs#5329 about preventing inadvertent context switching during test execution, while maintaining ease of use (works without any env vars by default). Assisted-by: Cursor
1df6ec6 to
cd07c62
Compare
|
/test pull-kubebuilder-e2e-k8s-1-34-0 |
vitorfloriano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't kubectl validate available contexts based on kubeconfig?
I mean, if we only pass KUBE_CONTEXT to the --context flag in the command without setting this new context first in kubeconfig using kubectl config set-context first, wouldn't that cause an error?
E2E tests now support optional context locking via KUBE_CONTEXT environment
variable. When set, tests validate and lock to the specified kubectl context,
preventing context switching during execution.
Features:
Usage:
KUBE_CONTEXT=kind-test make test-e2e
This addresses feedback from PR #5329 about preventing inadvertent context
switching during test execution, while maintaining ease of use (works without
any env vars by default).
Closes: #5335
Co-Author: @Sijoma