LeYAUable
LeYAUable

Reputation: 1752

How to force a redeploy with HELM

I would like to use HELM to force a deployment to redeploy on Openshift.

I am using "image@latest" for the deployment as I want to have the latest image whenever I deploy, but I don't want to have a image change trigger because I don't have control on how often the image changes and I may need to change some things in the chart (config-maps, for instance) prior to deploying for a new version of the image. Hence why I don't want for to have an image trigger for the deployment.

Basically, I want it to redeploy when I want it to and not automatically, and I would prefer to do it with helm, and I tried with helm upgrade.

Currently I have a Config Change Trigger so in the case I change the chart (which contains the configs), the deployment redeploys. But if nothing changes in the chart, I am not finding any way to force a redeploy through Helm.

Is there any way it is possible to do?

Upvotes: 5

Views: 36835

Answers (2)

Shahram Shobeiri
Shahram Shobeiri

Reputation: 90

You can use this annotation in your Deploy manifest to force deploy on ConfigMap changes.

kind: Deployment
spec:
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
...

Here is the source

Upvotes: 4

LeYAUable
LeYAUable

Reputation: 1752

I managed to find a solution. I added on spec-template-metadata-annotations the following:

timestamp: {{ now | quote }}

This basically makes the chart always change which will trigger a redeploy every time I run helm upgrade.

Upvotes: 14

Related Questions