k8s-deploy icon indicating copy to clipboard operation
k8s-deploy copied to clipboard

Bug: kubectl annotate files loses annotations with private cluster

Open y-luis-rojo opened this issue 2 years ago • 1 comments

What happened?

Using k8s-deploy with a private cluster, fails to annotate (and label) deployment resource after successfully annotated namespace (see logs below, removed key-value pairs for simplicity).

Workflow step:

      - uses: Azure/k8s-deploy@v4
        with:
          namespace: next-test
          private-cluster: true
          resource-group: ${{ env.RESOURCE_GROUP }}
          name: ${{ env.CLUSTER_NAME }}
          manifests: |
            k8s/deployment.yaml
          images: |
            ${{ env.CONTAINER_REGISTRY }}.azurecr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

Not sure if related but noticed any JSON output (docker inspect, kubectl get namespace/next-test -o json) shows malformed (*** instead of {), for example (fragment):

##[debug]private cluster Kubectl run with invoke command: kubectl get namespace/next-test -o json
  /usr/bin/az aks command invoke --resource-group mappdev-kaas --name mappdev-cluster --command kubectl get namespace/next-test -o json
  command started at 2022-10-11 15:39:02+00:00, finished at 2022-10-11 15:39:03+00:00 with exitcode=0
  ***
      "apiVersion": "v1",
...

Version

  • [X] I am using the latest version

Runner

self-hosted Ubuntu 20.04

Relevant log output

##[debug]private cluster Kubectl run with invoke command: kubectl annotate namespace next-test actions.github.com/k8s-deploy=***"run":"496145",<other key-value pairs> --overwrite
command started at 2022-10-11 15:39:20+00:00, finished at 2022-10-11 15:39:21+00:00 with exitcode=0
namespace/next-test annotated

##[debug]private cluster Kubectl run with invoke command: kubectl annotate -f deployment.yaml --overwrite
##[debug]Successfully moved file 'deployment.yaml' from /tmp to /tmp/manifest directory
/usr/bin/az aks command invoke --resource-group mappdev-kaas --name mappdev-cluster --command kubectl annotate -f deployment.yaml --overwrite --file .
command started at 2022-10-11 15:39:37+00:00, finished at 2022-10-11 15:39:37+00:00 with exitcode=1
error: at least one annotation update is required

##[debug]private cluster Kubectl run with invoke command: kubectl describe deployment next-ui-deployment
##[debug]private cluster Kubectl run with invoke command: kubectl label -f deployment.yaml --overwrite
##[debug]Successfully moved file 'deployment.yaml' from /tmp to /tmp/manifest directory
/usr/bin/az aks command invoke --resource-group mappdev-kaas --name mappdev-cluster --command kubectl label -f deployment.yaml --overwrite --file .
command started at 2022-10-11 15:40:08+00:00, finished at 2022-10-11 15:40:08+00:00 with exitcode=1
error: at least one label update is required

y-luis-rojo avatar Oct 11 '22 22:10 y-luis-rojo

Investigating this :). Thanks!

OliverMKing avatar Oct 18 '22 18:10 OliverMKing

Hello! The newest 4.6 (and 4) releases should fix this. Thanks!

OliverMKing avatar Oct 31 '22 17:10 OliverMKing