Skip to content
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

Allow namespace path network option for pods. #16386

Conversation

bjorndown
Copy link
Contributor

Closes #16208.

Signed-off-by: Björn Mosler [email protected]

Does this PR introduce a user-facing change?

Allows creating a pod which uses an existing network namespace.

@rhatdan
Copy link
Member

rhatdan commented Nov 2, 2022

Thanks @bjorndown
You have a couple of Lint issues. Linter likes JSON to be capitalized.
/approve
LGTM
@vrothberg @mheon @cdoern @Luap99 PTAL

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 2, 2022
@bjorndown bjorndown force-pushed the feature/pod-create-with-netns branch from c3ce299 to 7267475 Compare November 2, 2022 16:42

It("podman pod create with namespace path networking", func() {
SkipIfRootless("ip netns is not supported for rootless users")
SkipIfContainerized("ip netns cannot be run within a container.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is correct

@@ -195,6 +195,9 @@ func MapSpec(p *specgen.PodSpecGenerator) (*specgen.SpecGenerator, error) {
p.InfraContainerSpec.NetworkOptions = p.NetworkOptions
p.InfraContainerSpec.NetNS.NSMode = specgen.Slirp
}
case specgen.Path:
logrus.Debugf("Pod will use namespace path networking")
p.InfraContainerSpec.NetNS.NSMode = specgen.Path
Copy link
Member

Choose a reason for hiding this comment

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

I think you also need to populate p.InfraContainerSpec.NetNS.Value as well, which holds the path of the namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean copy it from the pod spec:

p.InfraContainerSpec.NetNS.Value = p.PodNetworkConfig.NetNS.Value

MapSpec() does not have a test yet, do you think I should add one?

Copy link
Member

Choose a reason for hiding this comment

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

RE Copying - yes.

RE Test - I don't think it's strictly necessary, but I would definitely not complain if you added one

Copy link
Contributor Author

@bjorndown bjorndown Nov 3, 2022

Choose a reason for hiding this comment

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

NetNS.Value is set and I added a test for MapSpec().

@bjorndown bjorndown force-pushed the feature/pod-create-with-netns branch from 7267475 to 32c30fc Compare November 3, 2022 15:30
@bjorndown
Copy link
Contributor Author

bjorndown commented Nov 4, 2022

Two tasks ran into a timeout:

Failed to start: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@2fbc5d61[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@2debdf2a[Wrapped task = TrustedListenableFutureTask@af5166a[status=PENDING, info=[task=[running=[NOT STARTED YET], com.google.api.gax.rpc.CheckingAttemptCallable@77237e40]]]]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@5c5dc533[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

I will trigger another run.

@bjorndown bjorndown force-pushed the feature/pod-create-with-netns branch from 32c30fc to 049a5d8 Compare November 4, 2022 10:26
Copy link
Member

@Luap99 Luap99 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
Copy link
Contributor

openshift-ci bot commented Nov 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bjorndown, Luap99, rhatdan

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

The pull request process is described here

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

@Luap99
Copy link
Member

Luap99 commented Nov 7, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2022
@openshift-merge-robot openshift-merge-robot merged commit 781ecec into containers:main Nov 7, 2022
@bjorndown bjorndown deleted the feature/pod-create-with-netns branch November 8, 2022 15:10
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: support ns namespace path network option for pods
5 participants