types

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLifecycleTasks = []LifecycleTask{
	{
		Message: &MessageOptions{"Starting support bundle collection..."},
	},
	{
		Generate: &GenerateOptions{},
	},
	{
		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{},
	},
	{
		Message: &MessageOptions{"Generation complete!"},
	},
}

Functions

func FiltersToArgs added in v0.5.0

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

Types

type BytesProducer

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

type BytesScrubber

type BytesScrubber func([]byte) []byte

type ContainerListOptions added in v0.5.0

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

func (*ContainerListOptions) ToDockerContainerListOptions added in v0.5.0

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

type CoreHTTPRequestOptions added in v0.11.0

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 added in v0.11.0

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

type CoreLoadavgOptions added in v0.11.0

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

type CoreReadFileOptions added in v0.11.0

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

type CoreRunCommandOptions added in v0.11.0

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 added in v0.11.0

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

type CustomerMetaOptions added in v0.11.0

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 {
	Specs     []Spec          `json:"specs,omitempty"`
	Lifecycle []LifecycleTask `json:"lifecycle,omitempty"`
}

type DockerContainerCpOptions added in v0.11.0

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

type DockerContainerExecOptions added in v0.11.0

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

type DockerContainerInspectOptions added in v0.2.0

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

type DockerContainerLogsOptions added in v0.2.0

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 added in v0.11.0

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

type DockerContainerRunOptions added in v0.11.0

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

type DockerImageLsOptions added in v0.11.0

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

type DockerInfoOptions added in v0.11.0

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

type DockerNodeLsOptions added in v0.11.0

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

type DockerServiceLogsOptions added in v0.11.0

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 added in v0.11.0

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

type DockerServicePsOptions added in v0.11.0

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

type DockerStackServiceLogsOptions added in v0.11.0

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

type DockerStackServiceLsOptions added in v0.11.0

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

type DockerStackServicePsOptions added in v0.11.0

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

type DockerStackTaskLogsOptions added in v0.11.0

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

type DockerTaskLogsOptions added in v0.11.0

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 added in v0.11.0

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

type DockerVersionOptions added in v0.11.0

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

type GenerateOptions added in v0.11.0

type GenerateOptions struct {
}

type ImageListOptions added in v0.11.0

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

func (*ImageListOptions) ToDockerImageListOptions added in v0.11.0

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

type JournaldLogsOptions added in v0.11.0

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

type KubernetesAPIVersionsOptions added in v0.11.0

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

type KubernetesClusterInfoOptions added in v0.11.0

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

type KubernetesLogsOptions added in v0.11.0

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

type KubernetesResourceListOptions added in v0.11.0

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

type KubernetesVersionOptions added in v0.11.0

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

type LifecycleTask added in v0.11.0

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

type MessageOptions added in v0.11.0

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

type Meta added in v0.11.0

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

type NodeListOptions added in v0.11.0

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

func (*NodeListOptions) ToDockerNodeListOptions added in v0.11.0

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

type Planner

type Planner func(Spec) []Task

type Plugin

type Plugin interface {
	Plan(Spec) Planner
}

type PodLogOptions added in v0.11.0

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 added in v0.11.0

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 added in v0.11.0

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 added in v0.3.1

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 added in v0.11.0

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

func (*ServiceListOptions) ToDockerServiceListOptions added in v0.11.0

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"`
	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 added in v0.11.0

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 added in v0.11.0

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"`
	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 added in v0.11.0

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

type Task

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

type TaskListOptions added in v0.11.0

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

func (*TaskListOptions) ToDockerTaskListOptions added in v0.11.0

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

type UploadOptions added in v0.11.0

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