network

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package network collects per-hardware-group network topology by ingesting k8s-launch-kit (l8k) cluster-config data and translating it into the NetworkTopology Measurement shape documented in docs/integrator/measurement-api.md.

Two source modes:

  • ClusterConfigPath: parse a pre-existing cluster-config.yaml file (no cluster contact). Air-gap / CI / reproducible-input friendly.
  • DiscoverNetwork: call l8k's live Discover() against the cluster pointed at by KubeconfigPath, mutating cluster state (writes nvidia.kubernetes-launch-kit.* labels and patches NicClusterPolicy via server-side-apply).

Both modes go through the same in-package toMeasurement translator, which enforces the current single-group constraint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// ClusterConfigPath is the filesystem path to an l8k
	// cluster-config.yaml. When set, Collect parses the file and
	// translates the result. No cluster contact.
	ClusterConfigPath string

	// DiscoverNetwork enables live discovery via l8k. Discovery is NOT
	// read-only — it writes labels and patches NicClusterPolicy.
	DiscoverNetwork bool

	// KubeconfigPath overrides the kubeconfig used by the live-discovery
	// path. Empty falls back to client.ResolveKubeconfigPath's chain
	// (KUBECONFIG env → ~/.kube/config → in-cluster).
	KubeconfigPath string
}

Collector ingests an l8k cluster-config (from disk or live discovery) and emits the corresponding NetworkTopology Measurement.

Fields are set directly by the factory (mirrors how pkg/collector/topology is wired). ClusterConfigPath and DiscoverNetwork are mutually exclusive — ClusterConfigPath wins when both are set so callers can default DiscoverNetwork from a flag without inadvertent cluster contact.

When neither field is set, Collect returns (nil, nil) — the collector is "inactive" and the snapshotter treats nil Measurement as a no-op.

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context) (*measurement.Measurement, error)

Collect runs the configured source mode and returns a NetworkTopology Measurement, or (nil, nil) when the collector is inactive.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL