I have a workflow for work (private repo) that required setting images on Kubernetes clusters and the workflow file was getting harder and harder to read.
So I decided to create Kubernetes: Set Image that generates
kubectl commands to help with changing images on deployments, and wait until the changes take effect.
I'll be using this for automatic environments, manual dispatch for more stable environments.
- Supports multiple deployments
- Supports multiple containers per deployment
- Groups deployment commands, so if you have two changes to one deployment, it will only run one kubectl line.
- Wait until the cluster reports that the changes have been applied.
The README has examples of how to use this action.
on: [push] jobs: test: runs-on: ubuntu-latest name: Testing steps: - name: Test our action uses: andrioid/gh-action-k8s-set-image with: namespace: "default" images: | deployment.example.backend=gcr.io/example/backend:latest deployment.example.frontend=gcr.io/example/frontend:latest
kubectl --namespace default set image deployment/example backend=gcr.io/example/backend:latest frontend=gcr.io/example/frontend:latest kubectl --namespace default rollout status deployment/example
Special thanks to: