Un-hardcode deploy config image tag name

4/11/2018

Right now our DC (deployment config) has this hardcoded it it:

/// dc.yaml

 image: containers.nabisco.com/cdt-org/cdt-dev:latest

then we roll out the dc with:

$ oc rollout latest dc/cdtcae-prod-deployment

however one problem I am noticing is that sometimes the "latest" tag refers to an old one and the newer one doesn't get pulled in - might be a bug with OpenShift or Kubernetes or what not.

we want to use git commit hashes to uniquely identify deployments, for the moment.

My question is - is there a way to override / update the image: line above, using the command line, so this line:

 image: containers.nabisco.com/cdt-org/cdt-dev:latest

would get overriden by something like this:

oc rollout --tag="$my_git_commit_hash" dc/cdtcae-prod-deployment
-- Alexander Mills
kubernetes
openshift
openshift-3

1 Answer

4/11/2018

I heard that the best option would be to use the following setting in your yaml DC config:

 imagePullPolicy: "Always"

then you can just hard code some unique value

image: containers.nabisco.com/cdt-org/cdt-dev:foobarbaz

and it will always pull the latest one, instead of using the cache.

-- Alexander Mills
Source: StackOverflow