Skip to content

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

Open
@nethi

Description

@nethi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions