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

docs: add plugin docs for pledge task driver #17823

Merged
merged 2 commits into from
Jul 11, 2023
Merged

docs: add plugin docs for pledge task driver #17823

merged 2 commits into from
Jul 11, 2023

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Jul 6, 2023

Adds documentation for the pledge task driver to the set of Nomad community plugins.

Add pledge driver to the set of Community drivers.
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM once the minor items are cleaned up.

Preview link: https://nomad-o1pyfiqi9-hashicorp.vercel.app/nomad/plugins/drivers/community/pledge

@@ -44,3 +45,5 @@ Below is a list of community-supported task drivers you can use with Nomad:
[nomad-driver-iis]: /nomad/plugins/drivers/community/iis
[nomad-driver-containerd]: /nomad/plugins/drivers/community/containerd
[lightrun]: /nomad/plugins/drivers/community/lightrun
[pledge]: /nomad/plugins/drviers/community/pledge
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[pledge]: /nomad/plugins/drviers/community/pledge
[pledge]: /nomad/plugins/drivers/community/pledge

strace -ff /opt/bin/pledge-1.8.com -p "stdio rpath inet" -- curl example.com
```

[capabilities]: /nomad/docs/concepts/plugins/task-drivers#capabilities-capabilities-error)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[capabilities]: /nomad/docs/concepts/plugins/task-drivers#capabilities-capabilities-error)
[capabilities]: /nomad/docs/concepts/plugins/task-drivers#capabilities-capabilities-error


The `pledge` driver is fundamentally powered by the [pledge utility for Linux]
[pledge] by Justine Tunney. The driver invokes this `pledge.com` CLI tool along
with `nsenter` and `unshare` to create an attuned sandbox in which to execute a
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to be "attenuated"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh no, I was using attuned like "define the sandbox in harmony with the command being run". But that's obviously not that clear, so I'll change the wording.


If using `host` networking mode, it can be very convenient to bless the
pledge.com utility with the `cap_net_bind_service` Linux capability. This will
enable Nomad tasks using the pledge driver to bind to privilged ports (i.e.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
enable Nomad tasks using the pledge driver to bind to privilged ports (i.e.
enable Nomad tasks using the pledge driver to bind to privileged ports (i.e.

Comment on lines 222 to 224
If the Nomad scheduler is configured to enable memory [oversubscription]
[oversub], the `pledge` driver will correctly enable configuring `memory_max`
in addition to `memory`. In this case, `memory_max` indicates the maximum amount
Copy link
Member

Choose a reason for hiding this comment

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

This seems a little wordy? Maybe cut down a bit to:

Suggested change
If the Nomad scheduler is configured to enable memory [oversubscription]
[oversub], the `pledge` driver will correctly enable configuring `memory_max`
in addition to `memory`. In this case, `memory_max` indicates the maximum amount
If the Nomad scheduler is configured to enable memory [oversubscription]
[oversub], the `pledge` driver will allow configuring `memory_max`
in addition to `memory`. In this case, `memory_max` indicates the maximum amount

[oversub], the `pledge` driver will correctly enable configuring `memory_max`
in addition to `memory`. In this case, `memory_max` indicates the maximum amount
of memory the task is able to request before being OOM killed, and `memory`
represents a minimum amount of memory the kernel will gauruntee is available for
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
represents a minimum amount of memory the kernel will gauruntee is available for
represents a minimum amount of memory the kernel will guarantee is available for

## Troubleshooting

When setting up a new Task using the `pledge` task driver, it helps to run
the command manually using the `pledge.com` utility to make sure the necessary
Copy link
Member

Choose a reason for hiding this comment

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

The text is inconsistent on whether it uses "pledge.com" or "pledge.com". Maybe we should use the backticks everywhere? (This also prevents folks from thinking it's a domain name.)

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 tool itself is actually being renamed to pledge

jart/pledge@f0e63fe

but hasn't been released yet with that name

| ------------ | ------------------|
| send signals | true |
| exec | false |
| filesystem isolation | Landlock LSM |
Copy link
Member

Choose a reason for hiding this comment

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

Did we end up settling on whether we were going to have a separate isolation capability for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

ooh good catch; yeah we're just going to piggyback off of None until we have a reason to differentiate on landlock on the client side (probably when mounts come into play, or something)

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.

#### host networking

If using `host` networking mode, it can be very convenient to bless the
pledge.com utility with the `cap_net_bind_service` Linux capability. This will
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pledge.com utility with the `cap_net_bind_service` Linux capability. This will
`pledge.com` utility with the `cap_net_bind_service` Linux capability. This will

requires the `wpath` promise, creating a file requires the `cpath` promise, and
executing a program requires the `exec` promise.

#### examples
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### examples
#### Examples

Comment on lines 231 to 233
cpu = 2000
memory = 1024
memory_max = 2048
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cpu = 2000
memory = 1024
memory_max = 2048
cpu = 2000
memory = 1024
memory_max = 2048

@shoenig shoenig merged commit 8253ec8 into main Jul 11, 2023
2 checks passed
@shoenig shoenig deleted the docs-pledge-driver branch July 11, 2023 21:41
@shoenig shoenig added the backport/website This will backport PR changes to `stable-website` && the latest release-branch label Jul 11, 2023
@lgfa29 lgfa29 added backport/website This will backport PR changes to `stable-website` && the latest release-branch backport/1.6.x backport to 1.6.x release line and removed backport/website This will backport PR changes to `stable-website` && the latest release-branch labels Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/website This will backport PR changes to `stable-website` && the latest release-branch backport/1.6.x backport to 1.6.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants