added real-world examples for podman#516
Conversation
|
This is pretty cool! I haven't worked my way through all of the examples yet but a thought that occurred to me while troubleshooting example #2 is that we should probably include any required plugin configuration in the readme. You mention that we should have the plugin configured for volumes but since the plugin config is short it would be nice to include it in that section of the readme |
tehut
left a comment
There was a problem hiding this comment.
I worked through the rest of the examples today and I only have a single (but repeated) note on the actual tutorial steps. But I have some pretty big feedback on the way each of the example sections are structured.
All of the commands were correct and worked fine but the structure wasn't written as if someone was going to work through them but just sorta generated.
I think the most impactful change would be to rewrite the Verify sections so that each step follows the usual Instruction -> Action -> Expected Result pattern. I did example 1 for you to demonstrate what I mean and how it varies with what's there now.
| ```sh | ||
| # 1. The allocation should be "running". | ||
| nomad job status hello-world | ||
|
|
||
| # 2. Podman should show the container. | ||
| podman ps --filter name=^redis- | ||
|
|
||
| # 3. Talk to Redis through the published port. Read the host:port that Nomad | ||
| # assigned, then PING it. | ||
| addr=$(nomad alloc status -json $(nomad job allocs -json hello-world \ | ||
| | jq -r '.[0].ID') | jq -r '.Resources.Networks[0].DynamicPorts[0] | ||
| | "\(env.NOMAD_IP // "127.0.0.1"):\(.Value)"') | ||
|
|
||
| redis-cli -u "redis://${addr}" PING | ||
| ``` | ||
|
|
||
| If you don't have `redis-cli` locally, exec into the container instead: | ||
|
|
||
| ```sh | ||
| podman exec -it $(podman ps -qf name=^redis-) redis-cli PING | ||
| ``` | ||
|
|
||
| ## Expected output | ||
|
|
||
| `nomad job status hello-world` shows one allocation in the `running` state: | ||
|
|
||
| ``` | ||
| Allocations | ||
| ID Node ID Task Group Version Desired Status Created Modified | ||
| xxxxxxxx xxxxxxxx cache 0 run running 10s ago 3s ago | ||
| ``` | ||
|
|
||
| `podman ps` lists the container with a `redis-server` command and a published | ||
| port, and the `PING` returns: | ||
|
|
||
| ``` | ||
| PONG | ||
| ``` |
There was a problem hiding this comment.
I reworked the first example to conform to the general tutorial pattern of expected action-> expected result. And because we're able to show the expected result directly beneath the input I don't think you need the comments to do that and can instead treat them like bulleted instructions to go along with the expected action -> expected result.
I reworked the section as an example but this applies throughout. If there are sections with a single step I think you can probably just remove the Expected Results header but anything with more than one step should be re-written as single threaded.
| ```sh | |
| # 1. The allocation should be "running". | |
| nomad job status hello-world | |
| # 2. Podman should show the container. | |
| podman ps --filter name=^redis- | |
| # 3. Talk to Redis through the published port. Read the host:port that Nomad | |
| # assigned, then PING it. | |
| addr=$(nomad alloc status -json $(nomad job allocs -json hello-world \ | |
| | jq -r '.[0].ID') | jq -r '.Resources.Networks[0].DynamicPorts[0] | |
| | "\(env.NOMAD_IP // "127.0.0.1"):\(.Value)"') | |
| redis-cli -u "redis://${addr}" PING | |
| ``` | |
| If you don't have `redis-cli` locally, exec into the container instead: | |
| ```sh | |
| podman exec -it $(podman ps -qf name=^redis-) redis-cli PING | |
| ``` | |
| ## Expected output | |
| `nomad job status hello-world` shows one allocation in the `running` state: | |
| ``` | |
| Allocations | |
| ID Node ID Task Group Version Desired Status Created Modified | |
| xxxxxxxx xxxxxxxx cache 0 run running 10s ago 3s ago | |
| ``` | |
| `podman ps` lists the container with a `redis-server` command and a published | |
| port, and the `PING` returns: | |
| ``` | |
| PONG | |
| ``` |
Verify
- Use
nomad job statusto verify the job isrunning
nomad job status hello-world
Allocations
ID Node ID Task Group Version Desired Status Created Modified
xxxxxxxx xxxxxxxx cache 0 run running 10s ago 3s ago- List all podman containers matching the filter
^redis-
podman ps --filter name=^redis-
<For the sake of symmetry RUN the above command and paste the results here>- Read the dynamic port that Nomad assigned into a variable and use that to then PING the redis server.
$ addr=$(nomad alloc status -json $(nomad job allocs -json hello-world \
| jq -r '.[0].ID') | jq -r '.Resources.Networks[0].DynamicPorts[0]
| "\(env.NOMAD_IP // "127.0.0.1"):\(.Value)"')
$ redis-cli -u "redis://${addr}" PING
PONG
Issue
Summary
Adds a curated, progressive set of example jobs for the Podman driver that takes a user from a single-container "hello world" all the way to a rootless, hardened deployment. Each example is self-contained: a runnable job spec plus a
READMEthat explains what it demonstrates, gives exact run/verify steps, and shows the expected output — so a user can run and adapt each one without external guidance.Previously the
jobs directoryheld a handful of feature-specific specs with no narrative or learning order. This PR adds a guided learning path on top of them (the older specs remain as additional references).What's included
A new
examples/jobs/<NN-name>/directory per example, each with a*.nomadspec, aREADME.md, and any supporting templates/. An index README ties them together as an ordered learning path, and the main README links to it (without duplicating the detail).image,ports,resourcesvolumes(:U), jobvariablenetwork_mode = "task:...",lifecyclesocket,user,cap_drop,readonly_rootfs,security_opt,tmpfsTesting
Details
PONGalloc restart/text +/health{"status":"ok"}app1socket —HTTP/1.1 200 OK, RO rootfs + dropped capsChanges to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.