Skip to content

feat: added ipc_mode task config option#515

Merged
ritesh-harihar merged 4 commits into
mainfrom
f-expose-ipc-config
Jun 25, 2026
Merged

feat: added ipc_mode task config option#515
ritesh-harihar merged 4 commits into
mainfrom
f-expose-ipc-config

Conversation

@ritesh-harihar

@ritesh-harihar ritesh-harihar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Issue

Summary

The Podman driver previously gave tasks no control over their IPC namespace — every container got Podman's default (a private namespace with its own /dev/shm). This makes it impossible for tasks in the same allocation to share IPC primitives / /dev/shm,

What's Chnaged

This PR exposes a new optional ipc_mode task config option that maps directly to Podman's --ipc, bringing the driver to parity with the Docker driver's ipc_mode. It also adds a fail-fast conflict check between ipc_mode and shm_size.

  • StartTask translates ipc_mode into createOpts.ContainerStorageConfig.IpcNS (driver.go), mirroring the existing
    network_mode handling (including the container:, ns:, and task: prefix forms via BuildContainerNameForTask).
  • Conflict check: shm_size is now rejected with any ipc_mode that does not own the container's /dev/shm (i.e. anything other than private/shareable), matching the Podman API contract.

Example

config {
  ipc_mode = "task:mps-daemon"
} 

Supported values

ipc_mode Behavior
(unset) Podman default — private namespace (unchanged)
host use the host's IPC namespace (insecure)
private private IPC namespace
shareable private namespace other containers may join
none private namespace with no /dev/shm mounted
container:<id> join another container's IPC namespace
ns:<path> join the IPC namespace at a path
task:<name> join another task's IPC namespace in the same alloc (MPS pattern)

Before/After

Scenario Before After
ipc_mode in task config unknown key → task fails to start (Invalid label: No argument or block type is named "ipc_mode") accepted and applied
Default behavior (no ipc_mode) private namespace unchanged — private namespace
Two tasks sharing /dev/shm not possible ipc_mode = "task:" → shared
--ipc=host etc. not configurable podman inspect ... HostConfig.IpcMode = host
shm_size + ipc_mode=host n/a fails fast: shm_size cannot be used with ipc_mode="host"; it requires a private or shareable IPC namespace

Testing

Details
  • Job files
  1. ipc_share_task.nomad.hcl
job "ipc-share-task" {
  datacenters = ["dc1"]
  type        = "batch"

  group "mps-like" {
    # writer plays the role of the MPS control daemon
    task "writer" {
      driver = "podman"

      lifecycle {
        hook    = "prestart"
        sidecar = true
      }

      config {
        image   = "docker://busybox"
        command = "sh"
        args    = ["-c", "echo SHARED_OK > /dev/shm/marker && sleep 600"]
      }
    }

    # reader plays the role of an MPS client joining the daemon's IPC namespace
    task "reader" {
      driver = "podman"

      config {
        image   = "docker://busybox"
        command = "sh"
        args    = ["-c", "sleep 3; cat /dev/shm/marker 2>/dev/null || echo NOT_SHARED"]

        # the new option under test: join the writer task's IPC namespace
        ipc_mode = "task:writer"
      }
    }
  }
} 
  1. ipc_host.nomad.hcl
job "ipc-host" {
  datacenters = ["dc1"]
  type        = "batch"

  group "ipc" {
    task "show-ipc" {
      driver = "podman"

      config {
        image   = "docker://busybox"
        command = "sh"
        args    = ["-c", "echo 'ipc ns:'; ls -l /proc/self/ns/ipc; echo done"]

        # the new option under test
        ipc_mode = "host"
      }
    }
  }
}
  1. ipc_conflict.nomad.hcl
job "ipc-conflict" {
  datacenters = ["dc1"]
  type        = "batch"

  group "ipc" {
    reschedule {
      attempts  = 0
      unlimited = false
    }

    task "bad" {
      driver = "podman"

      config {
        image   = "docker://busybox"
        command = "sh"
        args    = ["-c", "echo should-not-start"]

        # invalid combination under test
        ipc_mode = "host"
        shm_size = "64m"
      }
    }
  }
}
  • Before flow:
2026-06-15T15:40:28.211+0530 [ERROR] client.alloc_runner.task_runner: running driver failed: alloc_id=d02db3b2-c06a-622f-5cbd-e88aa8903bab task=show-ipc
  error=
  | 2 errors occurred:
  | \t* failed to parse config: 
  | \t* Invalid label: No argument or block type is named "ipc_mode". 
riteshharihar@podman-dev:/Users/riteshharihar/Desktop/Src/nomad-driver-podman$ ALLOC=$(nomad job allocs -json ipc-share-default | jq -r '.[0].ID')
sleep 6
nomad alloc logs -task reader "$ALLOC"
2026-06-15T15:47:30.379517994+05:30 stdout  F NOT_SHARED
  • Current Flow:
  1. for ipc_share_task.nomad.hcl
riteshharihar@podman-dev:/Users/riteshharihar/Desktop/Src/nomad-driver-podman$ nomad job run examples/jobs/ipc/ipc_share_task.nomad.hcl
ALLOC=$(nomad job allocs -json ipc-share-task | jq -r '.[0].ID')
sleep 6
nomad alloc logs -task reader "$ALLOC"
==> 2026-06-15T15:58:01+05:30: Monitoring evaluation "6614d175"
    2026-06-15T15:58:01+05:30: Evaluation triggered by job "ipc-share-task"
    2026-06-15T15:58:02+05:30: Allocation "32baf8c1" created: node "b3fb2afe", group "mps-like"
    2026-06-15T15:58:02+05:30: Evaluation status changed: "pending" -> "complete"
==> 2026-06-15T15:58:02+05:30: Evaluation "6614d175" finished with status "complete"
2026-06-15T15:58:04.841193225+05:30 stdout F SHARED_OK
  1. ipc_host.nomad.hcl
riteshharihar@podman-dev:/Users/riteshharihar/Desktop/Src/nomad-driver-podman$ nomad job run examples/jobs/ipc/ipc_host.nomad.hcl
CID=$(podman ps -a --filter "name=show-ipc" --format '{{.ID}}' | head -1)
podman inspect "$CID" -f '{{.HostConfig.IpcMode}}'
==> 2026-06-15T15:56:19+05:30: Monitoring evaluation "7363bcf6"
    2026-06-15T15:56:19+05:30: Evaluation triggered by job "ipc-host"
    2026-06-15T15:56:20+05:30: Allocation "9ac47692" created: node "b3fb2afe", group "ipc"
    2026-06-15T15:56:20+05:30: Evaluation status changed: "pending" -> "complete"
==> 2026-06-15T15:56:20+05:30: Evaluation "7363bcf6" finished with status "complete"
host
  1. ipc_conflict.nomad.hcl
2026-06-15T15:59:29.222+0530 [ERROR] client.alloc_runner.task_runner: running driver failed: alloc_id=98d02c88-5b5a-30c6-ec4b-d2e8fb27ab53 task=bad error="rpc error: code = Unknown desc = shm_size cannot be used with ipc_mode=\"host\"; it requires a private or shareable IPC namespace"
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@ritesh-harihar
ritesh-harihar marked this pull request as ready for review June 16, 2026 09:14
@ritesh-harihar
ritesh-harihar requested a review from a team as a code owner June 16, 2026 09:14
@ritesh-harihar ritesh-harihar self-assigned this Jun 16, 2026
chrisroberts
chrisroberts previously approved these changes Jun 18, 2026

@chrisroberts chrisroberts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Left some styling nits in the tests. Replacing the defers with t.Cleanup throughout the tests will make things a little cleaner.

Comment thread driver_test.go Outdated
Comment thread driver_test.go Outdated
Comment thread driver_test.go Outdated

@tehut tehut left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for getting this knocked out so fast, @ritesh-harihar !

@ritesh-harihar
ritesh-harihar merged commit 483b1ad into main Jun 25, 2026
7 checks passed
@ritesh-harihar
ritesh-harihar deleted the f-expose-ipc-config branch June 25, 2026 06:16
ritesh-harihar added a commit to hashicorp/web-unified-docs that referenced this pull request Jul 13, 2026
<!--
**Merge branch**

Make sure you create your PR against the correct **base** branch. For
instructions, refer to
GitHub's **Change the branch range and destination repository guide**
(https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

If your content is an update to:

- Currently published content

Choose **base: main** when you are updating published documentation, and
you
want your changes published when the PR is merged. We publish Nomad
content
  from the `main` branch.

- Upcoming Nomad release

Choose the branch for the Nomad release that your content is for. Nomad
release branches use the `nomad/<exact-release-number>` format. If you
are not
able to find the upcoming Nomad release branch that you are looking for,
  contact the tech writer that works with the Nomad team.

- Upcoming Nomad release but not sure which one

  - Choose the `main` branch.
  - Add the "do not merge" label.
  - Convert the PR to a DRAFT.
  - Put an explanation in the **Description** section.

  The tech writer coordinates with Nomad engineering and updates
the docs PR base branch when the code is slotted into an upcoming
release.

**Backports**

This repo stores previous version docs in folders instead of branches.
There are
no backport labels. If you backported your code PR to previous branches,
update
the docs content in the corresponding folders. For example, if the
current
release is 1.10.x and you backported your code to 1.9.x and 1.8.x,
update the docs content
in the v1.10.x, v1.9.x, and v1.8.x folders. If you can't find the
relevant files in previous versions,
add a note to your PR description. The tech writer will help ensure that
the previous versions
receive the correct updates.
-->

## Description
This PR updates the nomad-driver-podman documentation for the v0.5.0
release.

[Ticket](https://hashicorp.atlassian.net/browse/NMD-1628)

<!-- 
Please describe why you're making this change and point out any
important details the reviewers
should be aware of. A robust description helps the tech writer create a
fabulous release note.
If your code PR has a splendid description, link to the code PR in the
links section so that
the tech writer can update this PR's description. 

Include the target release as well as prior versions if applicable.
-->

## Changes
<!--
**Please link to the related Nomad repo code PR!** if there is one. 
The tech writer does look at the code PR description, Jira ticket,
and/or GH issue before reviewing docs content.

Include links to GitHub issues, documentation, or similar which is
relevant to this PR. If
this is a docs bug fix, please ensure related issues are linked so they
will close when this PR is
merged.

// GH-Jira integration generates the link and updates the Jira ticket.
Jira: [<jira-ticket-number>]  // for example, Jira: [NMD-1234] 

GitHub Issue: <issue-link>

Deploy previews: The bot does publish a root-level link to the deploy
preview, but the preview URL changes with each build.
-->

**Image platform overrides
([PR](hashicorp/nomad-driver-podman#514) , [JIRA
Ticket](https://hashicorp.atlassian.net/browse/NMD-1320))**

- Documents the new os, arch, and variant task config fields that
override the platform used when pulling an image (mirroring podman's
--os, --arch, --variant flags)
- Adds an example and explains the always-pull behavior when any
override is set, plus constraint guidance for pinning workloads to
compatible nodes

**IPC namespace mode
([PR](hashicorp/nomad-driver-podman#515) , [JIRA
Ticket](https://hashicorp.atlassian.net/browse/NMD-1582))**

- Documents the new ipc_mode task config with all supported values
(host, private, shareable, none, container:<id>, ns:<path>, task:<name>)
- Adds a task:mps-daemon example and the shm_size compatibility note

**Custom Podman network names
([PR](hashicorp/nomad-driver-podman#509) , [JIRA
Ticket](https://hashicorp.atlassian.net/browse/NMD-1518 ))**

- Documents that network_mode accepts the name of a pre-existing Podman
network created with podman network create
- Notes the network must already exist and that this requires Podman 4.0
or later; adds a network_mode = "mynet" example

**HTTP(S) archive URLs for images
([PR](hashicorp/nomad-driver-podman#517) ,[ JIRA
Ticket](https://hashicorp.atlassian.net/browse/NMD-1000))**

- Documents that the image field's oci-archive and docker-archive
transports accept http(s):// URLs, not just local archive paths
- Adds an oci-archive:https://... example


## Contributor checklists

Review urgency:

- [ ] ASAP: Bug fixes, broken content, imminent releases
- [ ] 3 days: Small changes, easy reviews
- [ ] 1 week: Default expectation
- [ ] Best effort: No urgency

Pull request:

- [ ] Verify that the PR is set to merge into the correct base branch
- [ ] Verify that all status checks passed
- [ ] Verify that the preview environment deployed successfully
- [ ] Add additional reviewers if they are not part of assigned groups

Content:

- [ ] I added redirects for any moved or removed pages
- [x] I followed the [Education style
guide](https://github.com/hashicorp/web-unified-docs/tree/main/docs/style-guide)
- [ ] I looked at the local or Vercel build to make sure the content
rendered correctly

## Reviewer checklist

- [ ] This PR is set to merge into the correct base branch.
- [ ] The content does not contain technical inaccuracies.
- [ ] The content follows the Education content and style guides.
- [ ] I have verified and tested changes to instructions for end users.


[NMD-1234]:
https://hashicorp.atlassian.net/browse/NMD-1234?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants