I have a devops pipeline divided in three steps:
kubectl apply -f configmap.ymlkubectl apply -f deployment.ymlkubectl rollout restart deployment/test-service
I think that when the configmap.yml changes the rollout restart step is useful. But when only the deployment.yml changes, I'm worried that the "extra" rollout restart step is not useful and should be avoided.
Should I execute rollout restart only when the configmap.yml changes or should I don't care about?
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
kustomize(akakubectl apply -k), then you get the following behavior:ConfigMapsare generated with a content-based hash appended to their nameDeploymentDeploymentis only modified when the content of theConfigMapchanges, causing an implicit re-deploy of the pods managed by theDeployment.This largely gets you the behavior you want, but it would require some changes to your deployment pipeline.