Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bug: devspace init fails with rendering error when using existing Helm chart in Go project environment #2840

Open
mattwelke opened this issue Apr 12, 2024 · 2 comments
Labels
kind/bug Something isn't working

Comments

@mattwelke
Copy link
Contributor

mattwelke commented Apr 12, 2024

What happened?

When running devspace init on a directory for a Go project that already had a Helm chart, I get an error message and partially completed generated files after finishing the prompts.

I was trying to do this for a popular open source project that works this way (Go, has a Helm chart already). But I've created a minimal reproduction instead of referencing that open source project for this bug report.

The error:

fatal error rendering deployment: devspace render: exit status 1

The devspace_start.sh file:

#!/bin/bash
set +e  # Continue on errors

COLOR_BLUE="\033[0;94m"
COLOR_GREEN="\033[0;92m"
COLOR_RESET="\033[0m"

# Print useful output for user
echo -e "${COLOR_BLUE}
     %########%      
     %###########%       ____                 _____                      
         %#########%    |  _ \   ___ __   __ / ___/  ____    ____   ____ ___ 
         %#########%    | | | | / _ \\\\\ \ / / \___ \ |  _ \  / _  | / __// _ \\
     %#############%    | |_| |(  __/ \ V /  ____) )| |_) )( (_| |( (__(  __/
     %#############%    |____/  \___|  \_/   \____/ |  __/  \__,_| \___\\\\\___|
 %###############%                                  |_|
 %###########%${COLOR_RESET}


Welcome to your development container!

This is how you can work with it:
- Files will be synchronized between your local machine and this container
- Some ports will be forwarded, so you can access this container via localhost
- Run \`${COLOR_GREEN}go run main.go${COLOR_RESET}\` to start the application
"

# Set terminal prompt
export PS1="\[${COLOR_BLUE}\]devspace\[${COLOR_RESET}\] ./\W \[${COLOR_BLUE}\]\\$\[${COLOR_RESET}\] "
if [ -z "$BASH" ]; then export PS1="$ "; fi

# Include project's bin/ folder in PATH
export PATH="./bin:$PATH"

# Open shell
bash --norc

The devspace.yaml file:

version: v2beta1

dev:
  app:
    imageSelector: image
    ports:
      - port: 2345

What did you expect to happen instead?

DevSpace would initialize itself for my Go project with a pre-existing Helm chart.

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

Create a test directory, create a new Helm chart within it, initialize the directory to be a Go module, run devspace init, and follow the prompts, specifying that you want it to use the existing Helm chart:

~ > mkdir devspace-test
~ > cd devspace-test/
~/devspace-test > helm create foo
Creating foo
~/devspace-test > go mod init example.com
go: creating new go.mod: module example.com
go: to add module requirements and sums:
	go mod tidy
~/devspace-test > touch main.go
~/devspace-test > devspace init


     %########%      
     %###########%       ____                 _____                      
         %#########%    |  _ \   ___ __   __ / ___/  ____    ____   ____ ___ 
         %#########%    | | | | / _ \\ \ / / \___ \ |  _ \  / _  | / __// _ \
     %#############%    | |_| |(  __/ \ V /  ____) )| |_) )( (_| |( (__(  __/
     %#############%    |____/  \___|  \_/   \____/ |  __/  \__,_| \___\\___|
 %###############%                                  |_|
 %###########%


info Detecting programming language...

? Select the programming language of this project go

? How do you want to deploy this project? 

? Do you already have a Helm chart for this project? Yes

? Which Helm chart do you want to use? 

? Please enter the relative path to your local Helm chart (e.g. ./chart) foo

? Do you want to develop this project with DevSpace or just deploy it?  [Use arrows to move, type to filter] I want to develop this project and my current working dir contains the source code
fatal error rendering deployment: devspace render: exit status 1

Local Environment:

  • DevSpace Version: 6.3.12
  • Operating System:
    > lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 23.10
    Release:	23.10
    Codename:	mantic
    
  • ARCH of the OS: AMD64
  • Go version: 1.21.9

Anything else we need to know?

Detailed stack trace when running it with --debug too:

16:41:09 fatal exit status 1
devspace render
github.com/loft-sh/devspace/cmd.(*InitCmd).render
	/Users/runner/work/devspace/devspace/cmd/init.go:817
github.com/loft-sh/devspace/cmd.(*InitCmd).initDevspace
	/Users/runner/work/devspace/devspace/cmd/init.go:358
github.com/loft-sh/devspace/cmd.(*InitCmd).Run
	/Users/runner/work/devspace/devspace/cmd/init.go:162
github.com/loft-sh/devspace/cmd.NewInitCmd.func1
	/Users/runner/work/devspace/devspace/cmd/init.go:94
github.com/spf13/cobra.(*Command).execute
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:1040
github.com/spf13/cobra.(*Command).Execute
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:968
github.com/loft-sh/devspace/cmd.Execute
	/Users/runner/work/devspace/devspace/cmd/root.go:151
main.main
	/Users/runner/work/devspace/devspace/main.go:17
runtime.main
	/Users/runner/hostedtoolcache/go/1.20.13/x64/src/runtime/proc.go:250
runtime.goexit
	/Users/runner/hostedtoolcache/go/1.20.13/x64/src/runtime/asm_amd64.s:1598
error rendering deployment
github.com/loft-sh/devspace/cmd.(*InitCmd).initDevspace
	/Users/runner/work/devspace/devspace/cmd/init.go:360
github.com/loft-sh/devspace/cmd.(*InitCmd).Run
	/Users/runner/work/devspace/devspace/cmd/init.go:162
github.com/loft-sh/devspace/cmd.NewInitCmd.func1
	/Users/runner/work/devspace/devspace/cmd/init.go:94
github.com/spf13/cobra.(*Command).execute
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:1040
github.com/spf13/cobra.(*Command).Execute
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:968
github.com/loft-sh/devspace/cmd.Execute
	/Users/runner/work/devspace/devspace/cmd/root.go:151
main.main
	/Users/runner/work/devspace/devspace/main.go:17
runtime.main
	/Users/runner/hostedtoolcache/go/1.20.13/x64/src/runtime/proc.go:250
runtime.goexit
	/Users/runner/hostedtoolcache/go/1.20.13/x64/src/runtime/asm_amd64.s:1598
@mattwelke mattwelke added the kind/bug Something isn't working label Apr 12, 2024
@tuxillo
Copy link

tuxillo commented Sep 6, 2024

For me this was that I had no context, since I had removed my kind cluster. Check it with kubectl config current-context. The hint that helped me:

$ devspace deploy --render
warn Unable to create new kubectl client: Error loading kube config, context '' doesn't exist

ensure_pull_secrets: Please make sure you have an existing valid kube config. You might want to check one of the following things:

* Make sure you can use 'kubectl get namespaces' locally
* If you are using Loft, you might want to run 'devspace create space' or 'loft create space'

fatal exit status 1

@revoltez
Copy link

revoltez commented Dec 30, 2024

in my case the problem was that it expected a values.yaml file but i had values.dev.yaml file

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

No branches or pull requests

3 participants