Documentation
¶
Index ¶
- Constants
- Variables
- func Cmd() *cobra.Command
- func InformKubeObjects(ctx context.Context, pub pubsub.Publisher, informer cache.SharedIndexInformer, ...)
- func InformersFactoryFromCtx(ctx context.Context) informers.SharedInformerFactory
- func RookClientFromCtx(ctx context.Context) *rookclientset.Clientset
- type Config
- type ConfigInterconnect
- type ConfigNodes
- type ConfigStorage
- type Exclude
- type ExcludeNodeStorage
- type ExcludeNodesStorage
- type ExcludeRules
- type IBDiscovery
- type QuerierCluster
- type QuerierNodes
- type QuerierStorage
- type RegistryGPUDevice
- type RegistryGPUDevices
- type RegistryGPUVendor
- type RegistryGPUVendors
- type RemotePodCommandExecutor
- type Watcher
Constants ¶
const ( FlagAPITimeout = "api-timeout" FlagQueryTimeout = "query-timeout" FlagRESTPort = "rest-port" FlagGRPCPort = "grpc-port" FlagPodName = "pod-name" FlagPodNamespace = "pod-namespace" FlagConfig = "config" FlagProviderConfigsURL = "provider-configs-url" FlagPciDbURL = "provider-pcidb-url" FlagRegistryQueryPeriod = "registry-query-period" FlagDiscoveryImage = "discovery-image" )
const ( CtxKeyRookClientSet = fromctx.Key("rook-clientset") CtxKeyStorage = fromctx.Key("storage") CtxKeyFeatureDiscovery = fromctx.Key("feature-discovery") CtxKeyInformersFactory = fromctx.Key("informers-factory") CtxKeyHwInfo = fromctx.Key("hardware-info") CtxKeyClusterState = fromctx.Key("cluster-state") CtxKeyConfig = fromctx.Key("config") )
const DefaultInterconnectResourcePattern = "rdma/rdma_shared_device_*"
DefaultInterconnectResourcePattern matches the `rdma/rdma_shared_device_*` extended resources the Mellanox / NVIDIA k8s-rdma-shared-device-plugin publishes (e.g. `rdma/rdma_shared_device_ib` for InfiniBand-pinned plugins, `rdma/rdma_shared_device_eth` for RoCE). Used when the operator's `interconnect.resource_patterns` config list is empty so the rc4 hardcoded behavior keeps working out of the box.
AKT-493: an operator running a non-Mellanox plugin (Broadcom bnxt RDMA, Intel E810 iwarp, etc.) can override this with one or more patterns under `interconnect.resource_patterns` in provider.yaml.
const InfinibandSysfsPath = "/host/sys/class/infiniband"
InfinibandSysfsPath is where the operator's hardware-discovery DaemonSet pod mounts the host's `/sys/class/infiniband` directory. Each entry under it is a symlink to a Mellanox/NVIDIA HCA device (typically `mlx5_0`, `mlx5_1`, ...).
Variables ¶
var (
ErrMetricsUnsupportedRequest = errors.New("unsupported request method")
)
Functions ¶
func InformKubeObjects ¶
func InformersFactoryFromCtx ¶
func InformersFactoryFromCtx(ctx context.Context) informers.SharedInformerFactory
func RookClientFromCtx ¶
func RookClientFromCtx(ctx context.Context) *rookclientset.Clientset
Types ¶
type Config ¶
type Config struct {
Version semver.Version `json:"version" yaml:"version"`
ClusterStorage []string `json:"cluster_storage" yaml:"cluster_storage"`
Exclude Exclude `json:"exclude" yaml:"exclude"`
Interconnect ConfigInterconnect `json:"interconnect" yaml:"interconnect"`
// contains filtered or unexported fields
}
func ConfigFromCtx ¶
func (*Config) FilterOutStorageClasses ¶
func (*Config) HasStorageClass ¶
func (*Config) StorageClassesForNode ¶
type ConfigInterconnect ¶ added in v0.16.0
type ConfigInterconnect struct {
// ResourcePatterns is the list of glob patterns the inventory
// operator matches kubelet's extended-resource names against to find
// the interconnect HCA pool. A bare string with no glob metacharacter
// is treated as a literal prefix match (preserves rc4 behavior).
ResourcePatterns []string `json:"resource_patterns" yaml:"resource_patterns"`
}
ConfigInterconnect holds tunables for GPU-interconnect discovery on the inventory operator. The defaults match the Mellanox/NVIDIA k8s-rdma-shared-device-plugin (the only one supported pre-rc5), so an operator who doesn't set anything continues to work unchanged.
AKT-493: providers running a non-Mellanox device plugin (e.g. Broadcom's bnxt RDMA plugin, Intel E810 iwarp plugin) publish their HCAs under vendor-specific extended-resource names like `broadcom.com/rdma` or `intel.com/iwarp_shared`. The hardcoded `rdma/rdma_shared_device_` prefix used to miss those entirely. ResourcePatterns accepts an arbitrary list of glob patterns (or bare strings, which match as a prefix or exact name); the first kubelet resource that matches any pattern wins.
func (*ConfigInterconnect) Copy ¶ added in v0.16.0
func (ic *ConfigInterconnect) Copy() ConfigInterconnect
type ConfigNodes ¶
type ConfigNodes struct {
Exclude ExcludeRules `json:"exclude" yaml:"exclude"`
}
type ConfigStorage ¶
type ConfigStorage struct {
Exclude ExcludeRules `json:"exclude" yaml:"exclude"`
}
type Exclude ¶
type Exclude struct {
Nodes ExcludeRules `json:"nodes" yaml:"nodes"`
NodeStorage ExcludeNodesStorage `json:"node_storage" yaml:"node_storage"`
}
func (*Exclude) IsNodeExcluded ¶
type ExcludeNodeStorage ¶
type ExcludeNodeStorage struct {
NodeFilter *regexp.Regexp `json:"node_filter" yaml:"node_filter"`
Classes []string `json:"classes" yaml:"classes"`
}
func (*ExcludeNodeStorage) Copy ¶
func (nd *ExcludeNodeStorage) Copy() ExcludeNodeStorage
func (*ExcludeNodeStorage) UnmarshalYAML ¶
func (nd *ExcludeNodeStorage) UnmarshalYAML(node *yaml.Node) error
type ExcludeNodesStorage ¶
type ExcludeNodesStorage []ExcludeNodeStorage
func (*ExcludeNodesStorage) Copy ¶
func (nd *ExcludeNodesStorage) Copy() ExcludeNodesStorage
type ExcludeRules ¶
func (*ExcludeRules) Copy ¶
func (nd *ExcludeRules) Copy() ExcludeRules
func (*ExcludeRules) UnmarshalYAML ¶
func (nd *ExcludeRules) UnmarshalYAML(node *yaml.Node) error
type IBDiscovery ¶ added in v0.16.0
type IBDiscovery struct {
// NCCLIBHCAPrefixes is every distinct HCA device-name family present
// under /sys/class/infiniband — e.g. ["mlx5"] on a uniform Mellanox
// host or ["mlx5","bnxt_re"] on a mixed-vendor node. Empty when no
// devices are present. Surfaced into the provider as
// NodeCapabilities.NCCLHCAPrefixes and joined with `,` by the
// workload builder as NCCL_IB_HCA (NCCL accepts comma-separated
// device prefixes natively).
NCCLIBHCAPrefixes []string `json:"nccl_ib_hca_prefixes"`
// Fabric is "infiniband" or "roce", read from the link_layer of port 1
// on the first detected device. Empty when no devices are present.
// Surfaced into the provider as NodeCapabilities.InterconnectFabric and used
// by the inventory client to gate fabric-pinned bids.
Fabric string `json:"fabric"`
}
IBDiscovery is the JSON payload the psutil HTTP server returns for `/infiniband`. Both fields are empty when the host has no IB devices or when the DaemonSet pod was started without the sysfs mount.
func DiscoverInfinibandFromSysfs ¶ added in v0.16.0
func DiscoverInfinibandFromSysfs() IBDiscovery
DiscoverInfinibandFromSysfs walks `/sys/class/infiniband` on the host (via the InfinibandSysfsPath mount) and produces the IBDiscovery payload. Returns a zero-value IBDiscovery when sysfs is absent or unreadable; that is the natural state for non-interconnect nodes and the caller treats it as "this node has no interconnect capability." Errors are reserved for unexpected I/O conditions.
type QuerierCluster ¶
func ClusterStateFromCtx ¶
func ClusterStateFromCtx(ctx context.Context) QuerierCluster
type QuerierNodes ¶
func FeatureDiscoveryFromCtx ¶
func FeatureDiscoveryFromCtx(ctx context.Context) QuerierNodes
type QuerierStorage ¶
type QuerierStorage interface{}
func NewRancher ¶
func NewRancher(ctx context.Context) (QuerierStorage, error)
func StorageFromCtx ¶
func StorageFromCtx(ctx context.Context) []QuerierStorage
type RegistryGPUDevice ¶
type RegistryGPUDevices ¶
type RegistryGPUDevices map[string]RegistryGPUDevice
type RegistryGPUVendor ¶
type RegistryGPUVendor struct {
Name string `json:"name"`
Devices RegistryGPUDevices `json:"devices"`
}
type RegistryGPUVendors ¶
type RegistryGPUVendors map[string]RegistryGPUVendor
type RemotePodCommandExecutor ¶
type RemotePodCommandExecutor interface {
ExecWithOptions(ctx context.Context, options rookexec.ExecOptions) (string, string, error)
ExecCommandInContainerWithFullOutput(ctx context.Context, appLabel, containerName, namespace string, cmd ...string) (string, string, error)
// ExecCommandInContainerWithFullOutputWithTimeout uses 15s hard-coded timeout
ExecCommandInContainerWithFullOutputWithTimeout(ctx context.Context, appLabel, containerName, namespace string, cmd ...string) (string, string, error)
}
func NewRemotePodCommandExecutor ¶
func NewRemotePodCommandExecutor(restcfg *rest.Config, clientset kubernetes.Interface) RemotePodCommandExecutor