keel-hq / keel

Kubernetes Operator to automate Helm, DaemonSet, StatefulSet & Deployment updates
https://keel.sh
Mozilla Public License 2.0
2.46k stars 282 forks source link

Policy to update by tag name itself #432

Open voatsap opened 5 years ago

voatsap commented 5 years ago

I have a use case where I need to update a deployment not just by version tag but by tag name itself.

In example we have a deployment with image serviceA:master-01. I'd like to update it when repo got an image tag: serviceA:branch-02. I hope that setting policy to policy:glob:branch-* could help me to achieve expected behavior. But it does not work. Looks when deployment with initial tag serviceA:master-01 it could only follow the :master updates

What I need to do and why such feature could be extremely useful?

I'm implementing feature-based environment workflow. When developer creates a new branch this triggers new namespace creation and deployment for all required microservices with some default tag (:latest/:master). Then developer commits the code to branch, this triggers new images build and push it to registry. My idea is to mark the resulting image with serviceA:branch tag and instruct Keel to redeploy any image we have now with the branch-one. So I can fully move feature branch workflow out of any existing CI/CD system and implement it using only Keel.

Thanks!

rusenask commented 5 years ago

Hi, policy:glob:branch-* would work if you used webhooks. We have similar workflows on several projects. If you can't use webhooks, then multi tag polling should be extended to cover this too. Currently it only looks for semver tags.

voatsap commented 5 years ago

I will test this and close the issue when achieve expected behavior. Thanks Rusenask!

rusenask commented 5 years ago

if you encounter problems - I will write a blog post on how to set this up :)

Art3mK commented 4 years ago

that wasn't clear from documentation 🙁 Spent hour trying to understand why keel ignores my policy. So for poll trigger, only force policy works, and it only could compare digests for the same tag, right?

rusenask commented 4 years ago

sorry about that, now that I am looking at the docs, I can't see that info as well. We should add a table with a matrix of what works with what. However, maybe we could review docker image distribution API to see whether they are returning dates for tags. That would enable non-semver tag updates using force policy