okteto / okteto

Develop your applications directly in your Kubernetes Cluster
https://okteto.com
Apache License 2.0
3.24k stars 314 forks source link

Nil pointer exception on up/deploy #2548

Closed rberrelleza closed 2 years ago

rberrelleza commented 2 years ago

Describe the bug Running okteto deploy fails with this error:


I'm having this error when I run the okteto deploy command
 i  Using mynamespace @ cloud.okteto.com as context
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa8 pc=0x5bdedd4]

goroutine 32 [running]:
github.com/okteto/okteto/cmd/deploy.checkServicesToBuild({0xc0014f9ca0, 0xf}, 0xc0004eb140, 0x0?)
        github.com/okteto/okteto/cmd/deploy/deploy.go:740 +0x3f4
github.com/okteto/okteto/cmd/deploy.checkBuildFromManifest.func1()
        github.com/okteto/okteto/cmd/deploy/deploy.go:756 +0x29
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
        golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0x8d

Okteto up fails like this:


$ okteto up
 i  Using mynamespace @ cloud.okteto.com as context
 i  Development environment 'sunnyhelper' already deployed.
 i  To redeploy your development environment run 'okteto deploy' or 'okteto up sunnyhelper-dev --deploy'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc0 pc=0x5317abe]

goroutine 49 [running]:
github.com/okteto/okteto/pkg/k8s/apps.ValidateMountPaths(0xc00140e6a0?, 0xc000275800)
        github.com/okteto/okteto/pkg/k8s/apps/validation.go:29 +0x9e
github.com/okteto/okteto/cmd/up.(*upContext).activate(0xc0005c1380)
        github.com/okteto/okteto/cmd/up/activate.go:83 +0x4f3
github.com/okteto/okteto/cmd/up.(*upContext).activateLoop(0xc0005c1380)
        github.com/okteto/okteto/cmd/up/up.go:444 +0x1c5
created by github.com/okteto/okteto/cmd/up.(*upContext).start
        github.com/okteto/okteto/cmd/up/up.go:405 +0x4ea

This is the okteto.yml used


name: sunnyhelper
namespace: cathay-losunny

deploy:
  compose:
    - docker-compose.yml

build:
  sunnyhelper:
    context: .
    dockerfile: Dockerfile
    target: app
    image: registry.cloud.okteto.net/cathay-losunny/sunnyhelper
  sunnyhelper-dev:
    context: .
    dockerfile: Dockerfile-dev
    target: app
    image: registry.cloud.okteto.net/cathay-losunny/sunnyhelperdev

dev:
  sunnyhelper-dev:
    container: sunnyhelper-dev
    image: registry.cloud.okteto.net/cathay-losunny/sunnyhelperdev
    autocreate: true
    command: sh
    environment:
      - DEV=true
    forward:
      - 8849:8849
    workdir: /app
    sync:
      - .:/app

Desktop (please complete the following information):

Additional context

https://kubernetes.slack.com/archives/CM1QMQGS0/p1650078877203649

rberrelleza commented 2 years ago

@jLopezbarb can you take a look?