Files
netbird/client/cmd
Nicolas Frati afa6eec6a7 [client] Skip peers without a PTR record in kubernetes commands (#8360)
* [client] Skip peers without a PTR record in kubernetes commands

getKubernetesClusters returned on the first failed reverse lookup, so a
single peer without a PTR record made `netbird kubernetes list` and
`write-kubeconfig` fail even when a netbird-kubeapi-proxy peer was
reachable later in the list. Log the failure at debug and keep scanning,
stopping only when the context is cancelled.

* [client] Return cancellation when the last peer's lookup is skipped

A failed lookup or fingerprint on the final peer was skipped and the
loop ended with a nil error, so a cancelled command reported no clusters
instead of the cancellation.

* [client] Report the lookup error when no peer resolves

Skipping every failed reverse lookup hid a broken resolver behind "No
Kubernetes clusters available" or "cluster not found", with the cause
only in the debug log. When no lookup succeeds, return the last lookup
error. One resolvable peer still means the resolver works, so per-peer
failures stay skipped.

* [client] Stop the kubernetes peer scan when the resolver is down

With a dead resolver every peer waited out the resolver timeout in turn
before the error was reported. A missing PTR record answers NXDOMAIN, so
a timeout or SERVFAIL before any peer resolved means the resolver itself
is failing: return it at once. After one peer resolved, later failures
are still skipped.

* [client] Extract kubernetes cluster probing from the peer scan

The lookup error handling pushed findKubernetesClusters past the
cognitive complexity limit. Move the FQDN match and fingerprint into
probeCluster so the scan loop only handles lookups and deduplication.
2026-10-26 16:02:26 +01:00
..