devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.29k stars 359 forks source link

v6.3.0: Please remove gcloud namespace warning #2570

Closed djfinnoy closed 1 year ago

djfinnoy commented 1 year ago

What happened? After upgrading to v6.3.0, Devspace seems to be utilizing the new gke-gcloud-auth-plugin under the hood.

There is an annoying feature of this auth plugin that prompts the user to confirm that they are targeting the correct namespace:

$ devspace build

warn Are you using the correct namespace?                                                                                                                                                     
warn Current namespace: 'argocd'                                                                                                                                                              
warn Last    namespace: 'default'                                                                                                                                                             

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

What did you expect to happen instead? Just proceed without verifying the GKE namespace. The build step doesn't even deploy anything to GKE, so I am guessing that this is some sort of peculiarity with the gcloud auth mechanism employed by Devspace.

Hopefully, this functionality is toggleable, and can be disabled when Devspace utilizes gcloud for authentication.

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

Swap namespaces with kubectl, and try building an image that will be pushed to a Google Artifact Registry.

My devspace.yaml:

version: v2beta1

...
images:
  app:
    image: europe-west1-docker.pkg.dev/my-org/artifacts/my-image  # Google Artifact Registry
    dockerfile: ./Dockerfile

pipelines:
  build: |-
    build_images --all 
...

Local Environment:

Anything else we need to know?

FabianKramm commented 1 year ago

@djfinnoy thanks for creating this issue! This warning comes directly from DevSpace and signals that the build was previously run in a different namespace, which shouldn't be related to gcloud. Since there a builds that require a kubernetes cluster (Kaniko etc.) Kubernetes is sometimes needed. You can disable this warning with:

devspace build ... --no-warn
djfinnoy commented 1 year ago

Ah, I see. My mistake. Is it possible to build --no-warn into pipelines, or will we need to include it everytime we use the CLI?

FabianKramm commented 1 year ago

@djfinnoy yes you can also do:

vars:
 DEVSPACE_FLAGS: '--no-warn'

which will always include this

djfinnoy commented 1 year ago

Excellent, thank you.