-
Notifications
You must be signed in to change notification settings - Fork 0
Hla 1142 module creation docs #77
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
base: main
Are you sure you want to change the base?
Changes from all commits
9ae97d6
82b721c
d6042cf
95c62ee
1e78091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # The configuration model | ||
|
|
||
| This page is for anyone writing or editing deployment configuration. It explains how the | ||
| files you author are structured — the objects they map to and how they nest. For every | ||
| field in exhaustive detail see the [schema reference](../schemas.md); for the meaning of | ||
| individual terms, the [glossary](../glossary.md). | ||
|
|
||
| ## What you author | ||
|
|
||
| You author two kinds of file: a single `settings.yaml`, and one `<name>/<version>.yaml` | ||
| per Module version. The [schema reference](../schemas.md) covers which schema validates | ||
| which and how to point your editor at them. | ||
|
|
||
| They are structured as follows: | ||
|
|
||
| ```text | ||
| settings.yaml | ||
| └── default_versions | ||
|
|
||
| <name>/<version>.yaml one file per Module version | ||
| ├── deprecated: false lifecycle flag | ||
| └── module | ||
| ├── name / version / description | ||
| ├── env_vars variables set on load | ||
| ├── dependencies other Modules to load first | ||
| └── applications one or more, each of: | ||
| ├── apptainer container image + entrypoints | ||
| ├── shell a bash script | ||
| └── binary a downloaded, hash-checked executable | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description text should probably be spaced in the same way for all of the options, for apptainer, shell and binary the space between option and description is smaller
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link to application types section below? |
||
| ``` | ||
|
|
||
| ## A Module | ||
|
|
||
| A Module is the unit an end user loads. Alongside its `name` and `version` it carries: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the name and version just excluded from the table for brevity? |
||
|
|
||
| | Field | Purpose | | ||
| |-------|---------| | ||
| | `description` | Shown by `module whatis <name>`. | | ||
| | `env_vars` | Environment variables set when the Module is loaded. | | ||
| | `dependencies` | Other Modules loaded first, optionally version-pinned. | | ||
| | `applications` | One or more applications providing the executables (below). | | ||
| | `allow_updates` | Permit in-place changes to this version — see [the guard rails](deprecation-lifecycle.md#the-guard-rails). | | ||
| | `exclude_from_defaults` | Keep this version out of automatic default selection — see [default versions](default-versions.md#excluding-a-version-from-the-automatic-default). | | ||
|
|
||
| `load_script` and `unload_script` run extra commands when the Module is loaded and | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are load_script and load_script also Module config options? It doesnt explicitly say what they are or where/if they are configured, it just says they are run when the Module is loaded. I think its a bit confusing because I might expect all of the options to be in the table, even the obvious or not recommended for general use options. |
||
| unloaded respectively, injected raw into the generated Modulefile. They are an advanced | ||
| escape hatch — check with a `deploy-tools` admin before using them. | ||
|
|
||
| Each per-version file also carries a `deprecated` flag; see | ||
| [the release lifecycle](deprecation-lifecycle.md). | ||
|
|
||
| ## The three application types | ||
|
|
||
| Every entry under `applications` sets `app_type` to select one of three kinds; a single | ||
| Module can mix them. | ||
|
|
||
| | `app_type` | Provides | Key fields | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this table use Key fields instead of just fields? If its because it only contains a subset of fields, then shouldnt the table also use Key fields as it is also a subset of fields. |
||
| |------------|----------|------------| | ||
| | `apptainer` | Commands that run inside a container image | `container`, `entrypoints`, `global_options` | | ||
| | `shell` | A single executable running a bash script | `name`, `script` | | ||
| | `binary` | A downloaded executable added to the path | `name`, `url`, `hash`, `hash_type` | | ||
|
|
||
| The demo `example-module-apps` Module combines an Apptainer app with a Shell app: | ||
|
|
||
| ```{literalinclude} ../../src/deploy_tools/demo_configuration/example-module-apps/0.1.yaml | ||
| :language: yaml | ||
| :lines: 3- | ||
| ``` | ||
|
|
||
| **Apptainer** uses one container image with one or more `entrypoints`, each mapping an | ||
| executable name to a command run inside the container. Options — container `mounts`, | ||
| `command_args`, `apptainer_args`, `host_binaries` — can be set per entrypoint or shared | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these fields documented in prose here and not in either the tree diagram at the top or their own table? I see that some of them are documented in the second table, but not all, it just seems a bit inconsistent to me. |
||
| across all of them via `global_options`. | ||
|
|
||
| **Shell** exposes a single executable (`name`) that runs the `script` list as bash. | ||
|
|
||
| **Binary** downloads `url`, checks it against `hash` using `hash_type` (`sha256`, | ||
| `sha512`, `md5`, or `none` to skip the check), and adds the executable to the path as | ||
| `name`. The demo `argocd` Module uses one: | ||
|
|
||
| ```{literalinclude} ../../src/deploy_tools/demo_configuration/argocd/v2.14.10.yaml | ||
| :language: yaml | ||
| :lines: 3- | ||
| ``` | ||
|
|
||
| ## Settings | ||
|
|
||
| `settings.yaml` holds deployment-wide settings. It currently has a single field, | ||
| `default_versions`, mapping a Module name to the version handed to `module load <name>` | ||
| when no version is given: | ||
|
|
||
| ```{literalinclude} ../../src/deploy_tools/demo_configuration/settings.yaml | ||
| :language: yaml | ||
| :lines: 3- | ||
| ``` | ||
|
Comment on lines
+92
to
+95
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these sections look broken in github MD preview, but I assume they work in the generated docs? |
||
|
|
||
| How that choice is resolved — and how to keep a version out of automatic selection — is | ||
| covered in [default version resolution](default-versions.md). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Write a Module configuration | ||
|
|
||
| To add or change a Module you edit YAML in the configuration folder. This guide covers the | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a comma after Module? |
||
| mechanics. For the shape of the files see | ||
| [the configuration model](../explanations/configuration-model.md); for every field, the | ||
| [schema reference](../schemas.md). | ||
|
|
||
| ## Add a new Module version | ||
|
|
||
| 1. Create the file at `<config folder>/<name>/<version>.yaml`. The folder name is the | ||
| Module `name` and the filename is the `version`, so `phoebus/0.1.yaml` defines version | ||
| `0.1` of `phoebus`. The `name` and `version` inside the file must match the path. | ||
|
|
||
| 2. Add the schema line as the first line so your editor validates as you type (see the | ||
| [schema reference](../schemas.md) for details, including how to associate schemas | ||
| repository-wide instead of per file): | ||
|
|
||
| ```yaml | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/DiamondLightSource/deploy-tools/main/src/deploy_tools/models/schemas/release.json | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this line only for vscode or does it work for other editors? |
||
| ``` | ||
|
|
||
| 3. Define the Module. Most Modules provide one or more applications; the smallest useful | ||
| one is a single shell script: | ||
|
|
||
| ```yaml | ||
| module: | ||
| name: my-module | ||
| version: "1.0" | ||
| description: What this Module provides | ||
| applications: | ||
| - app_type: shell | ||
| name: hello | ||
| script: | ||
| - echo "hello from my-module" | ||
| ``` | ||
|
|
||
| Swap the application for an `apptainer` or `binary` one as needed — see | ||
| [the three application types](../explanations/configuration-model.md#the-three-application-types). | ||
|
|
||
| A Module doesn't have to provide an application: it can instead just set environment | ||
| variables or pull in other Modules as | ||
| [dependencies](../explanations/configuration-model.md#a-module). Give such a Module an | ||
| empty `applications: []`. | ||
|
|
||
| ## Set the default version | ||
|
|
||
| `module load <name>` with no version loads the default. If you don't choose one the | ||
| highest version is picked automatically; to pin a specific version, add it to | ||
| `settings.yaml`: | ||
|
|
||
| ```yaml | ||
| default_versions: | ||
| my-module: "1.0" | ||
| ``` | ||
|
|
||
| To keep a version out of automatic selection — an alpha or release candidate, say — while | ||
| still allowing an explicit `module load <name>/<version>`, set | ||
| `exclude_from_defaults: true` on that Module. | ||
|
|
||
| See [default version resolution](../explanations/default-versions.md) for how the | ||
| automatic choice is made. | ||
|
|
||
| ## Get your change deployed | ||
|
|
||
| You don't run `deploy-tools` yourself. Open a merge request in the configuration | ||
| repository; CI validates the change and, once it is merged, deploys it (see | ||
| [drive deploy-tools from CI](ci-pipeline.md)). The `yaml-language-server` schema line | ||
| catches structural mistakes in your editor as you type, before you open the request. | ||
|
|
||
|
Comment on lines
+65
to
+69
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember that this documentation is for anyone using deploy-tools. While we don't recommend using deploy-tools manually, someone else using deploy-tools may choose to use it that way. Also maybe "in your configuration repository" rather than "in the configuration repository" would make more sense? And maybe change the text to say "see [drive deploy-tools from CI] for a guide on setting up your configuration repository." |
||
| ## Change or retire a version | ||
|
|
||
| - **Update an existing version in place.** Rejected by default so published versions stay | ||
| stable; prefer publishing a new version. If you must, set `allow_updates: true` on the | ||
| Module — see [the guard rails](../explanations/deprecation-lifecycle.md#the-guard-rails). | ||
| - **Retire a version.** Set `deprecated: true` to steer users away from it. Deleting it | ||
| outright has to wait until after it is deprecated (unless the Module has | ||
| `allow_updates: true`). See | ||
| [the guard rails](../explanations/deprecation-lifecycle.md#the-guard-rails). | ||
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.
Shouldnt these be on seperate lines?