Coder Social home page Coder Social logo

Variable as Namespace about k8s-deploy HOT 3 CLOSED

azure avatar azure commented on May 20, 2024
Variable as Namespace

from k8s-deploy.

Comments (3)

thesattiraju avatar thesattiraju commented on May 20, 2024

You need to use namespace like ${{ env.NAMESPACE }} instead of $NAMESPACE. Given that the environment variable is not available in that context, it failed because of that.

When you use it like ${{ env.NAMESPACE }} this value gets replaced with the actual value of the variable and passed to the action.

from k8s-deploy.

hikarukujo avatar hikarukujo commented on May 20, 2024

That didn't do the trick, it seems to ignore when I do that:

/usr/bin/kubectl apply -f /tmp/Deployment_revio-calendar-frontend_1592492995710,/tmp/Service_revio-calendar-frontend_1592492995710,/tmp/Ingress_revio-calendar-frontend-ingress_1592492995710 --namespace default
deployment.extensions/revio-calendar-frontend created
error: the namespace from the provided object "dev" does not match the namespace "default". You must pass '--namespace=dev' to perform this operation.
service/revio-calendar-frontend created
##[error]Error: error: the namespace from the provided object "dev" does not match the namespace "default". You must pass '--namespace=dev' to perform this operation.

This was with the following config:

    - name: 'Deploy to Kubernetes'
          uses: Azure/k8s-deploy@v1
          with:
            namespace: ${{ env.NAMESPACE }}
            manifests: |
              manifests/deployment.yml
              manifests/service.yml
              manifests/ingress-dev.yml
            images: |
              ${{ secrets.REGISTRY_LOGIN_SERVER }}/revio-calendar-frontend:${{ github.sha }}
            imagepullsecrets: |
              c1-k8s-secret
              - uses: actions/checkout@v2

from k8s-deploy.

thesattiraju avatar thesattiraju commented on May 20, 2024

You have to declare that environment globally. I suppose that value is not added to the env context because of where you're declaring it.

Consider adding an environment section at the workflow level. Something like this: https://github.com/Azure/actions-workflow-samples/blob/master/Kubernetes/build-and-deploy-docker-image-aks-using-manifests.yml#L15

Documentation: https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables

from k8s-deploy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.