Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment Update Flow #71

Closed
scottrobertson opened this issue May 25, 2018 · 5 comments
Closed

Deployment Update Flow #71

scottrobertson opened this issue May 25, 2018 · 5 comments

Comments

@scottrobertson
Copy link

Hey

Just wondering what the best workflow is for when i need to update a deployment without wiping out the image? Right now i need to call:

kubectl get deployment app -o yaml

Copy the whole image into into my deployment.yaml file, and then i can do kubectl apply

Basically my question is: is there a better way to handle all of this, and to make it play nice with gitkube?

@scottrobertson
Copy link
Author

One horrible hacky way would be to tag latest too and just have that in the deployment.yaml as the image, so when i run kubectl apply it does not change which image is deployed.

@shahidhk
Copy link
Member

shahidhk commented May 25, 2018

@scottrobertson You're just in time with this question. We just released v0.2.0 and it supports such workflows.

You can set

  manifests:
    path: k8s

in your Remote Spec and when you push to the remote now, all kubernetes yaml files in k8s directory of your git repo will be kubectl apply-ed.

So, if you want to update a deployment, make the change, commit and push and gitkube will take care of building and setting the right image.

You can find more details about manifests in the docs.

To update the existing gitkube installation to v0.2.0:

kubectl -n kube-system set image deployment/gitkubed sshd=hasura/gitkubed:v0.2.0
kubectl -n kube-system set image deployment/gitkube-controller controller=hasura/gitkube-controller:v0.2.0

@scottrobertson
Copy link
Author

That looks awesome thanks! It will work really nicely for most of my projects 👍

However, for some projects it wont work (specifically open source projects that i do not want to push Kubernetes configs to). I will have to try and think of a way around this without having to copy the image every time i want to update things.

@shahidhk
Copy link
Member

k8s conf is kept separate from code and you need to update the conf, right?

A kubectl apply flag that can ignore certain fields (image) would have been awesome.

@shahidhk
Copy link
Member

@scottrobertson Another way to solve this issue is to make the controller watch all the deployments that it is responsible for and when the image key changes (say from a kubectl apply), it goes and patch the deployment with latest build tag.

Now, controller will need to track that latest build tag, which can be done by adding a new key to the Remote's status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants