Skip to content

OCPBUGS-83562: telco-ran: Pre-create /run/netns bindmount so it propagates to the container-mount-namespace#762

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:mainfrom
lack:OCPBUGS-83562_precreate_netns
May 15, 2026
Merged

OCPBUGS-83562: telco-ran: Pre-create /run/netns bindmount so it propagates to the container-mount-namespace#762
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:mainfrom
lack:OCPBUGS-83562_precreate_netns

Conversation

@lack
Copy link
Copy Markdown
Member

@lack lack commented May 15, 2026

This closes a race between running ip netns add inside the
container-mount-namespace namespace and running it outside of the
container-mount-namespace namespace.

The cause of the race is that the /run/netns/ bindmount created by ip netns add is created with rshared properties, so the external call
would shadow the internal call any time the internal call occurs first.
Forcing the call to happen on the outside ensures any subsequent
internal calls will simply reuse the existing bindmount (as intended).

Signed-off-by: Jim Ramsay jramsay@redhat.com

Note: Incorporates changes from upstream containers/kubensmnt#13 and containers/kubensmnt#14

@openshift-ci openshift-ci Bot requested review from cgoncalves and ffromani May 15, 2026 17:12
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

Warning

Rate limit exceeded

@lack has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 10 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 07b57579-829d-47f9-9936-c2be531d5cd6

📥 Commits

Reviewing files that changed from the base of the PR and between de264ab and 0887173.

📒 Files selected for processing (5)
  • telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service
  • telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-worker.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml
📝 Walkthrough

Walkthrough

Adds an ExecStartPost to container-mount-namespace.service (template, master, worker, and kube-compare variants) that creates then deletes a temporary network namespace (kubensmnt) to initialize /run/netns as a shared mountpoint and avoid mount-shadowing.

Changes

Container mount-namespace service updates

Layer / File(s) Summary
Shared mount initialization for /run/netns
telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service, telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml, telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml, telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-master.yaml, telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-worker.yaml
All affected manifests add an ExecStartPost that runs a temporary ip netns add kubensmnt followed by ip netns delete kubensmnt, with inline comments stating the intent to initialize /run/netns as a shared mount point to prevent namespace mount shadowing.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: pre-creating the /run/netns bindmount to resolve a race condition (OCPBUGS-83562), which matches the core purpose reflected across all five modified files.
Description check ✅ Passed The description is directly related to the changeset, explaining the race condition being fixed and the solution of pre-creating the /run/netns bindmount with proper technical context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lack lack changed the title telco-ran: Pre-create /run/netns bindmount so it propagates to the container-mount-namespace OCPBUGS-83562: telco-ran: Pre-create /run/netns bindmount so it propagates to the container-mount-namespace May 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

@lack: This pull request references Jira Issue OCPBUGS-83562, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This closes a race between running ip netns add inside the
container-mount-namespace namespace and running it outside of the
container-mount-namespace namespace.

The cause of the race is that the /run/netns/ bindmount created by ip netns add is created with rshared properties, so the external call
would shadow the internal call any time the internal call occurs first.
Forcing the call to happen on the outside ensures any subsequent
internal calls will simply reuse the existing bindmount (as intended).

Signed-off-by: Jim Ramsay jramsay@redhat.com

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service`:
- Around line 22-23: The ExecStartPost command currently uses "mount
--make-shared" but should use recursive shared propagation to match ip netns add
behavior; update the second ExecStartPost line (the bash -c that checks
mountpoint /run/netns and performs mount --bind /run/netns /run/netns && mount
--make-shared /run/netns ...) to use mount --make-rshared /run/netns instead of
--make-shared so the MS_SHARED|MS_REC semantics are applied.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: d6114fea-f663-46cc-9ce9-1fbe98e78272

📥 Commits

Reviewing files that changed from the base of the PR and between d269bbe and ccbf6d5.

📒 Files selected for processing (3)
  • telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml

@lack lack force-pushed the OCPBUGS-83562_precreate_netns branch from ccbf6d5 to d466297 Compare May 15, 2026 18:20
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml`:
- Line 48: The ExecStartPost command currently does an unconditional umount
/run/netns on error which can unmount a mount created by another actor; change
the shell logic so you only unmount if your own bind mount actually succeeded.
Concretely, update the ExecStartPost line (the bash -c invoking mount --rbind
/run/netns && mount --make-rshared /run/netns) to atomically detect success
(e.g., capture the exit status of mount --rbind, or check for a mount entry you
just created with findmnt/mountpoint) and perform umount /run/netns only when
that check confirms the bind was created by this command; do not perform an
unconditional umount in the failure branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 878fd31a-8dcc-493f-9d46-5df581f327a2

📥 Commits

Reviewing files that changed from the base of the PR and between ccbf6d5 and d466297.

📒 Files selected for processing (3)
  • telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

@lack: This pull request references Jira Issue OCPBUGS-83562, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

This closes a race between running ip netns add inside the
container-mount-namespace namespace and running it outside of the
container-mount-namespace namespace.

The cause of the race is that the /run/netns/ bindmount created by ip netns add is created with rshared properties, so the external call
would shadow the internal call any time the internal call occurs first.
Forcing the call to happen on the outside ensures any subsequent
internal calls will simply reuse the existing bindmount (as intended).

Signed-off-by: Jim Ramsay jramsay@redhat.com

Note: Incorporates changes from upstream containers/kubensmnt#13 and containers/kubensmnt#14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@lack lack force-pushed the OCPBUGS-83562_precreate_netns branch 2 times, most recently from 92332bd to de264ab Compare May 15, 2026 19:31
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service`:
- Line 23: Change the ExecStartPost command so it succeeds if /run/netns is
already a mountpoint instead of failing when the temporary namespace exists;
replace the current ExecStartPost (which runs "ip netns add kubensmnt && ip
netns delete kubensmnt") with a guard that checks mountpoint -q /run/netns and
only performs the add/delete when needed, e.g. use ExecStartPost=bash -c
'mountpoint -q /run/netns || { ip netns add kubensmnt && ip netns delete
kubensmnt; }' (apply the same change to the other four matching locations).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 4081ace4-716f-4f8a-b08a-87f1e5c38c6f

📥 Commits

Reviewing files that changed from the base of the PR and between d466297 and de264ab.

📒 Files selected for processing (5)
  • telco-ran/configuration/extra-manifests-builder/01-container-mount-ns-and-kubelet-conf/container-mount-namespace.service
  • telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/kube-compare-reference/machine-config/kubelet-configuration-and-container-mount-hiding/01-container-mount-ns-and-kubelet-conf-worker.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-master.yaml
  • telco-ran/configuration/source-crs/extra-manifest/01-container-mount-ns-and-kubelet-conf-worker.yaml

@lack lack force-pushed the OCPBUGS-83562_precreate_netns branch from de264ab to c183ca4 Compare May 15, 2026 19:52
@lack
Copy link
Copy Markdown
Member Author

lack commented May 15, 2026

/cherry-pick release-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

@lack: once the present PR merges, I will cherry-pick it on top of release-4.22 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@lack lack force-pushed the OCPBUGS-83562_precreate_netns branch from c183ca4 to 3a2a602 Compare May 15, 2026 20:57
…ntainer-mount-namespace

This closes a race between running `ip netns add` inside the
container-mount-namespace namespace and running it outside of the
container-mount-namespace namespace.

The cause of the race is that the /run/netns/ bindmount created by `ip
netns add` is created with rshared properties, so the external call
would shadow the internal call any time the internal call occurs first.
Forcing the call to happen on the outside ensures any subsequent
internal calls will simply reuse the existing bindmount (as intended).

Signed-off-by: Jim Ramsay <jramsay@redhat.com>
@lack lack force-pushed the OCPBUGS-83562_precreate_netns branch from 3a2a602 to 0887173 Compare May 15, 2026 20:57
Copy link
Copy Markdown
Collaborator

@imiller0 imiller0 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 15, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: imiller0, lack

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit a440f9a into openshift-kni:main May 15, 2026
4 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

@lack: Jira Issue OCPBUGS-83562: Some pull requests linked via external trackers have merged:

The following pull request, linked via external tracker, has not merged:

All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with /jira refresh.

Jira Issue OCPBUGS-83562 has not been moved to the MODIFIED state.

Details

In response to this:

This closes a race between running ip netns add inside the
container-mount-namespace namespace and running it outside of the
container-mount-namespace namespace.

The cause of the race is that the /run/netns/ bindmount created by ip netns add is created with rshared properties, so the external call
would shadow the internal call any time the internal call occurs first.
Forcing the call to happen on the outside ensures any subsequent
internal calls will simply reuse the existing bindmount (as intended).

Signed-off-by: Jim Ramsay jramsay@redhat.com

Note: Incorporates changes from upstream containers/kubensmnt#13 and containers/kubensmnt#14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@lack: new pull request created: #763

Details

In response to this:

/cherry-pick release-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants