types

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLifecycleTasks = []LifecycleTask{
	{
		Message: &MessageOptions{"Starting support bundle collection..."},
	},
	{
		Notes: &NotesOptions{
			Prompt: "Enter a note: ",
		},
	},
	{
		Generate: &GenerateOptions{UseDefaults: true},
	},
	{
		Upload: &UploadOptions{},
	},
	{
		Message: &MessageOptions{"Upload complete! Check the analyzed bundle for more information"},
	},
}
View Source
var GenerateOnlyLifecycleTasks = []LifecycleTask{
	{
		Message: &MessageOptions{"Starting support bundle collection..."},
	},
	{
		Generate: &GenerateOptions{UseDefaults: true},
	},
	{
		Message: &MessageOptions{"Generation complete!"},
	},
}

Functions

func FiltersToArgs

func FiltersToArgs(f map[string][]string) filters.Args

func GetUseDefaults

func GetUseDefaults(tasks []LifecycleTask) bool

Types

type BytesProducer

type BytesProducer func(context.Context) ([]byte, error)

type BytesScrubber

type BytesScrubber func([]byte) []byte

type Collect added in v0.19.0

type Collect struct {
	V1 []Spec `json:"v1,omitempty"`
}

Collect is the top level collect object

type ContainerListOptions

type ContainerListOptions struct {
	Quiet   bool
	Size    bool
	All     bool
	Latest  bool
	Since   string
	Before  string
	Limit   int
	Filters map[string][]string
}

func (*ContainerListOptions) ToDockerContainerListOptions

func (opts *ContainerListOptions) ToDockerContainerListOptions() dockertypes.ContainerListOptions

type CoreHTTPRequestOptions

type CoreHTTPRequestOptions struct {
	SpecShared `json:",inline,omitempty"`
	URL        string              `json:"url"`
	Method     string              `json:"method,omitempty"` // default "get"
	Body       string              `json:"body,omitempty"`
	Header     map[string][]string `json:"header,omitempty"`
	Insecure   bool                `json:"insecure,omitempty"`
}

type CoreHostnameOptions

type CoreHostnameOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type CoreLoadavgOptions

type CoreLoadavgOptions struct {
	SpecShared `json:",inline,omitempty"`
	Template   string `json:"template"`
}

type CoreReadFileOptions

type CoreReadFileOptions struct {
	SpecShared `json:",inline,omitempty"`
	Filepath   string `json:"filepath"`
}

type CoreRunCommandOptions

type CoreRunCommandOptions struct {
	SpecShared `json:",inline,omitempty"`
	Name       string   `json:"name"`
	Args       []string `json:"args,omitempty"`
	Env        []string `json:"env,omitempty"`
	Dir        string   `json:"dir,omitempty"`
}

type CoreUptimeOptions

type CoreUptimeOptions struct {
	SpecShared `json:",inline,omitempty"`
	Template   string `json:"template"`
}

type CustomerMetaOptions

type CustomerMetaOptions struct {
	SpecShared     `json:",inline,omitempty"`
	CustomerID     string `json:"customer_id,omitempty"`
	InstallationID string `json:"installation_id,omitempty"`
	CustomerName   string `json:"customer_name,omitempty"`
}

type Doc

type Doc struct {
	Collect   Collect         `json:"collect,omitempty"`
	Lifecycle []LifecycleTask `json:"lifecycle,omitempty"`
}

func (*Doc) UnmarshalJSON added in v0.19.0

func (d *Doc) UnmarshalJSON(data []byte) error

type DockerContainerCpOptions

type DockerContainerCpOptions struct {
	SpecShared `json:",inline,omitempty"`
	Container  string   `json:"container,omitempty"`
	SrcPath    string   `json:"src_path,omitempty"`
	Labels     []string `json:"labels,omitempty"`
}

type DockerContainerExecOptions

type DockerContainerExecOptions struct {
	SpecShared `json:",inline,omitempty"`
	Container  string                 `json:"container"`
	ExecConfig dockertypes.ExecConfig `json:"exec_config"`
}

type DockerContainerInspectOptions

type DockerContainerInspectOptions struct {
	SpecShared           `json:",inline,omitempty"`
	Container            string                `json:"container,omitempty"`
	ContainerListOptions *ContainerListOptions `json:"container_list_options,omitempty"`
}

type DockerContainerLogsOptions

type DockerContainerLogsOptions struct {
	SpecShared           `json:",inline,omitempty"`
	Container            string                            `json:"container,omitempty"`
	ContainerLogsOptions *dockertypes.ContainerLogsOptions `json:"container_logs_options,omitempty"`
	ContainerListOptions *ContainerListOptions             `json:"container_list_options,omitempty"`
}

type DockerContainerLsOptions

type DockerContainerLsOptions struct {
	SpecShared           `json:",inline,omitempty"`
	ContainerListOptions `json:",inline,omitempty"`
}

type DockerContainerRunOptions

type DockerContainerRunOptions struct {
	SpecShared            `json:",inline,omitempty"`
	ContainerCreateConfig dockertypes.ContainerCreateConfig `json:"container_create_config"`
	EnablePull            bool                              `json:"enable_pull,omitempty"`
}

type DockerImageLsOptions

type DockerImageLsOptions struct {
	SpecShared       `json:",inline,omitempty"`
	ImageListOptions `json:",inline,omitempty"`
}

type DockerInfoOptions

type DockerInfoOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type DockerNodeLsOptions

type DockerNodeLsOptions struct {
	SpecShared      `json:",inline,omitempty"`
	NodeListOptions `json:",inline,omitempty"`
}

type DockerServiceLogsOptions

type DockerServiceLogsOptions struct {
	SpecShared           `json:",inline,omitempty"`
	Service              string                            `json:"service,omitempty"`
	ContainerLogsOptions *dockertypes.ContainerLogsOptions `json:"container_logs_options,omitempty"`
	ServiceListOptions   *ServiceListOptions               `json:"service_list_options,omitempty"`
}

type DockerServiceLsOptions

type DockerServiceLsOptions struct {
	SpecShared         `json:",inline,omitempty"`
	ServiceListOptions `json:",inline,omitempty"`
}

type DockerServicePsOptions

type DockerServicePsOptions struct {
	SpecShared          `json:",inline,omitempty"`
	DockerTaskLsOptions `json:",inline,omitempty"`
}

type DockerStackServiceLogsOptions

type DockerStackServiceLogsOptions struct {
	SpecShared             `json:",inline,omitempty"`
	LabelsFilter           `json:",inline,omitempty"`
	Namespace              string                            `json:"namespace"`
	ContainerLogsOptions   *dockertypes.ContainerLogsOptions `json:"container_logs_options,omitempty"`
	DockerServiceLsOptions *DockerServiceLsOptions           `json:"service_list_options,omitempty"`
}

type DockerStackServiceLsOptions

type DockerStackServiceLsOptions struct {
	SpecShared             `json:",inline,omitempty"`
	Namespace              string                  `json:"namespace"`
	DockerServiceLsOptions *DockerServiceLsOptions `json:"service_list_options,omitempty"`
}

type DockerStackServicePsOptions

type DockerStackServicePsOptions struct {
	SpecShared             `json:",inline,omitempty"`
	Namespace              string                  `json:"namespace"`
	DockerServicePsOptions *DockerServicePsOptions `json:"task_list_options,omitempty"`
}

type DockerStackTaskLogsOptions

type DockerStackTaskLogsOptions struct {
	SpecShared             `json:",inline,omitempty"`
	LabelsFilter           `json:",inline,omitempty"`
	Namespace              string                            `json:"namespace"`
	ContainerLogsOptions   *dockertypes.ContainerLogsOptions `json:"container_logs_options,omitempty"`
	DockerServicePsOptions *DockerServicePsOptions           `json:"task_list_options,omitempty"`
}

type DockerTaskLogsOptions

type DockerTaskLogsOptions struct {
	SpecShared           `json:",inline,omitempty"`
	ID                   string                            `json:"id,omitempty"`
	ContainerLogsOptions *dockertypes.ContainerLogsOptions `json:"container_logs_options,omitempty"`
	TaskListOptions      *TaskListOptions                  `json:"task_list_options,omitempty"`
}

type DockerTaskLsOptions

type DockerTaskLsOptions struct {
	SpecShared      `json:",inline,omitempty"`
	TaskListOptions `json:",inline,omitempty"`
}

type DockerVersionOptions

type DockerVersionOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type GenerateOptions

type GenerateOptions struct {
	UseDefaults bool `json:"use_defaults,omitempty"`
}

type ImageListOptions

type ImageListOptions struct {
	All     bool
	Filters map[string][]string
}

func (*ImageListOptions) ToDockerImageListOptions

func (opts *ImageListOptions) ToDockerImageListOptions() dockertypes.ImageListOptions

type JournaldLogsOptions

type JournaldLogsOptions struct {
	SpecShared `json:",inline,omitempty"`
	Unit       string `json:"unit,omitempty"`
	Since      string `json:"since,omitempty"`
	Reverse    bool   `json:"reverse,omitempty"`
}

type KubernetesAPIVersionsOptions

type KubernetesAPIVersionsOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type KubernetesClusterInfoOptions

type KubernetesClusterInfoOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type KubernetesContainerCpOptions

type KubernetesContainerCpOptions struct {
	SpecShared     `json:",inline,omitempty"`
	Pod            string              `json:"pod,omitempty"`
	PodListOptions *metav1.ListOptions `json:"pod_list_options,omitempty"`
	Container      string              `json:"container,omitempty"`
	Namespace      string              `json:"namespace,omitempty"`
	SrcPath        string              `json:"src_path,omitempty"`
}

type KubernetesLogsOptions

type KubernetesLogsOptions struct {
	SpecShared    `json:",inline,omitempty"`
	Pod           string              `json:"pod,omitempty"`
	Namespace     string              `json:"namespace,omitempty"`
	PodLogOptions *PodLogOptions      `json:"pod_log_options,omitempty"`
	ListOptions   *metav1.ListOptions `json:"list_options,omitempty"`
}

type KubernetesResourceListOptions

type KubernetesResourceListOptions struct {
	SpecShared   `json:",inline,omitempty"`
	Kind         string              `json:"kind"`
	GroupVersion string              `json:"group_version,omitempty"`
	Namespace    string              `json:"namespace,omitempty"`
	ListOptions  *metav1.ListOptions `json:"resource_list_options,omitempty"`
}

type KubernetesVersionOptions

type KubernetesVersionOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type LabelsFilter

type LabelsFilter struct {
	Labels map[string]string `json:"labels,omitempty"`
}

type LifecycleTask

type LifecycleTask struct {
	Generate *GenerateOptions `json:"generate,omitempty"`
	Message  *MessageOptions  `json:"message,omitempty"`
	Notes    *NotesOptions    `json:"notes,omitempty"`
	Upload   *UploadOptions   `json:"upload,omitempty"`
}

type MessageOptions

type MessageOptions struct {
	Contents string `json:"contents,omitempty"`
}

type NodeListOptions

type NodeListOptions struct {
	Filters map[string][]string
}

func (*NodeListOptions) ToDockerNodeListOptions

func (opts *NodeListOptions) ToDockerNodeListOptions() dockertypes.NodeListOptions

type NotesOptions

type NotesOptions struct {
	Prompt string `json:"prompt,omitempty"`
}

type Planner

type Planner func(Spec) []Task

type Plugin

type Plugin interface {
	Plan(Spec) Planner
}

type PodLogOptions

type PodLogOptions struct {
	metav1.TypeMeta `json:",inline"`

	// The container for which to stream logs. Defaults to only container if there is one container in the pod.
	// +optional
	Container string `json:"container,omitempty" protobuf:"bytes,1,opt,name=container"`
	// Follow the log stream of the pod. Defaults to false.
	// +optional
	Follow bool `json:"follow,omitempty" protobuf:"varint,2,opt,name=follow"`
	// Return previous terminated container logs. Defaults to false.
	// +optional
	Previous bool `json:"previous,omitempty" protobuf:"varint,3,opt,name=previous"`
	// A relative time in seconds before the current time from which to show logs. If this value
	// precedes the time a pod was started, only logs since the pod start will be returned.
	// If this value is in the future, no logs will be returned.
	// Only one of sinceSeconds or sinceTime may be specified.
	// +optional
	SinceSeconds *int64 `json:"sinceSeconds,omitempty" protobuf:"varint,4,opt,name=sinceSeconds"`
	// An RFC3339 timestamp from which to show logs. If this value
	// precedes the time a pod was started, only logs since the pod start will be returned.
	// If this value is in the future, no logs will be returned.
	// Only one of sinceSeconds or sinceTime may be specified.
	// +optional
	SinceTime *metav1.Time `json:"sinceTime,omitempty" protobuf:"bytes,5,opt,name=sinceTime"`
	// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
	// of log output. Defaults to false.
	// +optional
	Timestamps bool `json:"timestamps,omitempty" protobuf:"varint,6,opt,name=timestamps"`
	// If set, the number of lines from the end of the logs to show. If not specified,
	// logs are shown from the creation of the container or sinceSeconds or sinceTime
	// +optional
	TailLines *int64 `json:"tailLines,omitempty" protobuf:"varint,7,opt,name=tailLines"`
	// If set, the number of bytes to read from the server before terminating the
	// log output. This may not display a complete final line of logging, and may return
	// slightly more or slightly less than the specified limit.
	// +optional
	LimitBytes *int64 `json:"limitBytes,omitempty" protobuf:"varint,8,opt,name=limitBytes"`
}

PodLogOptions is the query options for a Pod's logs REST call.

type PromptOptions

type PromptOptions struct {
	Message        string `json:"message,omitempty"`
	Default        bool   `json:"default,omitempty"`
	AcceptMessage  string `json:"accept,omitempty"`
	DeclineMessage string `json:"decline,omitempty"`
}

type Result

type Result struct {
	// The subpath within the bundle
	Path   string `json:"path"`
	Format string `json:"format"`
	Size   int64  `json:"size"`
	Spec   Spec   `json:"spec"`
	Error  error  `json:"error,omitempty"`
}

Result represents a single file within a support bundle or the failure to collect the data for a single file within a support bundle. A Result may have both a Pathname and an Error if the file written was corrupted or incomplete.

func (*Result) MarshalJSON

func (r *Result) MarshalJSON() ([]byte, error)

MarshalJSON .Error will be {} if it has no exported fields, so replace it with a string.

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(raw []byte) error

UnmarshalJSON will convert .Error from string to error

type RetracedAPIClientOptions

type RetracedAPIClientOptions struct {
	SpecShared  `json:",inline,omitempty"`
	APIEndpoint string `json:"api_endpoint"`
	ProjectID   string `json:"project_id,omitempty"`
	APIToken    string `json:"api_token,omitempty"`
	Insecure    bool   `json:"insecure,omitempty"`
}

type RetracedEventsOptions

type RetracedEventsOptions struct {
	SpecShared               `json:",inline,omitempty"`
	RetracedAPIClientOptions `json:",inline"`
	Mask                     *retraced.EventNodeMask   `json:"mask,omitempty"`
	Query                    *retraced.StructuredQuery `json:"query,omitempty"`
}

type Scrub

type Scrub struct {
	Regex   string `json:"regex"`
	Replace string `json:"replace"`
}

type ServiceListOptions

type ServiceListOptions struct {
	Filters map[string][]string
}

func (*ServiceListOptions) ToDockerServiceListOptions

func (opts *ServiceListOptions) ToDockerServiceListOptions() dockertypes.ServiceListOptions

type Spec

type Spec struct {
	SpecShared `json:",inline"`

	SupportBundleVersion *SupportBundleVersionOptions `json:"version,omitempty"`
	CustomerMeta         *CustomerMetaOptions         `json:"meta.customer,omitempty"`

	// CoreHostname gets the hostname of the machine on which we're running
	CoreHostname    *CoreHostnameOptions    `json:"os.hostname,omitempty"`
	CoreHTTPRequest *CoreHTTPRequestOptions `json:"os.http-request,omitempty"`
	CoreLoadavg     *CoreLoadavgOptions     `json:"os.loadavg,omitempty"`
	CoreReadFile    *CoreReadFileOptions    `json:"os.read-file,omitempty"`
	CoreRunCommand  *CoreRunCommandOptions  `json:"os.run-command,omitempty"`
	CoreUptime      *CoreUptimeOptions      `json:"os.uptime,omitempty"`

	JournaldLogs *JournaldLogsOptions `json:"journald.logs,omitempty"`

	// DockerContainerCp copies a file from a running docker container
	DockerContainerCp      *DockerContainerCpOptions      `json:"docker.container-cp,omitempty"`
	DockerContainerExec    *DockerContainerExecOptions    `json:"docker.container-exec,omitempty"`
	DockerContainerInspect *DockerContainerInspectOptions `json:"docker.container-inspect,omitempty"`
	DockerContainerLogs    *DockerContainerLogsOptions    `json:"docker.container-logs,omitempty"`
	DockerContainerLs      *DockerContainerLsOptions      `json:"docker.container-ls,omitempty"`
	DockerContainerRun     *DockerContainerRunOptions     `json:"docker.container-run,omitempty"`
	DockerExec             *DockerContainerExecOptions    `json:"docker.exec,omitempty"` // canonical: docker.container-exec
	DockerImageLs          *DockerImageLsOptions          `json:"docker.image-ls,omitempty"`
	DockerImages           *DockerImageLsOptions          `json:"docker.images,omitempty"` // canonical: docker.image-ls
	DockerInfo             *DockerInfoOptions             `json:"docker.info,omitempty"`
	// TODO: docker.inspect
	DockerLogs             *DockerContainerLogsOptions    `json:"docker.logs,omitempty"` // canonical: docker.container-logs
	DockerNodeLs           *DockerNodeLsOptions           `json:"docker.node-ls,omitempty"`
	DockerPs               *DockerContainerLsOptions      `json:"docker.ps,omitempty"`  // canonical: docker.container-ls
	DockerRun              *DockerContainerRunOptions     `json:"docker.run,omitempty"` // canonical: docker.container-run
	DockerServiceLogs      *DockerServiceLogsOptions      `json:"docker.service-logs,omitempty"`
	DockerServiceLs        *DockerServiceLsOptions        `json:"docker.service-ls,omitempty"`
	DockerServicePs        *DockerServicePsOptions        `json:"docker.service-ps,omitempty"`
	DockerStackServiceLogs *DockerStackServiceLogsOptions `json:"docker.stack-service-logs,omitempty"`
	DockerStackServiceLs   *DockerStackServiceLsOptions   `json:"docker.stack-service-ls,omitempty"`
	DockerStackServicePs   *DockerStackServicePsOptions   `json:"docker.stack-service-ps,omitempty"`
	DockerStackTaskLogs    *DockerStackTaskLogsOptions    `json:"docker.stack-task-logs,omitempty"`
	DockerTaskLogs         *DockerTaskLogsOptions         `json:"docker.task-logs,omitempty"`
	DockerTaskLs           *DockerTaskLsOptions           `json:"docker.task-ls,omitempty"`
	DockerVersion          *DockerVersionOptions          `json:"docker.version,omitempty"`

	KubernetesAPIVersions  *KubernetesAPIVersionsOptions  `json:"kubernetes.api-versions,omitempty"`
	KubernetesClusterInfo  *KubernetesClusterInfoOptions  `json:"kubernetes.cluster-info,omitempty"`
	KubernetesContainerCp  *KubernetesContainerCpOptions  `json:"kubernetes.container-cp,omitempty"`
	KubernetesLogs         *KubernetesLogsOptions         `json:"kubernetes.logs,omitempty"`
	KubernetesResourceList *KubernetesResourceListOptions `json:"kubernetes.resource-list,omitempty"`
	KubernetesVersion      *KubernetesVersionOptions      `json:"kubernetes.version,omitempty"`

	RetracedEvents *RetracedEventsOptions `json:"retraced.events,omitempty"`
}

func (*Spec) Shared

func (s *Spec) Shared() SpecShared

Todo maybe cache this or something this gets the shared stuff for a spec

ideally we want to move to

- docker.container-inspect:
    container_name: ...
    output_dir: ...
    description: ...

but for now its more like

- docker.container-inspect:
    container_name: ...
  output_dir: ...
  description: ...

This method allows you to use either or both,
giving priority to the first, nested version

i.e. if you have

- docker.container-inspect:
    output_dir: /foo
  output_dir: /bar

then /foo will be used

type SpecShared

type SpecShared struct {
	// Description describes this spec field
	Description    string     `json:"description,omitempty"`
	OutputDir      string     `json:"output_dir,omitempty"`
	TimeoutSeconds int        `json:"timeout_seconds,omitempty"`
	Scrub          *Scrub     `json:"scrub,omitempty"`
	IncludeEmpty   bool       `json:"include_empty,omitempty"`
	Meta           *meta.Meta `json:"meta,omitempty"`
}

type StreamProducer

type StreamProducer func(context.Context) (io.Reader, error)

type StreamsProducer

type StreamsProducer func(context.Context) (map[string]io.Reader, error)

probably stdout and stderr

type StructuredProducer

type StructuredProducer func(context.Context) (interface{}, error)

type SupportBundleVersionOptions

type SupportBundleVersionOptions struct {
	SpecShared `json:",inline,omitempty"`
}

type Task

type Task interface {
	Exec(ctx context.Context, rootDir string) []*Result
	GetSpec() Spec
}

type TaskListOptions

type TaskListOptions struct {
	Filters map[string][]string
}

func (*TaskListOptions) ToDockerTaskListOptions

func (opts *TaskListOptions) ToDockerTaskListOptions() dockertypes.TaskListOptions

type UploadOptions

type UploadOptions struct {
	Prompt *PromptOptions `json:"prompt,omitempty"`
}

Jump to

Keyboard shortcuts

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