Skip to content

fix(network): allow inspecting pseudo networks#4953

Open
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-network-inspect-pseudo-networks
Open

fix(network): allow inspecting pseudo networks#4953
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-network-inspect-pseudo-networks

Conversation

@immanuwell

@immanuwell immanuwell commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

refs #3005

nerdctl network ls shows host and none, but nerdctl network inspect host and nerdctl network inspect none still fail. the inspect path asks to allow pseudo networks, but lookup only checked on-disk CNI configs, so these names fell through. kinda awkward.

this returns a small synthetic config for pseudo networks in that lookup path, so inspect can render them fine.

repro:

  1. run nerdctl network ls
  2. see host and none
  3. run nerdctl network inspect host
  4. before: fails with no network found matching: host
  5. after: returns JSON with "Name": "host"

checks:

  • go test ./pkg/netutil -count=1
  • go test ./pkg/inspecttypes/dockercompat -count=1
  • go test ./cmd/nerdctl/network -run ^ -count=1

Comment thread pkg/netutil/netutil.go Outdated
@immanuwell immanuwell force-pushed the fix-network-inspect-pseudo-networks branch from 9871643 to 79a6561 Compare June 12, 2026 13:58
@immanuwell immanuwell requested a review from sathiraumesh June 12, 2026 13:59
@AkihiroSuda

Copy link
Copy Markdown
Member
 FAIL - does not have a valid DCO

https://github.com/containerd/nerdctl/actions/runs/27420363683/job/81044018040?pr=4953

Comment thread pkg/netutil/netutil.go Outdated
}

func newPseudoNetworkConfig(name string) (*NetworkConfig, error) {
confJSON, err := json.Marshal(struct {

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.

Isn't this struct already defined in somewhere else?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point
I switched newPseudoNetworkConfig to reuse the existing cniNetworkConfig, and made nerdctlID / nerdctlLabels omitempty so the synthetic pseudo-network config stays minimal
PTAL

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell immanuwell force-pushed the fix-network-inspect-pseudo-networks branch from 79a6561 to 5a04185 Compare June 13, 2026 06:23
@immanuwell immanuwell requested a review from AkihiroSuda June 13, 2026 06:26
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