collection

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

collection package provides the interface for collection implementation and the actual collection execution

collection module deals with specific k8s cluster level data collection

collection package provides the interface for collection implementation and the actual collection execution

collection package provides the interface for collection implementation and the actual collection execution

collection package provides the interface for collection implementation and the actual collection execution

Index

Constants

This section is empty.

Variables

View Source
var DirPerms fs.FileMode = 0750

Functions

func ClusterK8sExecute

func ClusterK8sExecute(namespace string, cs CopyStrategy, ddfs helpers.Filesystem, c Collector, k string) error

func ComposeCopy

func ComposeCopy(conf HostCaptureConfiguration, source, destination string) (stdOut string, err error)

Adds the sudo part into the CopyFromHost call

func ComposeCopyNoSudo

func ComposeCopyNoSudo(conf HostCaptureConfiguration, source, destination string) (stdOut string, err error)

Some copy back actions should never change regardless of the sudo user being passed or not

func ComposeCopyTo

func ComposeCopyTo(conf HostCaptureConfiguration, source, destination string) (stdOut string, err error)

Adds the sudo part into the CopyFromHost call

func ComposeExecute

func ComposeExecute(conf HostCaptureConfiguration, command []string) (stdOut string, err error)

Adds the sudo part into the HostExecute call

func ComposeExecuteAndStream

func ComposeExecuteAndStream(conf HostCaptureConfiguration, output cli.OutputHandler, command []string) error

Adds the sudo part into the HostExecute call

func ComposeExecuteNoSudo

func ComposeExecuteNoSudo(conf HostCaptureConfiguration, command []string) (stdOut string, err error)

Some execute actions should never change regardless of the sudo user being passed or not

func Execute

func Execute(c Collector, s CopyStrategy, collectionArgs Args, clusterCollection ...func()) error

func ExtractTarGz

func ExtractTarGz(gzFilePath, dest string) error

func FindTarGzFiles

func FindTarGzFiles(rootDir string) ([]string, error)

func SanitizeArchivePath

func SanitizeArchivePath(d, t string) (v string, err error)

Sanitize archive file pathing from "G305: Zip Slip vulnerability"

Types

type Args

type Args struct {
	DDCfs          helpers.Filesystem
	CoordinatorStr string
	ExecutorsStr   string
	OutputLoc      string
	SudoUser       string
	CopyStrategy   CopyStrategy
}

type ClusterInfo

type ClusterInfo struct {
	NumberNodesContacted int `json:"numberNodesContacted"`
	TotalNodesAttempted  int `json:"totalNodesAttempted"`
}

type Collector

type Collector interface {
	CopyFromHost(hostString string, isCoordinator bool, source, destination string) (out string, err error)
	CopyToHost(hostString string, isCoordinator bool, source, destination string) (out string, err error)
	CopyFromHostSudo(hostString string, isCoordinator bool, sudoUser, source, destination string) (out string, err error)
	CopyToHostSudo(hostString string, isCoordinator bool, sudoUser, source, destination string) (out string, err error)
	FindHosts(searchTerm string) (podName []string, err error)
	HostExecute(hostString string, isCoordinator bool, args ...string) (stdOut string, err error)
	HostExecuteAndStream(hostString string, output cli.OutputHandler, isCoordinator bool, args ...string) error
	HelpText() string
}

type CopyStrategy

type CopyStrategy interface {
	CreatePath(fileType, source, nodeType string) (path string, err error)
	ArchiveDiag(o string, outputLoc string) error
	GetTmpDir() string
}

type FailedFiles

type FailedFiles struct {
	Path string `json:"path"`
	Err  error  `json:"err"`
}

func Capture

func Capture(conf HostCaptureConfiguration, localDDCPath, localDDCYamlPath, outputLoc string, skipRESTCollect bool) (files []helpers.CollectedFile, failedFiles []FailedFiles, skippedFiles []string)

Capture collects diagnostics, conf files and log files from the target hosts. Failures are permissive and are first logged and then returned at the end with the reason for the failure.

type FindErr

type FindErr struct {
	Cmd string
}

func (FindErr) Error

func (fe FindErr) Error() string

type HostCaptureConfiguration

type HostCaptureConfiguration struct {
	NodeCaptureOutput string
	IsCoordinator     bool
	Collector         Collector
	Host              string
	OutputLocation    string
	SudoUser          string
	CopyStrategy      CopyStrategy
	DDCfs             helpers.Filesystem
}

type SummaryInfo

type SummaryInfo struct {
	ClusterInfo         ClusterInfo             `json:"clusterInfo"`
	CollectedFiles      []helpers.CollectedFile `json:"collectedFiles"`
	FailedFiles         []FailedFiles           `json:"failedFiles"`
	SkippedFiles        []string                `json:"skippedFiles"`
	StartTimeUTC        time.Time               `json:"startTimeUTC"`
	EndTimeUTC          time.Time               `json:"endTimeUTC"`
	TotalRuntimeSeconds int64                   `json:"totalRuntimeSeconds"`
	TotalBytesCollected int64                   `json:"totalBytesCollected"`
	Executors           []string                `json:"executors"`
	Coordinators        []string                `json:"coordinators"`
}

func (SummaryInfo) String

func (summary SummaryInfo) String() (string, error)

type SummaryInfoWriterError

type SummaryInfoWriterError struct {
	SummaryInfo SummaryInfo
	Err         error
}

func (SummaryInfoWriterError) Error

func (w SummaryInfoWriterError) Error() string

Jump to

Keyboard shortcuts

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