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

support host/CSI volumes and using podman tasks as CSI plugins #169

Merged
merged 2 commits into from
May 30, 2022

Conversation

tgross
Copy link
Member

@tgross tgross commented May 19, 2022

Fixes #168.

Tested running a job as both a CSI plugin and with a host volume:

jobspec
job "hostpath" {
  datacenters = ["dc1"]

  group "plugins" {

    volume "host_data" {
      type      = "host"
      read_only = false
      source    = "shared_data"
    }

    task "plugin" {
      driver = "podman"
      config {
        image = "quay.io/k8scsi/hostpathplugin:v1.2.0"
        args = [
          "--drivername=csi-hostpath",
          "--v=5",
          "--endpoint=${CSI_ENDPOINT}",
          "--nodeid=node-${NOMAD_ALLOC_INDEX}",
        ]

        cap_add = ["SYS_ADMIN"]
      }

      csi_plugin {
        id        = "hostpath-plugin0"
        type      = "monolith"
        mount_dir = "/csi"
      }

      volume_mount {
        volume      = "host_data"
        destination = "/host_data"
        read_only   = false
      }

      resources {
        cpu    = 256
        memory = 128
      }
    }
  }
}

Working host volume:

$ nomad alloc exec 8c01 ls /host_data
example.txt

Working CSI plugin:

$ nomad plugin status hostpath
ID                   = hostpath-plugin0
Provider             = csi-hostpath
Version              = v1.2.0-0-g83590990
Controllers Healthy  = 1
Controllers Expected = 1
Nodes Healthy        = 1
Nodes Expected       = 1

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created  Modified
8c012686  c53f3ea2  plugins     0        run      running  16s ago  4s ago

$ nomad volume create ./hostpath.hcl
Created external volume a395c7f1-d7a8-11ec-bc8c-1eac4d1b7ed8 with ID VOLUME_NAME

$ nomad volume status VOLUME_NAME
ID                   = VOLUME_NAME
Name                 = VOLUME_NAME
External ID          = a395c7f1-d7a8-11ec-bc8c-1eac4d1b7ed8
Plugin ID            = hostpath-plugin0
Provider             = csi-hostpath
Version              = v1.2.0-0-g83590990
Schedulable          = true
Controllers Healthy  = 1
Controllers Expected = 1
Nodes Healthy        = 1
Nodes Expected       = 1
Access Mode          = <none>
Attachment Mode      = <none>
Mount Options        = flags: [REDACTED]
Namespace            = default

Topologies
Topology  Segments
01        topology.hostpath.csi/node=node-0

Allocations
No allocations placed

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tgross 🎉

@lgfa29 lgfa29 merged commit c158df4 into main May 30, 2022
@lgfa29 lgfa29 deleted the host-volume-support branch May 30, 2022 19:37
lgfa29 added a commit that referenced this pull request May 31, 2022
PR #152 was created before #169, but was not merged even though it has
pretty much the same code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSI directory not bind-mounted to podman containers under 1.3.0
2 participants