func DumpAllNamespaceInfo(ctx context.Context, c clientset.Interface, namespace string)
DumpAllNamespaceInfo dumps events, pods and nodes information in the given namespace.
func DumpNodeDebugInfo(ctx context.Context, c clientset.Interface, nodeNames []string, logFunc func(fmt string, args ...interface{}))
DumpNodeDebugInfo dumps debug information of the given nodes.
ContainerResourceGatherer is a struct for gathering container resource.
type ContainerResourceGatherer struct {
// contains filtered or unexported fields
}
func NewResourceUsageGatherer(ctx context.Context, c clientset.Interface, options ResourceGathererOptions, pods *v1.PodList) (*ContainerResourceGatherer, error)
NewResourceUsageGatherer returns a new ContainerResourceGatherer.
func (g *ContainerResourceGatherer) StartGatheringData(ctx context.Context)
StartGatheringData starts a stat gathering worker blocks for each node to track, and blocks until StopAndSummarize is called.
func (g *ContainerResourceGatherer) StopAndSummarize(percentiles []int, constraints map[string]ResourceConstraint) (*ResourceUsageSummary, error)
StopAndSummarize stops stat gathering workers, processes the collected stats, generates resource summary for the passed-in percentiles, and returns the summary. It returns an error if the resource usage at any percentile is beyond the specified resource constraints.
ContainerResourceUsage is a structure for gathering container resource usage.
type ContainerResourceUsage struct { Name string Timestamp time.Time CPUUsageInCores float64 MemoryUsageInBytes uint64 MemoryWorkingSetInBytes uint64 MemoryRSSInBytes uint64 // The interval used to calculate CPUUsageInCores. CPUInterval time.Duration }
EventsLister is a func that lists events.
type EventsLister func(opts metav1.ListOptions, ns string) (*v1.EventList, error)
LogSizeDataTimeseries is map of timestamped size.
type LogSizeDataTimeseries map[string]map[string][]TimestampedSize
LogSizeGatherer is a worker which grabs a WorkItem from the channel and does assigned work.
type LogSizeGatherer struct {
// contains filtered or unexported fields
}
func (g *LogSizeGatherer) Run(ctx context.Context)
Run starts log size gathering.
func (g *LogSizeGatherer) Work(ctx context.Context) bool
Work does a single unit of work: tries to take out a WorkItem from the queue, ssh-es into a given machine, gathers data, writes it to the shared <data> map, and creates a gorouting which reinserts work item into the queue with a <pollingPeriod> delay. Returns false if worker should exit.
LogsSizeData is a structure for handling timeseries of log size data and lock.
type LogsSizeData struct {
// contains filtered or unexported fields
}
LogsSizeDataSummary is map of log summary. node -> file -> data
type LogsSizeDataSummary map[string]map[string]SingleLogSummary
func (s *LogsSizeDataSummary) PrintHumanReadable() string
PrintHumanReadable returns string of log size data summary. TODO: make sure that we don't need locking here
func (s *LogsSizeDataSummary) PrintJSON() string
PrintJSON returns the summary of log size data with JSON format.
func (s *LogsSizeDataSummary) SummaryKind() string
SummaryKind returns the summary of log size data summary.
LogsSizeVerifier gathers data about log files sizes from master and node machines. It oversees a <workersNo> workers which do the gathering.
type LogsSizeVerifier struct {
// contains filtered or unexported fields
}
func NewLogsVerifier(ctx context.Context, c clientset.Interface) *LogsSizeVerifier
NewLogsVerifier creates a new LogsSizeVerifier which will stop when stopChannel is closed
func (s *LogsSizeVerifier) GetSummary() *LogsSizeDataSummary
GetSummary returns a summary (average generation rate and number of probes) of the data gathered by LogSizeVerifier
func (s *LogsSizeVerifier) Run(ctx context.Context)
Run starts log size gathering. It starts a gorouting for every worker and then blocks until stopChannel is closed
NodesSet is a value of nodes set.
type NodesSet int
const ( // AllNodes means all containers on all nodes. AllNodes NodesSet = 0 // MasterNodes means all containers on Master nodes only. MasterNodes NodesSet = 1 // MasterAndDNSNodes means all containers on Master nodes and DNS containers on other nodes. MasterAndDNSNodes NodesSet = 2 )
ResourceConstraint is a struct to hold constraints.
type ResourceConstraint struct { CPUConstraint float64 MemoryConstraint uint64 }
ResourceGathererOptions is a struct to hold options for resource.
type ResourceGathererOptions struct { InKubemark bool Nodes NodesSet ResourceDataGatheringPeriod time.Duration ProbeDuration time.Duration PrintVerboseLogs bool }
ResourceUsagePerContainer is map of ContainerResourceUsage
type ResourceUsagePerContainer map[string]*ContainerResourceUsage
ResourceUsageSummary is a struct to hold resource usage summary. we can't have int here, as JSON does not accept integer keys.
type ResourceUsageSummary map[string][]SingleContainerSummary
func (s *ResourceUsageSummary) PrintHumanReadable() string
PrintHumanReadable prints resource usage summary in human readable.
func (s *ResourceUsageSummary) PrintJSON() string
PrintJSON prints resource usage summary in JSON.
func (s *ResourceUsageSummary) SummaryKind() string
SummaryKind returns string of ResourceUsageSummary
SingleContainerSummary is a struct to hold single container summary.
type SingleContainerSummary struct { Name string CPU float64 Mem uint64 }
SingleLogSummary is a structure for handling average generation rate and number of probes.
type SingleLogSummary struct { AverageGenerationRate int NumberOfProbes int }
TimestampedSize contains a size together with a time of measurement.
type TimestampedSize struct {
// contains filtered or unexported fields
}
WorkItem is a command for a worker that contains an IP of machine from which we want to gather data and paths to all files we're interested in.
type WorkItem struct {
// contains filtered or unexported fields
}