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

"name is not defined" when starting a project from scratch #1090

Open
elliott-davis opened this issue Aug 9, 2019 · 1 comment

Comments

@elliott-davis
Copy link

commented Aug 9, 2019

Bug

Current Behavior

When starting garden for the first time in my project, I get the error name is not defined for the main application (not the dependencies). This causes Garden to hang until it is stopped and restarted.

Screen Shot 2019-08-09 at 1 52 19 PM

Expected behavior

Application should start correctly the first time.

Reproducible example

This is a copy of my main garden.yml

kind: Project
name: product
environments:
  - name: local
    providers: 
    - name: local-kubernetes
      defaultHostname: localhost.com
      tlsCertificates:
      - name: localhost-com
        secretRef:
          name: tls-localhost-com

---

kind: Module
type: container
name: pi
description: PHP Monolith
extraFlags:
  - "--ssh=default"
hotReload:
  sync:
  - target: /app/lib/
    source: lib/
  - target: /app/apps
    source: apps/
  - target: /app/web
    source: web/
  - target: /app/batch
    source: batch/
services: 
  - name: pi
    ports:
        - name: http
          containerPort: 80
          servicePort: 80
        - name: https
          containerPort: 443
          servicePort: 443
    ingresses:
      - path: /
        port: http
        hostname: pi.localhost.com
        annotations:
          "nginx.ingress.kubernetes.io/proxy-connect-timeout": "15"
          "nginx.ingress.kubernetes.io/proxy-buffer-size": "256k"
      - path: /
        port: https
        hostname: pi.localhost.com
        annotations:
          "nginx.ingress.kubernetes.io/proxy-connect-timeout": "15"
          "nginx.ingress.kubernetes.io/proxy-buffer-size": "256k"
    dependencies:
      - mysql
      - redis
      - ensure-certificates
      - reset-db
tasks:
  - name: reset-db
    description: reset and reload the development database
    command:
      - ./devDBReload.sh
      - --no-cache-clear
    dependencies:
      - mysql
      - redis
    env:
      DEV_MYSQL_HOST: mysql

---

kind: Module
type: exec
name: ad-hoc
description: Ad-hoc tasks that need execute in the pi container
tasks:
  - name: update-cache
    description: Update the cache
    command:
      - garden
      - exec
      - pi
      - ./updateCache.sh
  - name: ensure-certificates
    description: Ensure TLS certificates exist in k8s secrets
    command:
      - .dev/init-secrets.sh

I also have mysql and redis garden yamls in sub-directories that look like:

kind: Module
description: MySQL container for Product dev env
type: container
name: mysql
image: mysql:5.7.15
services:
  - name: mysql
    args: 
      - "--bind-address=0.0.0.0"
    volumes: # A persistent volume for the data.
      - name: data
        containerPath: /var/lib/mysql
    ports:
      - name: db
        containerPort: 3306
    healthCheck:
      command: [ mysql, -u, root, -e, "SELECT 1" ]
kind: Module
description: Redis container for Product dev
type: container
name: redis
image: redis:latest
services:
  - name: redis
    ports:
      - name: db
        containerPort: 6379
    healthCheck:
      command: [ redis-cli, "PING" ]

Workaround

CRTL-C the initial run of garden and restart it. This seems to bypass the hang and let everything else run smoothly

Suggested solution(s)

Catch the error from Kubernetes if it is non-fatal and warn on it, but don't fail the application deploy.

Additional context

This is from the error.log:

[2019-08-09T15:24:05.744Z] ReferenceError: name is not defined
    at KubeApi.<anonymous> (/snapshot/dist/build/src/plugins/kubernetes/api.js:0)
    at Generator.throw (<anonymous>)
    at rejected (/snapshot/dist/build/src/plugins/kubernetes/api.js:0)
    at process._tickCallback (internal/process/next_tick.js:68:7)`

Your environment

garden version: 0.10.4

kubectl version:

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.2", GitCommit:"f6278300bebbb750328ac16ee6dd3aa7d3549568", GitTreeState:"clean", BuildDate:"2019-08-05T16:54:35Z", GoVersion:"go1.12.7", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

docker version:

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:18:17 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:17:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
@elliott-davis

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

Some additional info on this. When I remove the ingress and container port entries for the pi service, I no longer get the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.