Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DisableShuffleForTesting = false
Functions ¶
func CloneAndShuffle ¶
func CloneAndShuffle[T any](items []T) []T
Types ¶
type AgentConfig ¶
type AgentConfig struct { // OutputDir is the directory to store the observations. OutputDir string `json:"outputDir,omitempty"` // RetentionHours defines how many hours to keep old observations. RetentionHours int `json:"retentionHours,omitempty"` // LogObservations defines if observations should be logged additionally (for debug purposes) LogObservations bool `json:"logObservations"` // K8sExporter defines configuration of the K8s exporter for writing node conditions and events K8sExporter *K8sExporterConfig `json:"k8sExporter,omitempty"` // AggregationReportPeriod defines how often aggregated report is logged. AggregationReportPeriod *metav1.Duration `json:"aggregationReportPeriod,omitempty"` // AggregationTimeWindow defines when an aggregation edge outdates if no new observations arrive AggregationTimeWindow *metav1.Duration `json:"aggregationTimeWindow,omitempty"` // MaxPeerNodes defines the maximum number of nodes to check (0 means check all nodes) MaxPeerNodes int `json:"maxPeerNodes,omitempty"` // HostNetwork is the configuration specific for daemon set in node network HostNetwork *NetworkConfig `json:"hostNetwork,omitempty"` // PodNetwork is the configuration specific for daemon set in node network PodNetwork *NetworkConfig `json:"podNetwork,omitempty"` }
func LoadAgentConfig ¶
func LoadAgentConfig(configFile string) (*AgentConfig, error)
func (*AgentConfig) Clone ¶
func (c *AgentConfig) Clone() (*AgentConfig, error)
type ClusterConfig ¶
type ClusterConfig struct { // NodeCount is the number known nodes (not anly the subset used as destinations) NodeCount int // Nodes is the subset of the known nodes used as destinations. Nodes []Node `json:"nodes,omitempty"` // PodEndpoints is the subset of the known pods of the 'nwpd-agent-pod-net' daemon set. PodEndpoints []PodEndpoint `json:"podEndpoints,omitempty"` // InternalKubeAPIServer is the discovered internal address of the kube-apiserver InternalKubeAPIServer *Endpoint `json:"internalKubeAPIServer,omitempty"` // KubeAPIServer is the discovered external address of the kube-apiserver (relies on Gardener shoot-info) KubeAPIServer *Endpoint `json:"kubeAPIServer,omitempty"` }
func LoadClusterConfig ¶
func LoadClusterConfig(configFile string) (*ClusterConfig, error)
type Endpoint ¶
type K8sExporterConfig ¶
type K8sExporterConfig struct { // Enabled if true, the K8s exporter is active and patches the node conditions periodically. Enabled bool `json:"enabled"` // HeartbeatPeriod defines the update frequency of the node conditions. HeartbeatPeriod *metav1.Duration `json:"heartbeatPeriod,omitempty"` MinFailingPeerNodeShare float64 `json:"minFailingPeerNodeShare,omitempty"` }
type NetworkConfig ¶
type NetworkConfig struct { // DataFilePrefix is the prefix for observation data files. DataFilePrefix string `json:"dataFilePrefix,omitempty"` // HTTPPort is the port of the http server. HTTPPort int `json:"httpPort,omitempty"` // Jobs are the jobs to execute. Jobs []Job `json:"jobs,omitempty"` // DefaultPeriod is the period used for a new job if it doesn't specify the period. DefaultPeriod metav1.Duration `json:"defaultPeriod,omitempty"` }
type NodeSampleStore ¶
NodeSampleStore maps all known hostnames to a random number [0.0, 1.0). It allows to keep node samples as stable as possible after adding or removing nodes.
func NewNodeSampleStore ¶
func NewNodeSampleStore(nodeName string) *NodeSampleStore
NewNodeSampleStore create a new node sample store.
func (*NodeSampleStore) SelectTopNodes ¶
func (s *NodeSampleStore) SelectTopNodes(hostnames map[string]struct{}, size int) map[string]struct{}
SelectTopNodes selects a stable nodes sample of the given size.
type PodEndpoint ¶
type PodEndpoint struct { Nodename string `json:"nodename"` Podname string `json:"podname"` PodIP string `json:"podIP"` Port int32 `json:"port"` }
func (PodEndpoint) DestHost ¶
func (e PodEndpoint) DestHost() string
type SampleConfig ¶
type SampleConfig struct { // MaxNodes is the maximum number of sample nodes. If 0, all nodes are selected MaxNodes int // NodeSampleStore stores node hostnames with floating index for stable sample selection NodeSampleStore *NodeSampleStore }
SampleConfig holds configuration and state for node sample.
func (*SampleConfig) ShuffledSample ¶
func (sc *SampleConfig) ShuffledSample(cc ClusterConfig) ClusterConfig
ShuffledSample selects a node sample and shuffles its order.
type WithDestHost ¶
type WithDestHost interface {
DestHost() string
}
Click to show internal directories.
Click to hide internal directories.