Kong / Kong/kubernetes-testing-framework

Support remote kind clusters

Open
#284 3 comments 0 reactions 0 assignees View on GitHub
area/feature nice-to-have
Dominant language
Go
Stars
44
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Problem Statement

As a user of ktf I'd like to be able to use remote kind setups e.g. kind available in a local or remote VM when I'm providing an existing cluster via [`KONG_TEST_CLUSTER`](https://github.com/Kong/kubernetes-ingress-controller/blob/03fe8c9bd6b313eefd2e46382065890e24a626b4/test/integration/utils_test.go#L126-L128).

As of now when creating a client for cluster in [`clientForCluster`](https://github.com/Kong/kubernetes-testing-framework/blob/42713e53b243788d821ff4fa462946ccc76fe7c7/pkg/clusters/types/kind/utils.go#L73) ktf issues:

```console
kind get kubeconfig --name
```

which returns the following error when kind/docker is not available on the machine from the this is being called:

```
ERROR: failed to list nodes: command "docker ps -a --filter label=io.x-k8s.kind.cluster=kind-kong --format '{{.Names}}'" failed with error: exit status 1
Command Output: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

Where `kind-kong` is the name of my cluster.

### Proposed Solution

- Try using an alternative approach when running `kind get kubeconfig` fails, e.g. via:

```console
kubectl config view --minify --context --flatten
```

- Account for that changes in other places in code where it is assumed that locally working `kind` command is available.

### Additional information

_No response_

### Acceptance Criteria

- [ ] Ensure current use cases for local `kind` setup still work
- [ ] Make remote `kind` setup work when specifying existing cluster via `KONG_TEST_CLUSTER`

Contributor guide

Open the contributing guide

Research direction

Start in pkg/clusters/types/kind/utils.go at clientForCluster, then search for other code that assumes a locally available kind or Docker command. Reproduce the existing-cluster path using KONG_TEST_CLUSTER and compare local and remote setups. Done means local kind use still works and a remote kind cluster can be used through the existing-cluster configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, kubernetes
Domain
infrastructure, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.