Skip to content
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

refactor(e2e): unix-like loader for Kubernetes connection parameters #459

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

diafour
Copy link
Member

@diafour diafour commented Oct 18, 2024

Description

Parameters priority from highest to lowest:

  • token and endpoint in e2e config file or from envs.
  • Kube config in e2e config file or from E2E_CLUSTERTRANSPORT_KUBECONFIG env.

Fallback to kubectl behaviour if previous settings are empty:

  • KUBECONFIG environment variable
  • Default config location $HOME/.kube/config

Remove default config location from taskfile, kubectl and d8 executors should decide what to use.

Executor env is now inherited with override from conf.

Why do we need it, and what problem does it solve?

KUBECONFIG env is now works.

What is the expected result?

  1. Set KUBECONFIG to cluster without Deckhouse.
$ TEST="Virtual machine migration" task run_one

2024/10/18 11:06:29 error: the server doesn't have a resource type "moduleconfigs"

Ginkgo ran 1 suite in 9.789374666s

Test Suite Failed
task: Failed to run task "run_one": exit status 1
  1. Set KUBECONFIG cluster with virtualization module, but ssh tunnel is down.
$ TEST="Virtual machine migration" task run_one
2024/10/18 11:07:02 E1018 11:07:02.966987   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.967472   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.968470   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.968740   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.969783   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.970003   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
E1018 11:07:02.971132   21627 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:6445/api?timeout=32s": dial tcp 127.0.0.1:6445: connect: connection refused
The connection to the server 127.0.0.1:6445 was refused - did you specify the right host or port?

Ginkgo ran 1 suite in 7.835066033s

Test Suite Failed
task: Failed to run task "run_one": exit status 1
  1. Tunnel is up:
$ TEST="Virtual machine migration" task run_one
  Starting test suite
Running Suite: Tests - /Users/diafour/Projects/deckhouse/virtualization-controller/tests/e2e
============================================================================================
Random Seed: 1729238854

Will run 7 of 230 specs
...
Ran 7 of 230 Specs in 89.772 seconds
SUCCESS! -- 7 Passed | 0 Failed | 0 Pending | 223 Skipped
PASS

Ginkgo ran 1 suite in 2m48.498105018s
Test Suite Passed
  1. unset KUBECONFIG, set E2E_CLUSTERTRANSPORT_KUBECONFIG override:
$ cp $KUBECONFIG ./local-e2e-test-kubeconfig
$ unset KUBECONFIG
$ set | grep 'KUBECONFIG\|TEST'
E2E_CLUSTERTRANSPORT_KUBECONFIG=./local-e2e-test-kubeconfig
TEST='Virtual machine migration'
$ task run_one
  Starting test suite
Running Suite: Tests - /Users/diafour/Projects/deckhouse/virtualization-controller/tests/e2e
============================================================================================
Random Seed: 1729239578

Will run 7 of 230 specs
...
Ran 7 of 230 Specs in 87.057 seconds
SUCCESS! -- 7 Passed | 0 Failed | 0 Pending | 223 Skipped
PASS

Ginkgo ran 1 suite in 2m47.810759717s
Test Suite Passed

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

yaroslavborbat
yaroslavborbat previously approved these changes Oct 21, 2024
Parameters priority from highest to lowest:

- Direct settings in e2e config file: token and endpoint.
- Kube config in e2e config file or from E2E_CLUSTERTRANSPORT_KUBECONFIG
Fallback to kubectl behaviour:
- KUBECONFIG environment variable
- Default config location $HOME/.kube/config

Remove default config location from taskfile, kubectl and d8 executors should decide what to use.

Executor env is now inherited with override from conf.

Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
@diafour diafour merged commit 9c4b736 into main Oct 21, 2024
11 checks passed
@diafour diafour deleted the refactor/e2e/kubeconfig-env-handling branch October 21, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants