@@ -81,54 +81,92 @@ type K6Scuttle struct {
8181
8282// TestRunSpec defines the desired state of TestRun
8383type TestRunSpec struct {
84- Script K6Script `json:"script"`
85- Parallelism int32 `json:"parallelism"`
86- Separate bool `json:"separate,omitempty"`
87- Arguments string `json:"arguments,omitempty"`
88- Ports []corev1.ContainerPort `json:"ports,omitempty"`
89- Initializer * Pod `json:"initializer,omitempty"`
90- Starter Pod `json:"starter,omitempty"`
91- Runner Pod `json:"runner,omitempty"`
92- Quiet string `json:"quiet,omitempty"`
93- Paused string `json:"paused,omitempty"`
94- Scuttle K6Scuttle `json:"scuttle,omitempty"`
95- Cleanup Cleanup `json:"cleanup,omitempty"`
84+ // Script describes where the k6 script is located.
85+ Script K6Script `json:"script"`
9686
87+ // Parallelism shows the number of k6 runners.
88+ Parallelism int32 `json:"parallelism"`
89+
90+ // Separate is a quick way to run all k6 runners on different hostnames
91+ // using the podAntiAffinity rule.
92+ Separate bool `json:"separate,omitempty"`
93+
94+ // Arguments to pass to the k6 process.
95+ Arguments string `json:"arguments,omitempty"`
96+
97+ // Port to configure on all k6 containers.
98+ // Port 6565 is always configured for k6 processes.
99+ Ports []corev1.ContainerPort `json:"ports,omitempty"`
100+
101+ // Configuration for the initializer Pod. If omitted, the initializer
102+ // is configured with the same parameters as a runner Pod.
103+ Initializer * Pod `json:"initializer,omitempty"`
104+
105+ // Configuration for the starter Pod.
106+ Starter Pod `json:"starter,omitempty"`
107+
108+ // Configuration for a runner Pod.
109+ Runner Pod `json:"runner,omitempty"`
110+
111+ // Quiet is a boolean variable that allows to swtich off passing the `--quiet` to k6.
112+ // +kubebuilder:default="true"
113+ Quiet string `json:"quiet,omitempty"`
114+
115+ // Paused is a boolean variable that allows to switch off passing the `--paused` to k6.
116+ // Use with caution as it can skew the result of the test.
117+ // +kubebuilder:default="true"
118+ Paused string `json:"paused,omitempty"`
119+
120+ // Configuration for Envoy proxy.
121+ Scuttle K6Scuttle `json:"scuttle,omitempty"`
122+
123+ Cleanup Cleanup `json:"cleanup,omitempty"`
124+
125+ // TestRunID is reserved by Grafana Cloud k6. Do not set it manually.
97126 TestRunID string `json:"testRunId,omitempty"` // PLZ reserved field
98- Token string `json:"token,omitempty"` // PLZ reserved field (for now)
127+
128+ // Token is reserved by Grafana Cloud k6. Do not set it manually.
129+ Token string `json:"token,omitempty"` // PLZ reserved field (for now)
99130}
100131
101- // K6Script describes where the script to execute the tests is found
132+ // K6Script describes where to find the k6 script.
102133type K6Script struct {
103134 VolumeClaim K6VolumeClaim `json:"volumeClaim,omitempty"`
104135 ConfigMap K6Configmap `json:"configMap,omitempty"`
105- LocalFile string `json:"localFile,omitempty"`
136+ // LocalFile describes the location of the script in the runner image.
137+ LocalFile string `json:"localFile,omitempty"`
106138}
107139
108- // K6VolumeClaim describes the volume claim script location
140+ // K6VolumeClaim describes the location of the script on the Volume.
109141type K6VolumeClaim struct {
110- Name string `json:"name"`
111- File string `json:"file,omitempty"`
112- ReadOnly bool `json:"readOnly,omitempty"`
142+ // Name of the persistent volumeClaim where the script is stored.
143+ // It is mounted as a `/test` folder to all k6 Pods.
144+ Name string `json:"name"`
145+ // Name of the file to execute (.js or .tar), stored on the Volume.
146+ File string `json:"file,omitempty"`
147+ // ReadOnly shows whether the volume should be mounted as `readOnly`.
148+ ReadOnly bool `json:"readOnly,omitempty"`
113149}
114150
115- // K6Configmap describes the config map script location
151+ // K6Configmap describes the location of the script in the ConfigMap.
116152type K6Configmap struct {
153+ // Name of the ConfigMap. It is expected to be in the sanme namespace as the `TestRun`.
117154 Name string `json:"name"`
155+ // Name of the file to execute (.js or .tar), stored as a key in the ConfigMap.
118156 File string `json:"file,omitempty"`
119157}
120158
121159//TODO: cleanup pre-execution?
122160
123- // Cleanup allows for automatic cleanup of resources post execution
161+ // Cleanup allows for automatic cleanup of resources post execution.
124162// +kubebuilder:validation:Enum=post
125163type Cleanup string
126164
127- // Stage describes which stage of the test execution lifecycle our runners are in
165+ // Stage describes which stage of the test execution lifecycle k6 runners are in.
128166// +kubebuilder:validation:Enum=initialization;initialized;created;started;stopped;finished;error
129167type Stage string
130168
131- // TestRunStatus defines the observed state of TestRun
169+ // TestRunStatus defines the observed state of TestRun.
132170type TestRunStatus struct {
133171 Stage Stage `json:"stage,omitempty"`
134172 TestRunID string `json:"testRunId,omitempty"`
@@ -143,7 +181,7 @@ type TestRunStatus struct {
143181//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
144182//+kubebuilder:printcolumn:name="TestRunID",type="string",JSONPath=".status.testRunId"
145183
146- // TestRun is the Schema for the testruns API
184+ // TestRun is the Schema for the testruns API.
147185type TestRun struct {
148186 metav1.TypeMeta `json:",inline"`
149187 metav1.ObjectMeta `json:"metadata,omitempty"`
0 commit comments