juicedata / juicefs-csi-driver

JuiceFS CSI Driver
https://github.com/juicedata/juicefs
Apache License 2.0
213 stars 81 forks source link

[BUG] Can't run with Nomad #619

Closed shumin1027 closed 1 year ago

shumin1027 commented 1 year ago

Can't run normally with Nomad

job "jfs-controller" {
  datacenters = ["dc1"]
  type = "system"

  group "controller" {
    task "plugin" {
      driver = "docker"

      config {
        image = "juicedata/juicefs-csi-driver:v0.18.0"

        args = [
          "--endpoint=unix://csi/csi.sock",
          "--logtostderr",
          "--nodeid=test",
          "--v=5",
          "--by-process=true"
        ]

        privileged = true
      }

      csi_plugin {
        id        = "juicefs0"
        type      = "controller"
        mount_dir = "/csi"
      }
      resources {
        cpu    = 100
        memory = 512
      }
    }
  }
}

The POD_NAME environment variable must be manually set:

https://github.com/juicedata/juicefs-csi-driver/blob/7d8a03b1cb4d345d86ac76569488241d8b14a608/cmd/main.go#L78-L88

zwwhdls commented 1 year ago

Hi @shumin1027 , can you add env "POD_NAME" in controller and node service? Just like the follows:

job "jfs-controller" {
  datacenters = ["dc1"]
  type = "system"

  group "controller" {
    task "plugin" {
      driver = "docker"

      config {
        image = "juicedata/juicefs-csi-driver:v0.18.0"

        args = [
          "--endpoint=unix://csi/csi.sock",
          "--logtostderr",
          "--nodeid=test",
          "--v=5",
          "--by-process=true"
        ]

        env {
          POD_NAME = "csi-controller"
        }

        privileged = true
      }

      csi_plugin {
        id        = "juicefs0"
        type      = "controller"
        mount_dir = "/csi"
      }
      resources {
        cpu    = 100
        memory = 512
      }
    }
  }
}

And have a retry?

p1u3o commented 1 year ago

Can confirm that solves the problem.

The env needs to go in the task block however, not the config block.

zwwhdls commented 1 year ago

@p1u3o Great! Thanks! We will fix the docs as well.