-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add description of standard hooks #225
base: main
Are you sure you want to change the base?
Conversation
This change adds a description of standard hooks to the CDI specification. These hooks can be used to update the LDCache in the container or to create symlinks. Signed-off-by: Evan Lezar <[email protected]>
|
||
Assuming the following hook syntax: | ||
```shell | ||
[command-prefix] create-symlinks [--link target::link-path] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% happy with the target::link-path
format here. Are there other suggestions on how we would do this?
Something like --link source=foo,target=bar
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot we use an ln:ish syntax of --link $existing_target $new_link_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern here would be that this would make argument parsing quite brittle. If you could provide reference implementations using urfave and/or cobra then that's something that we could consider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @elezar's initial concern. The way I'd frame it is, because the hook arguments is a JSON list, more syntax within those list elements introduces a new DSL.
The foo::bar
notation is new to me. I'm guessing it's more standard in golang world, but in Python or C it would require a second stage of argument parsing.
My suggestions would be:
- Adopt a general principle of one value per argument (i.e., no
::
operator). - Specifically, use @klihub's suggestion of separate target and source arguments.
- Remove
--link
because it's redundant with the hook definition. This would also make argument parsing in Python or C easier because the target and source become positional arguments rather than options for--link
. (Also yes, an argument that takes multiple options is hard to parse in my world too.)nvidia-ctk-hook
could simply ignore--link
to be backwards compatible. - Make at least one target and one source required.
- Clarify whether the hook takes multiple target/source pairs or just one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that's not in the syntax above is that --link
can be repeated meaning that one can create multiple links with a single invocation of the create-symlink
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for requesting my opinion.
I think this is a big step forward for the standard.
It does still seem roundabout to me. That is, with the introduction of standard hooks, we now have prescribed behavior, which is great, but it's indirected through the constraints and syntax of command-line programs. To me it would be simpler to just introduce new updateLDCache
and createSymlinks
fields.
Further suggestions in-line. I hope this is helpful.
|
||
Assuming the following hook syntax: | ||
```shell | ||
[command-prefix] update-ldcache [--folder folder1] [--folder folder2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest:
- Remove
--folder
because it's redundant. - Require at least one folder argument.
1. ensure that libraries in requested folders (`folder1`, `folder2`) are added to the `ldcache` in the container with the correct priority. | ||
2. create the relevant `.so.SONAME` symlinks in the container. | ||
|
||
Note that if updating the ldcache in the container is not applicable, this is skipped, but the symlinks are still created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to say more about libc variations. E.g. what happens if you are running a musl container on a glibc host or vice versa? What about libc version differences?
I'm guessing the nVidia hooks assume glibc throughout?
[command-prefix] update-ldcache [--folder folder1] [--folder folder2] | ||
``` | ||
executing the `update-ldcache` hook will: | ||
1. ensure that libraries in requested folders (`folder1`, `folder2`) are added to the `ldcache` in the container with the correct priority. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that this leaves unspecified host vs. container ldconfig(8)
.
The following named hooks are defined by the CDI specification: | ||
* `update-ldcache` | ||
* `create-symlinks` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elezar One question related to this... Is the idea with this document addendum, that we describe known 'de-facto' hooks and their normative behavior (including their command line options and expected behavior) ? Also, is the [command prefix] $named_hook
syntax to allow for an implementation, where a single binary implements all the de-facto hooks (and an extra 1st $hook_name argument is used to pick which hook to run from that binary) ?
If it is so, and the CDI specification provides such a detailed description of expected availability, syntax and behavior, then wouldn't it make sense to also provide a default implementation for these hooks within the CDI repository ?
This PR is stale because it has been open 90 days with no activity. This PR will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label. |
This change adds a description of standard hooks to the CDI specification. These hooks can be used to update the LDCache in the container or to create symlinks.