How does this Github Action modify deployment.yml file

9/8/2021

I am using the Azure/k8s-deploy Github Action.
The problem is how do I specify an image in the deployment manifest file so that the action modifies the deployment to a new image URL?

Right now action does not replace the image url.

It tries to apply the file without modifying the image which doesn't work.

- uses: azure/k8s-deploy@v1
  with:
    manifests: |
      k8s/deployment.yml
      k8s/service.yml
    images: |
      ${{ env.REGISTRY_NAME }}.azurecr.io/${{ env.APP_NAME }}:${{ github.sha }}
    imagepullsecrets: |
      ${{ env.SECRET }}
    namespace: ${{ env.NAMESPACE }}

I want this action to deploy k8s/deployment.yml file with image url given in images field

-- Mabroor Ahmad
azure
azure-aks
github-actions
kubernetes

1 Answer

9/8/2021

A solution can be added Kustomization step to your git-action' **but** you will need to create an extra file namedkustomization.yaml` in order to use it.


Kustomization will allow you to modify the desired image

A sample code on how to update the image with Kustomization: https://github.com/nirgeier/KubernetesLabs/tree/master/Labs/08-Kustomization#images


kustomize-github-action

https://github.com/marketplace/actions/kustomize-github-action

-- CodeWizard
Source: StackOverflow