Skip to content

Commit 8558e91

Browse files
author
Jan Kaluza
committed
Rewrite the Quadlet documentation.
This commit does the following: - Splits the podman-systemd.unit.5.md into multiple files - one for each quadlet file type, podman-quadlet.7.md for general quadlet information and podman-quadlet-basic-usage.7.md for quadlet examples. - Removes the original podman-systemd.unit.5.md file. - Adds support for jinja2 templating language in the markdown_preprocess. - Uses jinja2 in options/*.md to use the single .md file for both podman subcommands man-pages and quadlet man-pages. This deduplicates the Quadlet man-pages a lot. - Adds new `@@option quadlet:source.md` preprocess command to import such .md files from options directory. Signed-off-by: Jan Kaluza <[email protected]>
1 parent 07bb670 commit 8558e91

File tree

100 files changed

+2405
-2428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2405
-2428
lines changed

docs/source/markdown/options/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ mechanism:
1717

1818
```
1919
@@option foo ! includes options/foo.md
20+
@@option quadlet:foo ! includes options/foo.md with `is_quadlet=True`
21+
! See "Jinja2 Templating" below.
2022
```
2123

2224
The tool that does this is `hack/markdown-preprocess`. It is a python
@@ -25,6 +27,37 @@ file, this script creates a `.md` file that can then be read by
2527
`go-md2man`, `sphinx`, anything that groks markdown. This runs as
2628
part of `make docs`.
2729

30+
Jinja2 Templating
31+
=================
32+
33+
Some options are used as both Podman command line option and Quadlet
34+
option. To reduce the duplication, the Jinja2 templating system can be
35+
used to define parts which should be rendered only in Quadlet man-pages:
36+
37+
```
38+
{% if is_quadlet %}
39+
### `DNS=`
40+
{% else %}
41+
#### **--dns**=*ipaddr*
42+
{% endif %}
43+
```
44+
45+
It is also possible to use in-line condition:
46+
47+
```
48+
{{{ '**DNS=.**' if is_quadlet else '**--dns**' }}}
49+
```
50+
51+
Following variables are available for Jinja2 Templates:
52+
53+
- `is_quadlet`: True if file is imported using `@@option quadlet:foo`.
54+
- `subcommand`: Same as `<<subcommand>>`, see below.
55+
This allows the shared use of examples in the option file:
56+
- `fullcommand`: Same as `<<fullsubcommand>>`, see below.
57+
58+
For more information about Jinja2, check
59+
https://jinja.palletsprojects.com/en/stable/.
60+
2861
Special Substitutions
2962
=====================
3063

docs/source/markdown/options/add-host.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
####> This option file is used in:
2-
####> podman build, create, farm build, pod create, run
2+
####> podman build, container.unit.5.md.in, create, farm build, pod create, pod.unit.5.md.in, run
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `AddHost=hostname[;hostname[;...]]:ip`
7+
{% else %}
58
#### **--add-host**=*hostname[;hostname[;...]]*:*ip*
9+
{% endif %}
610

711
Add a custom host-to-IP mapping to the <<container|pod>>'s `/etc/hosts` file.
812

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
####> This option file is used in:
2-
####> podman create, kube play, run
2+
####> podman container.unit.5.md.in, create, kube play, run
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `Annotation=key=value`
7+
{% else %}
58
#### **--annotation**=*key=value*
9+
{% endif %}
610

711
Add an annotation to the container<<| or pod>>. This option can be set multiple times.

docs/source/markdown/options/annotation.image.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
####> podman build, farm build
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `Annotation=annotation=value`
7+
{% else %}
58
#### **--annotation**=*annotation=value*
9+
{% endif %}
610

711
Add an image *annotation* (e.g. annotation=*value*) to the image metadata. Can
812
be used multiple times.

docs/source/markdown/options/arch.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
####> This option file is used in:
2-
####> podman create, pull, run
2+
####> podman build.unit.5.md.in, create, image.unit.5.md.in, pull, run
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `Arch=ARCH`
7+
{% else %}
58
#### **--arch**=*ARCH*
9+
{% endif %}
10+
611
Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
712
Unless overridden, subsequent lookups of the same image in the local storage matches this architecture, regardless of the host.

docs/source/markdown/options/authfile.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
####> This option file is used in:
2-
####> podman artifact pull, artifact push, auto update, build, container runlabel, create, farm build, image sign, kube play, login, logout, manifest add, manifest inspect, manifest push, pull, push, run, search
2+
####> podman artifact pull, artifact push, auto update, build, build.unit.5.md.in, container runlabel, create, farm build, image sign, image.unit.5.md.in, kube play, login, logout, manifest add, manifest inspect, manifest push, pull, push, run, search
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `AuthFile=path`
7+
{% else %}
58
#### **--authfile**=*path*
9+
{% endif %}
610

711
Path of the authentication file. Default is `${XDG_RUNTIME_DIR}/containers/auth.json` on Linux, and `$HOME/.config/containers/auth.json` on Windows/macOS.
812
The file is created by **[podman login](podman-login.1.md)**. If the authorization state is not found there, `$HOME/.docker/config.json` is checked, which is set using **docker login**.

docs/source/markdown/options/cap-add.image.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
####> podman build, farm build
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `AddCapability=CAP_xxx`
7+
{% else %}
58
#### **--cap-add**=*CAP\_xxx*
9+
{% endif %}
10+
611

712
When executing RUN instructions, run the command specified in the instruction
813
with the specified capability added to its capability set.

docs/source/markdown/options/cap-add.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
####> This option file is used in:
2-
####> podman create, run
2+
####> podman container.unit.5.md.in, create, run
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `AddCapability=capability`
7+
{% else %}
58
#### **--cap-add**=*capability*
9+
{% endif %}
610

711
Add Linux capabilities.
812

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
####> This option file is used in:
2-
####> podman create, run
2+
####> podman container.unit.5.md.in, create, run
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `DropCapability=capability`
7+
{% else %}
58
#### **--cap-drop**=*capability*
9+
{% endif %}
610

7-
Drop Linux capabilities.
11+
Drop these capabilities from the default podman capability set, or `all` to drop all capabilities.
12+
13+
This is a space separated list of capabilities.

docs/source/markdown/options/cert-dir.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
####> This option file is used in:
2-
####> podman artifact pull, artifact push, build, container runlabel, create, farm build, image sign, kube play, login, manifest add, manifest push, pull, push, run, search
2+
####> podman artifact pull, artifact push, build, container runlabel, create, farm build, image sign, image.unit.5.md.in, kube play, login, manifest add, manifest push, pull, push, run, search
33
####> If file is edited, make sure the changes
44
####> are applicable to all of those.
5+
{% if is_quadlet %}
6+
### `CertDir=path`
7+
{% else %}
58
#### **--cert-dir**=*path*
9+
{% endif %}
610

711
Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. (Default: /etc/containers/certs.d)
812
For details, see **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**.

0 commit comments

Comments
 (0)