From 15772a4e9ec4e4ca689aad2eb2ac6224f1b838f5 Mon Sep 17 00:00:00 2001 From: Olha Yevtushenko Date: Fri, 29 Sep 2023 17:10:00 +0300 Subject: [PATCH] update Readme and examples with TestRun CRD --- README.md | 20 ++++++++++--------- .../k6_v1alpha1_k6_with_localfile.yaml | 2 +- .../samples/k6_v1alpha1_k6_with_output.yaml | 2 +- .../k6_v1alpha1_k6_with_volumeClaim.yaml | 2 +- e2e/test-initcontainer-volumes.yaml | 2 +- e2e/test-initcontainer.yaml | 2 +- e2e/test.yaml | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1e980030..b393fffb 100644 --- a/README.md +++ b/README.md @@ -39,16 +39,18 @@ This method may be more useful for development of k6-operator, depending on spec ### Installing the CRD -The k6 operator includes custom resources called `K6` and `PrivateLoadZone`. These will be automatically installed when you do a +The k6-operator includes custom resources called `TestRun` and `PrivateLoadZone`. These will be automatically installed when you do a deployment or install a bundle, but in case you want to do it yourself, you may run the command below: ```bash make install ``` +> :warning: `K6` CRD has been substituted with `TestRun` CRD and will be deprecated in the future. + ## Usage -Two samples are available in `config/samples`, one for a test script and one for an actual test run. +Samples are available in `config/samples` and `e2e/`, both for `TestRun` and for `PrivateLoadZone`. ### Adding test scripts @@ -126,14 +128,14 @@ There is a sample avaiable in `config/samples/k6_v1alpha1_k6_with_localfile.yaml ### Executing tests -Tests are executed by applying the custom resource `K6` to a cluster where the operator is running. The properties +Tests are executed by applying the custom resource `TestRun` to a cluster where the operator is running. The properties of a test run are few, but allow you to control some key aspects of a distributed execution. ```yaml # k6-resource.yml apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample spec: @@ -199,7 +201,7 @@ If you want to use a custom Service Account you'll need to pass it into both the ```yaml apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: spec: @@ -311,7 +313,7 @@ The above command will create an archive.tar in your current folder unless `-O` kubectl create configmap scenarios-test --from-file=archive.tar ``` -In case of using an archive it must be additionally specified in your yaml for K6 deployment: +In case of using an archive it must be additionally specified in your yaml for TestRun deployment: ```yaml # ... @@ -327,7 +329,7 @@ In other words, `file` option must be the correct entrypoint for `k6 run`. ### Using extensions By default, the operator will use `grafana/k6:latest` as the container image for the test jobs. -If you want to use [extensions](https://k6.io/docs/extensions/get-started/explore/) built with [xk6](https://github.com/grafana/xk6) you'll need to create your own image and override the `image` property on the `K6` kubernetes resource. +If you want to use [extensions](https://k6.io/docs/extensions/get-started/explore/) built with [xk6](https://github.com/grafana/xk6) you'll need to create your own image and override the `image` property on the `TestRun` kubernetes resource. For example, create a `Dockerfile` with the following content: @@ -357,7 +359,7 @@ We can now use it as follows: # k6-resource-with-extensions.yml apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample-with-extensions spec: @@ -409,7 +411,7 @@ rules: - apiGroups: - k6.io resources: - - k6s + - testruns verbs: - create - delete diff --git a/config/samples/k6_v1alpha1_k6_with_localfile.yaml b/config/samples/k6_v1alpha1_k6_with_localfile.yaml index f3378df2..72aae564 100644 --- a/config/samples/k6_v1alpha1_k6_with_localfile.yaml +++ b/config/samples/k6_v1alpha1_k6_with_localfile.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample spec: diff --git a/config/samples/k6_v1alpha1_k6_with_output.yaml b/config/samples/k6_v1alpha1_k6_with_output.yaml index 74f17b23..9c11122e 100644 --- a/config/samples/k6_v1alpha1_k6_with_output.yaml +++ b/config/samples/k6_v1alpha1_k6_with_output.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample spec: diff --git a/config/samples/k6_v1alpha1_k6_with_volumeClaim.yaml b/config/samples/k6_v1alpha1_k6_with_volumeClaim.yaml index 98f089de..81698797 100644 --- a/config/samples/k6_v1alpha1_k6_with_volumeClaim.yaml +++ b/config/samples/k6_v1alpha1_k6_with_volumeClaim.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample namespace: load-test diff --git a/e2e/test-initcontainer-volumes.yaml b/e2e/test-initcontainer-volumes.yaml index d2746a00..4804c1a5 100644 --- a/e2e/test-initcontainer-volumes.yaml +++ b/e2e/test-initcontainer-volumes.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample-init-container-volume spec: diff --git a/e2e/test-initcontainer.yaml b/e2e/test-initcontainer.yaml index 470b35a7..43d2bd06 100644 --- a/e2e/test-initcontainer.yaml +++ b/e2e/test-initcontainer.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample-init-container spec: diff --git a/e2e/test.yaml b/e2e/test.yaml index 2098cf6a..439cf002 100644 --- a/e2e/test.yaml +++ b/e2e/test.yaml @@ -1,6 +1,6 @@ --- apiVersion: k6.io/v1alpha1 -kind: K6 +kind: TestRun metadata: name: k6-sample spec: