Documentation

Index

Constants

View Source
const (
	// NSResourceLocation is the place under which namespaced API resources (pods, etc) are stored
	NSResourceLocation = "resources/ns"
	// ClusterResourceLocation is the place under which non-namespaced API resources (nodes, etc) are stored
	ClusterResourceLocation = "resources/cluster"
	// HostsLocation is the place under which host information (configz, healthz) is stored
	HostsLocation = "hosts"
	// MetaLocation is the place under which snapshot metadata (query times, config) is stored
	MetaLocation = "meta"
)
View Source
const (
	// PodLogsLocation is the location within the results tarball where pod
	// information is stored.
	PodLogsLocation = "podlogs"
)

Variables

This section is empty.

Functions

func FilterNamespaces

func FilterNamespaces(kubeClient kubernetes.Interface, filter string) ([]string, error)

FilterNamespaces filter the list of namespaces according to the filter string

func QueryHostData

func QueryHostData(kubeClient kubernetes.Interface, recorder *QueryRecorder, cfg *config.Config) error

QueryHostData gets the host data and records it.

func QueryPodLogs

func QueryPodLogs(kubeClient kubernetes.Interface, recorder *QueryRecorder, ns string, cfg *config.Config,
	visitedPods map[string]struct{}) error

QueryPodLogs gets the pod logs for each pod in the given namespace. If namespace is not provided, get pod logs using field selectors. VisitedPods will eliminate duplicate pods when execute overlapping queries, e.g. query by namespaces and query by fieldSelectors.

func QueryResources

func QueryResources(
	client *dynamic.APIHelper,
	recorder *QueryRecorder,
	resources []schema.GroupVersionResource,
	ns *string,
	cfg *config.Config) error

QueryResources will query all the intended resources. If given a non-nil namespace it queries only namespaced objects; non-namespaced otherwise. Writing them out to <resultsdir>/resources/ns/<ns>/*.json or <resultsdir>/resources/cluster/*.json.

func QueryServerData

func QueryServerData(kubeClient kubernetes.Interface, recorder *QueryRecorder, cfg *config.Config) error

QueryServerData gets the server version and server group data and records it.

func Run

func Run(restConf *rest.Config, cfg *config.Config) (errCount int)

Run is the main entrypoint for discovery.

func SerializeObj

func SerializeObj(obj interface{}, outpath string, file string) error

SerializeObj will write out an object

Types

type QueryData

type QueryData struct {
	QueryObj    string `json:"queryobj,omitempty"`
	Namespace   string `json:"namespace,omitempty"`
	ElapsedTime string `json:"time,omitempty"`
	Error       error  `json:"error,omitempty"`
}

QueryData captures the results of the run for post-processing

type QueryRecorder

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

QueryRecorder records a sequence of queries

func NewQueryRecorder

func NewQueryRecorder() *QueryRecorder

NewQueryRecorder returns a new empty QueryRecorder

func (*QueryRecorder) DumpQueryData

func (q *QueryRecorder) DumpQueryData(filepath string) error

DumpQueryData writes query information out to a file at the give filepath

func (*QueryRecorder) RecordQuery

func (q *QueryRecorder) RecordQuery(name string, namespace string, duration time.Duration, recerr error)

RecordQuery transcribes a query by name, namespace, duration and error

type RunInfo

type RunInfo struct {
	LoadedPlugins []string `json:"plugins,omitempty"`
}