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

namespace in DEVSPACE_FLAGS in devspace.yaml doesn't seem to work #2909

Open
nethi opened this issue Oct 26, 2024 · 1 comment
Open

namespace in DEVSPACE_FLAGS in devspace.yaml doesn't seem to work #2909

nethi opened this issue Oct 26, 2024 · 1 comment
Assignees
Labels
kind/bug Something isn't working

Comments

@nethi
Copy link

nethi commented Oct 26, 2024

What happened?
I am using different DEVSPACE_FLAGS in different profiles (via vars). For example:

profiles:

  • name: dev
    merge:
    vars:
    ENV_NAME: "dev"
    DEVSPACE_FLAGS: "-n dev"
  • name: test
    merge:
    vars:
    ENV_NAME: "test"
    DEVSPACE_FLAGS: "-n test"

When I run devspace deploy -p dev or devspace deploy -p test, I find that devspace is not switching the namespace, even though respective DEVSPACE_FLAGS are reflected.

As per this #2151, it should have worked.

What did you expect to happen instead?
If I pass the same DEVSPACE_FLAGS as part of command line or in the shell, I see the desired behavior. But if I set this variable appropriate for each profile in devspace.yaml, this warn doesn't show up - infact, it ends up deploying to whatever was the previously used namespace

DEVSPACE_FLAGS=--namespace=test devspace deploy --render --skip-build -p test

warn Are you using the correct namespace?
warn Current namespace: 'test'
warn Last namespace: 'dev'

? Which namespace do you want to use? [Use arrows to move, type to filter]

test
dev

How can we reproduce the bug? (as minimally and precisely as possible)

My devspace.yaml:

version: v2beta1
name: test-service

localRegistry:
   enabled: false

vars:
    ENV_NAME: "dev"
    DEVSPACE_FLAGS: "-n dev"
    SERVICE_NAME: test-service

# This is a list of `pipelines` that DevSpace can execute (you can define your own)
pipelines:
  # This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`)
  dev:
    run: |-
      run_dependencies --all       # 1. Deploy any projects this project needs (see "dependencies")
      ensure_pull_secrets --all    # 2. Ensure pull secrets
      create_deployments --all     # 3. Deploy Helm charts and manifests specfied as "deployments"
      start_dev app                # 4. Start dev mode "app" (see "dev" section)
  # You can run this pipeline via `devspace deploy` (or `devspace run-pipeline deploy`)
  deploy:
    run: |-
      run_dependencies --all                            # 1. Deploy any projects this project needs (see "dependencies")
      ensure_pull_secrets --all                         # 2. Ensure pull secrets
      build_images --all                                # 3. Build, tag (git commit hash) and push all images (see "images")
      create_deployments --all                          # 4. Deploy Helm charts and manifests specfied as "deployments"

# This is a list of `images` that DevSpace can build for this project
# We recommend to skip image building during development (devspace dev) as much as possible
images:
    app:
        image: ${REGISTRY}/${REGISTRY_REPO}/${SERVICE_NAME}
        tags:
            - '#####'
            - latest
        dockerfile: "./Dockerfile"
        appendDockerfileInstructions:
            - USER root
        createPullSecret: false


# This is a list of `deployments` that DevSpace can create for this project
deployments:
  test-service:
    # This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
    helm:
      # We are deploying this project with the Helm chart you provided
      #chart:
      #  name: component-chart
      #  repo: https://charts.devspace.sh
      # Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
      # You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"]
      values:
        containers:
          - image: ${REGISTRY_PULL}/${REGISTRY_REPO}/${SERVICE_NAME}
            command: ["sleep"]
            args: ["infinity"]
        service:
          ports:
            - port: 8080

profiles:
- name: dev
  merge:
    vars:
       ENV_NAME: "dev"
       SERVICE_NAME: "test-service-dev"
       DEVSPACE_FLAGS: "-n dev"
- name: test
  merge:
    vars:
       ENV_NAME: "test"
       SERVICE_NAME: "test-service-test"
       DEVSPACE_FLAGS: "-n test"
...

Local Environment:

  • DevSpace Version: 6.3.14
  • Operating System: mac
  • ARCH of the OS: ARM64 |
    Kubernetes Cluster:
  • Cloud Provider: other
  • Kubernetes Version: v1.24.24

Anything else we need to know?

@nethi nethi added the kind/bug Something isn't working label Oct 26, 2024
@nethi nethi closed this as completed Oct 26, 2024
@nethi
Copy link
Author

nethi commented Oct 26, 2024

I thought this was working but doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants