You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2id="technology-stack">Technology Stack<aclass="headerlink" href="#technology-stack" title="Anchor link to this section for reference">⚓</a></h2>
972
972
<p>The operator is built with <strong>Go</strong> using the <ahref="https://github.com/kubernetes-sigs/controller-runtime">controller-runtime</a> framework. Key technologies:</p>
<h3id="step-5-start-the-test-by-deploying-the-locusttest-custom-resource"><spanclass="twemoji"><svgxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><pathd="M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-2 14.5 6-4.5-6-4.5z"/></svg></span> Step 5: Start the test by deploying the <em>LocustTest</em> custom resource.<aclass="headerlink" href="#step-5-start-the-test-by-deploying-the-locusttest-custom-resource" title="Anchor link to this section for reference">⚓</a></h3>
1162
1173
<p>Deploying a <em>custom resource</em>, signals to the <em>Operator</em> the desire to start a test and thus the <em>Operator</em> starts creating and scheduling
1163
-
all needed resources.<br/>
1174
+
all needed resources.
1164
1175
To do that, deploy the custom resource following this template <code>kubectl apply -f <valid_cr>.yaml</code>:</p>
<pclass="admonition-title">Tests are immutable</p>
1181
+
<p>LocustTest CRs are <strong>immutable after creation</strong>. If you need to change test parameters (image, command, replicas, etc.), delete the CR and recreate it:</p>
<p>See <ahref="../how_does_it_work/#immutable-tests">How does it work</a> for more details on this design decision.</p>
1187
+
</div>
1168
1188
<h4id="step-51-check-cluster-for-running-resources">Step 5.1: Check cluster for running resources<aclass="headerlink" href="#step-51-check-cluster-for-running-resources" title="Anchor link to this section for reference">⚓</a></h4>
1169
1189
<p>At this point, it is possible to check the cluster and all required resources will be running based on the passed configuration in the
1170
1190
custom resource.</p>
@@ -1174,6 +1194,19 @@ <h4 id="step-51-check-cluster-for-running-resources">Step 5.1: Check cluster for
1174
1194
<li>A kubernetes <em>Job</em> to manage the <em>master</em> node.</li>
1175
1195
<li>A kubernetes <em>Job</em> to manage the <em>worker</em> node.</li>
1176
1196
</ul>
1197
+
<h4id="step-52-access-the-locust-web-ui">Step 5.2: Access the Locust web UI<aclass="headerlink" href="#step-52-access-the-locust-web-ui" title="Anchor link to this section for reference">⚓</a></h4>
1198
+
<p>The Locust web UI allows you to monitor test progress, view statistics, and control test execution in real time.</p>
1199
+
<p>The web UI runs on port <strong>8089</strong> of the master pod. To access it, use <code>kubectl port-forward</code>:</p>
<p>Then open <ahref="http://localhost:8089">http://localhost:8089</a> in your browser.</p>
1206
+
<divclass="admonition tip">
1207
+
<pclass="admonition-title">Using autostart</p>
1208
+
<p>When <code>master.autostart</code> is enabled (the default), the test begins automatically without interaction via the web UI. The web UI is still useful for monitoring progress and viewing real-time statistics.</p>
1209
+
</div>
1177
1210
<h3id="step-6-clear-resources-after-test-run"><spanclass="twemoji"><svgxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><pathd="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"/></svg></span> Step 6: Clear resources after test run<aclass="headerlink" href="#step-6-clear-resources-after-test-run" title="Anchor link to this section for reference">⚓</a></h3>
1178
1211
<p>In order to remove the cluster resources after a test run, simply remove the custom resource and the <em>Operator</em> will react to this event by
1179
1212
cleaning the cluster of all <strong>related</strong> resources.<br/>
<h2id="key-design-decisions">Key Design Decisions<aclass="headerlink" href="#key-design-decisions" title="Anchor link to this section for reference">⚓</a></h2>
819
819
<h3id="immutable-tests">Immutable Tests<aclass="headerlink" href="#immutable-tests" title="Anchor link to this section for reference">⚓</a></h3>
820
-
<p>Tests are <strong>immutable by design</strong>. Updates to a LocustTest CR after creation are ignored. To change test parameters, delete and recreate the CR. This ensures:</p>
820
+
<p>Tests are <strong>immutable by design</strong>. Once a LocustTest CR is created, updates to its <code>spec</code> are <strong>ignored</strong> by the operator. The operator sets a <code>SpecDrifted</code> condition on the CR to indicate when spec changes have been detected but not applied.</p>
821
+
<p>To change test parameters (image, commands, replicas, etc.), <strong>delete and recreate</strong> the CR:</p>
822
+
<divclass="highlight"><pre><span></span><code><spanclass="c1"># Delete the existing test</span>
<pclass="admonition-title">Critical: Webhook Required for v1 API Compatibility</p>
1181
+
<p>If you have existing v1 <code>LocustTest</code> CRs, the conversion webhook is <strong>required</strong> for them to continue working after upgrading to v2. Without it, v1 CRs will fail CRD schema validation.</p>
1182
+
<p>You <strong>must</strong>:</p>
1183
+
<ol>
1184
+
<li>Install <ahref="https://cert-manager.io/docs/installation/">cert-manager</a> before upgrading</li>
1185
+
<li>Enable the webhook during upgrade: <code>--set webhook.enabled=true</code></li>
1186
+
<li>Verify the webhook is running after upgrade</li>
1187
+
</ol>
1188
+
<p>If you only use v2 CRs (or are starting fresh), the webhook is optional.</p>
1189
+
</div>
1179
1190
<hr/>
1180
1191
<h2id="step-1-update-helm-chart">Step 1: Update Helm Chart<aclass="headerlink" href="#step-1-update-helm-chart" title="Anchor link to this section for reference">⚓</a></h2>
1181
1192
<h3id="upgrade-command">Upgrade Command<aclass="headerlink" href="#upgrade-command" title="Anchor link to this section for reference">⚓</a></h3>
<spanclass="c1"># If you don't need v1 API compatibility, you can omit --set webhook.enabled=true</span>
1189
1203
</code></pre></div>
1204
+
<divclass="admonition note">
1205
+
<pclass="admonition-title">CRD Upgrade</p>
1206
+
<p>Helm automatically upgrades the CRD when using <code>helm upgrade</code>. The v2 CRD includes conversion webhook configuration when webhooks are enabled, allowing the API server to convert between v1 and v2 formats transparently.</p>
1207
+
</div>
1190
1208
<h3id="new-helm-values">New Helm Values<aclass="headerlink" href="#new-helm-values" title="Anchor link to this section for reference">⚓</a></h3>
1191
1209
<p>The v2 chart introduces a cleaner structure. Key changes:</p>
0 commit comments