<p>I have a devops pipeline divided in three steps:</p>
<ul>
<li><code>kubectl apply -f configmap.yml</code></li>
<li><code>kubectl apply -f deployment.yml</code></li>
<li><code>kubectl rollout restart deployment/test-service</code></li>
</ul>
<p>I think that when the <code>configmap.yml</code> changes the <code>rollout restart</code> step is useful. But when only the <code>deployment.yml</code> changes, I'm worried that the &quot;extra&quot; <code>rollout restart</code> step is not useful and should be avoided.</p>
<p>Should I execute <code>rollout restart</code> only when the <code>configmap.yml</code> changes or should I don't care about?</p>

<p>This isn't a direct answer, but it ended up being too long for a comment and I think it's relevant. If you were to apply your manifests using <a href="https://kustomize.io/" rel="nofollow noreferrer"><code>kustomize</code></a> (<em>aka</em> <code>kubectl apply -k</code>), then you get the following behavior:</p>
<ul>
<li><code>ConfigMaps</code> are generated with a content-based hash appended to their name</li>
<li>Kustomize substitutes the generated name into your <code>Deployment</code></li>
<li>This means the <code>Deployment</code> is only modified when the content of the <code>ConfigMap</code> changes, causing an implicit re-deploy of the pods managed by the <code>Deployment</code>.</li>
</ul>
<p>This largely gets you the behavior you want, but it would require some changes to your deployment pipeline.</p>
