k8s-scripts
k8s-scripts copied to clipboard
more specific deployment
I have a couple of concerns about how to specify versions using k8s-deploy. I'd be happy to make changes, just want to lay out my case and get feedback first.
- k8s-deploy works by
sed
ing:latest
out of a deployment file. This is overly broad, because it doesn't allow two images with the version:latest
- in production, services should not be using the
latest
tag for images at all, IMO. They should use either a branch name, likeproduction
, or a specific build id, like a commit sha or branch+buildnum, like production-123.
proposal:
- in deploy-service, make the sed specific enough to match a single image, like
image: ${DOCKER_IMAGE}:(.+)$
- capture the image tag in the sed expression, so the existing script is free to use a value other than
latest
in the checked-in deployment.yml
Hi @arohner - good feedback.
Do you have an example of using multiple images using :latest in the same deployment that you would want to SED to different values? I would think that's not that common.
FWIW, I'm being defensive about that because I'm leveraging this behavior to trigger rolling deploys of apps when their underlying configmap changes (https://github.com/cloudytimemachine/gateway/blob/master/deploy/gateway.deployment.yml#L26)
In that app, I'm using the same nginx image for every release, but the relevant configmap changes on each deploy. To force kubernetes to do a rolling deploy, I need to modify the Deployment object... and I'm using ENV for this. It's a hack, I'm not happy about it, but it works.
I DO agree that being able to specific the image tag in the sed expression would be more explicit. Maybe if you don't specify (in the configfile?), then we default to :latest