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

democratic-csi plugin #113

Merged
merged 4 commits into from
Mar 21, 2024
Merged

democratic-csi plugin #113

merged 4 commits into from
Mar 21, 2024

Conversation

tgross
Copy link
Member

@tgross tgross commented Apr 12, 2022

A pack for deploying democratic-csi CSI plugins in their NFS client mode. I've left a few questions too.

Example runs in my Vagrant environment:

plan output
$ nomad-pack plan \
    -var nfs_share_host=192.168.56.69 \
    -var nfs_share_base_path=/var/nfs/general \
    -var nfs_controller_mount_path=/srv/nfs_data \
    ./packs/democratic_csi_nfs
+ Job: "democratic_csi_controller"
+ Task Group: "controller" (2 create)
  + Task: "plugin" (forces create)

» Scheduler dry-run:
- All tasks successfully allocated.
+ Job: "democratic_csi_node"
+ Task Group: "node" (3 create)
  + Task: "plugin" (forces create)

» Scheduler dry-run:
- All tasks successfully allocated.
Plan succeeded
run output
$ nomad-pack run \
    -var nfs_share_host=192.168.56.69 \
    -var nfs_share_base_path=/var/nfs/general \
    -var nfs_controller_mount_path=/srv/nfs_data \
    ./packs/democratic_csi_nfs
  Evaluation ID: d5cfa4fe-802b-89a8-440e-c628b6f9ebae
  Job 'democratic_csi_controller' in pack deployment 'democratic_csi_nfs' registered successfully
  Evaluation ID: eb887e8c-e881-bb10-593a-18af7ec3c5dd
  Job 'democratic_csi_node' in pack deployment 'democratic_csi_nfs' registered successfully
Pack successfully deployed. Use ../nomad-pack-community-registry/packs/democratic_csi_nfs to manage
this this deployed instance with plan, stop, destroy, or info

type         = "csi"
id           = "myvolume"
namespace    = "default"
name         = "myvolume"
plugin_id    = "org.democratic-csi.nfs"

capability {
  access_mode     = "multi-node-multi-writer"
  attachment_mode = "file-system"
}

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

capability {
  access_mode     = "single-node-reader-only"
  attachment_mode = "file-system"
}

mount_options {
  mount_flags = ["noatime"]
}


$ nomad job status
ID                         Type     Priority  Status   Submit Date
democratic_csi_controller  service  50        running  2022-04-12T16:35:46-04:00
democratic_csi_node        system   50        running  2022-04-12T16:35:46-04:00

$ nomad plugin status org.democratic-csi.nfs
ID                   = org.democratic-csi.nfs
Provider             = org.democratic-csi.nfs
Version              = 1.6.3
Controllers Healthy  = 2
Controllers Expected = 2
Nodes Healthy        = 3
Nodes Expected       = 3

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created  Modified
eef089f3  0421e35a  controller  0        run      running  43s ago  10s ago
874b3e2d  0421e35a  node        0        run      running  42s ago  10s ago
c6a4e114  63f60fe3  controller  0        run      running  43s ago  11s ago
074e4232  63f60fe3  node        0        run      running  42s ago  11s ago
aae7271e  de82214f  node        0        run      running  42s ago  16s ago

Comment on lines +1 to +4
app {
url = "https://github.com/democratic-csi/democratic-csi"
author = "Tim Gross <tgross@hashicorp.com>"
}
Copy link
Member Author

@tgross tgross Apr 12, 2022

Choose a reason for hiding this comment

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

@mikenomitch @angrycub something I noticed here is that we're conflating app.author and a hypothetical pack.maintainer metadata field. Most package managers have a distinction between the two because they're rarely the same person. Ex. redis on Debian Buster is maintained by Chris Lamb, who is not the author of Redis (antirez or Redis Labs).

We also don't include as a requirement any kind of contact info for the pack maintainer. Maybe we don't need it as required metadata for all registries but as a requirement for this registry, so that we have someone to ping as the codeowner. (Also maybe not an email address but a GitHub handle here?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this was originally the author of the underlying app itself (not the pack). But about 40% of PRs get this "wrong" and do pack author. IDK what value its really providing as author of the underlying app.

Git/GitHub will naturally point us to the maintainer (in a roundabout way), so I'm not sure we really even need it for that purpose.

Maybe its something we should just remove?

Copy link
Member Author

@tgross tgross Apr 14, 2022

Choose a reason for hiding this comment

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

But about 40% of PRs get this "wrong" and do pack author.

Most likely because that's what Writing Packs recommends. Seems reasonable to me to remove it. I'll fix up the docs as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wow! Maybe I'm "wrong" then 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

I've opened hashicorp/nomad-pack#240 to update the docs and/or discuss it more generally.

pack {
name = "democratic_csi_nfs"
description = "This pack deploys the democratic-csi plugin, configured for use with NFS"
url = "https://github.com/hashicorp/nomad-pack-community-registry/democratic_csi_nfs"
Copy link
Member Author

Choose a reason for hiding this comment

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

The docs on this url field are a little vague. It's not really the URL to the directory, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really the URL to the directory, right? It is... but @angrycub and I want to remove it and just make this implicit when they grab the registry itself. Because once you fork a registry, all of these are wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

I more meant that our docs say to use a URL like https://github.com/hashicorp/nomad-pack-community-registry/nginx but the actual URL to the pack directory is https://github.com/hashicorp/nomad-pack-community-registry/tree/main/packs/nginx

Copy link
Member Author

Choose a reason for hiding this comment

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

I've opened hashicorp/nomad-pack#240 to update the docs and/or discuss it more generally.

@tgross tgross force-pushed the democratic_csi_nfs branch 2 times, most recently from 780c33a to 656cbb0 Compare April 12, 2022 20:38
need to have a source NFS volume mounted to any client host that runs
the controller task.

### Example NFS Server
Copy link
Member Author

Choose a reason for hiding this comment

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

The democratic-csi plugin supports a lot of different NFS and ZFS setups. I'm not sure if we want to try to support arbitrary configurations in this one pack. It'd be awfully nice, but the client requirements end up being a chore to document (and not feasible for us to test, where this one is pretty simple). Open to suggestion here though for sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we did want to support a broader range of configs, we'd want to have something more like a blob or object for the config file (ref #113 (comment))

Choose a reason for hiding this comment

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

I think there are ways we could handle both using the sprig fail function in the template.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it's very hard to test without buying an appropriate NAS appliance, I'm going to leave this as-is for now and if someone comes along later and wants to improve upon it they can.

Copy link

@angrycub angrycub Apr 14, 2022

Choose a reason for hiding this comment

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

My point in the earlier comment is that you could provide variables to ingest a shapely configuration for something that is easily testable, but allow for a blob in cases where we don't have the ability to know the configuration in advance. Then it would be up to the template to fail if neither way was provided by the user at runtime. If they're bringing a custom config, then they will have to ensure that they are doing the right thing.

@tgross tgross marked this pull request as ready for review April 12, 2022 20:41
@tgross
Copy link
Member Author

tgross commented Apr 12, 2022

(I've tagged @davemay99 on this review because I'd like to use packs like this to help document CSI configurations and want to know his thoughts on what's in the README here. I'll have more packs coming for AWS EBS, GCP, etc.)


## Variables

The following variables are required:
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a way to express this requirement in our variables.hcl? There aren't really reasonable defaults for these values here.

Copy link
Contributor

@mikenomitch mikenomitch Apr 14, 2022

Choose a reason for hiding this comment

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

No way to do this :(

Choose a reason for hiding this comment

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

If you don't default them, they should end up being required? If they aren't this seems like a bug. (It's inconsistent with my experience with Nomad's HCL2, that is)

Copy link
Member Author

Choose a reason for hiding this comment

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

No, unfortunately. For example if I render this pack with no variables set I end up with a partially empty template:

      template {
        destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"

        data = <<EOH
driver: nfs-client
instance_id:
nfs:
  shareHost:
  shareBasePath: ""
  controllerBasePath: "/storage"
  dirPermissionsMode: "0777"
  dirPermissionsUser: root
  dirPermissionsGroup: root
EOH
      }

For Nomad fields, this usually up throwing an error when we try to submit the job because Nomad will reject it. But for something like the interior of a template, Nomad has no way of knowing whether the field is valid.

This was referenced Apr 13, 2022
Copy link

@angrycub angrycub left a comment

Choose a reason for hiding this comment

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

One suggestion on template. Haven't run locally though yet

packs/democratic_csi_nfs/templates/_constraints.tpl Outdated Show resolved Hide resolved
packs/democratic_csi_nfs/variables.hcl Show resolved Hide resolved
packs/democratic_csi_nfs/templates/_constraints.tpl Outdated Show resolved Hide resolved
@Brandl
Copy link

Brandl commented Sep 26, 2022

This looks great, why hasn't it been merged so far?

@tgross
Copy link
Member Author

tgross commented Sep 27, 2022

Hi @Brandl! While working on and reviewing this pack we hit a couple of "is this really the way we want to do this in Pack?" questions and we just haven't had time to come back.

@angrycub angrycub merged commit 79e82e7 into main Mar 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants