Skip to content

Commit 1779ffa

Browse files
author
Miles-Garnsey
committed
Add proposed changes for the TestStep and TestCase APIs to support multi cluster tests.
Signed-off-by: Miles-Garnsey <miles.garnsey@datastax.com>
1 parent 072f002 commit 1779ffa

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

keps/0008-multi-cluster.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,29 @@ Currently, KUTTL only supports a single test cluster. This KEP describes how we
3333
* Support applying resources across more than one test cluster.
3434
* Support asserting on resources across more than one test cluster.
3535

36-
## Proposal
36+
## Proposals - TestStep API changes
37+
38+
The proposal is to add a new setting within `TestStep`. We propose this field be called `runOnCluster` and of type `[]string`. This setting would allow the user to specify a list of the clusters set up by the `TestSuite` on which to run `TestSteps`.
39+
40+
Recall that `TestSuite` contains a map of `KindConfig`s, entries in the `runOnCluster` would refer to one of the keys in this map. Where a user has specified homogenous clusters using `GlobalKindConfig` and `NumClusters`, a uniform naming scheme should exist to make identification of the right cluster to run on possible.
3741

38-
The proposal is to add a new setting to the `TestStep` object: `kubeconfig`. This setting would allow the user to specify an alternative kubeconfig path to use for a given test step.
3942

4043
```
4144
apiVersion: kudo.dev/v1alpha1
4245
kind: TestStep
43-
kubeconfig: ./secondary-cluster.yaml
46+
runOnCluster:
47+
- my-cluster-1
48+
- my-cluster-2
4449
```
4550

46-
If the kubeconfig setting is not set, then the global Kubernetes client is used.
51+
If the runOnCluster setting is not set, then the `TestStep` will be run on all clusters.
4752

48-
If the kubeconfig setting is set, then it will be used for all Kubernetes operations within the step: commands (the KUBECONFIG environment variable will be set to the kubeconfig setting, relative to the KUTTL CLI's working directory), applied resources, asserts, and errors. This means that a single step can only be configured to use a single kubeconfig, but multiple steps can be used if a test case needs to interact with more than one cluster. This allows, for example, a federated resource to be created in one step and then another step can be used to verify that it actually exists on the destination cluster.
53+
Where multiple clusters are specified (including if the `runOnCluster` field is unset), each script and command will be run in parallel on the desired clusters.
4954

50-
Note that the `kubeconfig` setting on the `TestStep` would be unaffected by the global Kubernetes configuration, so the `--kubeconfig` flag, `$KUBECONFIG` environment variable, etc, will be ignored for these steps.
55+
The kubeconfig file location, and the name of the context for the target cluster will be made available as environment variables `KUBECONFIG` and `KUBECONTEXT` in the scripts and commands.
56+
57+
## Proposals - TestCase API changes
5158

5259
A namespace is generated for each `TestCase` and this needs to be created in each cluster referenced by `TestSteps` within the `TestCase`. At the beginning of the `TestCase`, the generated namespace will be created in every cluster used in the `TestCase`. The namespaces will also be deleted at the end if `--skip-delete` is not set.
60+
61+
Additionally, the `TestCase` struct needs to be updated to include the cluster identifer, which we propose could be the key from the map holding the cluster configurations from `MapKindConfig` specified within the `TestSuite`.

0 commit comments

Comments
 (0)