topo: skip creating empty meshnet Topology CR for nodes with no links#26
Merged
Conversation
When a node has no Links in its meshnet TopologySpec, kne currently
still creates a `Topology` CR with `spec: {}`. meshnetd's
`Get(podName)` RPC then reads the CR, fails the
`unstructured.NestedSlice(... "spec", "links")` lookup with
`!found`, logs `could not find 'Link' array in pod's spec` and
returns an empty Pod struct. The CNI plugin sees `NodeIp == ""`
and aborts the sandbox with the (misleading) error:
plugin type="meshnet" failed (add):
meshnetd provided no HOST_IP address: or HOST_INTF:
Every pod scheduled on a node with no links is then stuck in
FailedCreatePodSandBox loops until kubelet's 4-minute deadline.
Skip the CR creation for unconnected nodes. The meshnet CNI plugin
already handles "no Topology CR for this pod" gracefully
(plugin/meshnet.go cmdAdd treats Get error as `not a topology pod
returning`) and chains through to the next plugin, so the result
is the same as for any other workload on the cluster.
This is a no-op for topologies whose nodes all have links and
significantly improves robustness for sparse/scale-test topologies
where some nodes are intentionally isolated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a node has no
Linksin its meshnetTopologySpec,knecurrently still creates aTopologyCR withspec: {}.meshnetd'sGet(podName)RPC then reads the CR, fails theunstructured.NestedSlice(... "spec", "links")lookup with!found, logscould not find 'Link' array in pod's specand returns an emptyPod. The CNI plugin seesNodeIp == ""and aborts the sandbox with the (misleading) error:Every pod scheduled on a node with no links is then stuck in
FailedCreatePodSandBoxloops until kubelet's 4-minute deadline expires, and the only fix is to manuallykubectl delete topology …for the offending CRs.Fix
Skip CR creation when
len(spec.Spec.Links) == 0.The meshnet CNI plugin already handles "no Topology CR for this pod" gracefully (
plugin/meshnet.go cmdAddtreatsGeterror asnot a topology pod returningand chains through to the next plugin), so the resulting behaviour is identical to any other non-topology workload on the cluster.This is a no-op for topologies whose nodes all have links, and substantially improves robustness for sparse / scale-test topologies where some nodes are intentionally isolated.
Test plan
go vet ./topo/...clean.kubectl delete topologyworkaround.Made with Cursor