collection

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 24 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

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 Capture

func Capture(c HostCaptureConfiguration, localDDCPath, localDDCYamlPath, outputLoc string, skipRESTCollect bool, disableFreeSpaceCheck bool) (int64, string, error)

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.

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(mask bool, conf HostCaptureConfiguration, command []string) (string, error)

Adds the sudo part into the HostExecute call

func ComposeExecuteAndStream

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

Adds the sudo part into the HostExecute call

func ComposeExecuteNoSudo

func ComposeExecuteNoSudo(mask bool, 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([]string)) error

func ExtractTarGz

func ExtractTarGz(gzFilePath, dest string) error

func FindClusterID added in v0.8.0

func FindClusterID(outputDir string) (clusterStatsList []clusterstats.ClusterStats, err error)

func GetClusterLogs added in v0.6.0

func GetClusterLogs(namespace string, cs CopyStrategy, ddfs helpers.Filesystem, k string, pods []string) error

func GetClusterNodes added in v0.8.1

func GetClusterNodes(namespace string, cs CopyStrategy, ddfs helpers.Filesystem, k string) error

func GetClusterPods added in v0.9.0

func GetClusterPods(namespace string, cs CopyStrategy, ddfs helpers.Filesystem, k 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
	DremioPAT             string
	TransferDir           string
	DDCYamlLoc            string
	Disabled              []string
	Enabled               []string
	DisableFreeSpaceCheck bool
}

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(mask bool, hostString string, isCoordinator bool, args ...string) (stdOut string, err error)
	HostExecuteAndStream(mask bool, hostString string, output cli.OutputHandler, isCoordinator bool, args ...string) error
	HelpText() string
	Name() string
}

type CopyStrategy

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

type FindErr

type FindErr struct {
	Cmd string
}

func (FindErr) Error

func (fe FindErr) Error() string

type HostCaptureConfiguration

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

type NodeCaptureStats added in v0.8.0

type NodeCaptureStats struct {
	// contains filtered or unexported fields
}

NodeCaptureStats represents stats for a node capture.

func (*NodeCaptureStats) Update added in v0.8.0

func (n *NodeCaptureStats) Update(node string, secondsElapsed int, status string)

Update updates the NodeCaptureStats fields in a thread-safe manner.

type Stats added in v0.8.0

type Stats struct {
	TransfersComplete int
	// contains filtered or unexported fields
}

Stats represents stats for a collection.

var CollectionStatsGlobal *Stats

func (*Stats) PrintState added in v0.8.0

func (c *Stats) PrintState()

func (*Stats) UpdateDDCVersion added in v0.8.0

func (c *Stats) UpdateDDCVersion(ddcVersion, logFile, ddcYaml, collectionType string, ddcYamlIsValid bool, transfersComplete, totalTransfers int)

Update updates the CollectionStats fields in a thread-safe manner.

func (*Stats) UpdateNodeState added in v0.8.0

func (c *Stats) UpdateNodeState(node string, secondsElapsed int, status string)

Update updates the CollectionStats fields in a thread-safe manner.

type SummaryInfo

type SummaryInfo struct {
	ClusterInfo         ClusterInfo             `json:"clusterInfo"`
	CollectedFiles      []helpers.CollectedFile `json:"collectedFiles"`
	FailedFiles         []string                `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"`
	DremioVersion       map[string]string       `json:"dremioVersion"`
	ClusterID           map[string]string       `json:"clusterID"`
	DDCVersion          string                  `json:"ddcVersion"`
	CollectionsEnabled  []string                `json:"collectionsEnabled"`
	CollectionsDisabled []string                `json:"collectionsDisabled"`
}

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