<p>For some integration tests we would like to have a way of ensuring, that only one test at a time has access to certain resources (e.g. 3 <em>DeploymentConfigurations</em>).</p>

<p>For that to work we have have the following workflow:</p>

<ol>
<li>Before test is started - wait until all <em>DCs</em> are "undeployed".</li>
<li>When test is started - set <em>DC</em> <code>replicas</code> to <code>1</code>.</li>
<li>When test is stopped - set <em>DC</em> <code>replicas</code> to <code>0</code>.</li>
</ol>

<p>This works to some degree, but obviously has the problem, that once the test terminates unexpectedly, the <em>DCs</em> might still be in flight.</p>

<p>Now one way to "solve" this would be to introduce a <em>CR</em>, with a <em>Controller</em>, which handles lifetime of the lock (CR).</p>

<p>Is there any more elegant and straight forward way of allowing unique access to Kubernetes resources?</p>

<hr>

<p><strong>EDIT:</strong></p>

<p>Sadly we are stuck with Kubernetes 1.9 for now.</p>

abergmeier
<p>look at 'kubectl wait' api to set different conditions between the test flow and depending on the result proceed to next test step.</p>
