inventory

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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")
)

Variables

View Source
var (
	ErrMetricsUnsupportedRequest = errors.New("unsupported request method")
)

Functions

func Cmd

func Cmd() *cobra.Command

func InformKubeObjects

func InformKubeObjects(ctx context.Context, pub pubsub.Publisher, informer cache.SharedIndexInformer, topic string)

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"`
	// contains filtered or unexported fields
}

func ConfigFromCtx

func ConfigFromCtx(ctx context.Context) Config

func (*Config) Copy

func (cfg *Config) Copy() Config

func (*Config) FilterOutStorageClasses

func (cfg *Config) FilterOutStorageClasses(available []string)

func (*Config) HasStorageClass

func (cfg *Config) HasStorageClass(name string) bool

func (*Config) StorageClassesForNode

func (cfg *Config) StorageClassesForNode(name string) []string

func (*Config) UnmarshalYAML

func (cfg *Config) UnmarshalYAML(node *yaml.Node) error

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) Copy

func (nd *Exclude) Copy() Exclude

func (*Exclude) IsNodeExcluded

func (nd *Exclude) IsNodeExcluded(name string) bool

func (*Exclude) IsStorageNodeExcluded

func (nd *Exclude) IsStorageNodeExcluded(name string, class string) bool

type ExcludeNodeStorage

type ExcludeNodeStorage struct {
	NodeFilter *regexp.Regexp `json:"node_filter" yaml:"node_filter"`
	Classes    []string       `json:"classes" yaml:"classes"`
}

func (*ExcludeNodeStorage) Copy

func (*ExcludeNodeStorage) UnmarshalYAML

func (nd *ExcludeNodeStorage) UnmarshalYAML(node *yaml.Node) error

type ExcludeNodesStorage

type ExcludeNodesStorage []ExcludeNodeStorage

func (*ExcludeNodesStorage) Copy

type ExcludeRules

type ExcludeRules []*regexp.Regexp

func (*ExcludeRules) Copy

func (nd *ExcludeRules) Copy() ExcludeRules

func (*ExcludeRules) UnmarshalYAML

func (nd *ExcludeRules) UnmarshalYAML(node *yaml.Node) error

type QuerierCluster

type QuerierCluster interface {
	Query(ctx context.Context) (inventory.Cluster, error)
}

func ClusterStateFromCtx

func ClusterStateFromCtx(ctx context.Context) QuerierCluster

type QuerierNodes

type QuerierNodes interface {
	Query(ctx context.Context) (inventory.Nodes, error)
}

func FeatureDiscoveryFromCtx

func FeatureDiscoveryFromCtx(ctx context.Context) QuerierNodes

type QuerierStorage

type QuerierStorage interface{}

func NewCeph

func NewCeph(ctx context.Context) (QuerierStorage, error)

func NewRancher

func NewRancher(ctx context.Context) (QuerierStorage, error)

func StorageFromCtx

func StorageFromCtx(ctx context.Context) []QuerierStorage

type RegistryGPUDevice

type RegistryGPUDevice struct {
	Name       string `json:"name"`
	Interface  string `json:"interface"`
	MemorySize string `json:"memory_size"`
}

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

type Watcher

type Watcher interface {
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}

Jump to

Keyboard shortcuts

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