types

package
v0.30.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 10 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 DefaultWatchLifecycleTasks = []LifecycleTask{
	{
		Message: &MessageOptions{"Starting support bundle collection..."},
	},
	{
		Generate: &GenerateOptions{UseDefaults: true},
	},
	{
		Upload: &UploadOptions{},
	},
	{
		Message: &MessageOptions{"Upload complete! Visit the Troubleshoot page in Ship to view the results"},
	},
}
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 ChannelMetaOptions added in v0.23.0

type ChannelMetaOptions struct {
	SpecShared  `json:",inline,omitempty"`
	ChannelID   string `json:"channel_id,omitempty"`
	ChannelName string `json:"channel_name,omitempty"`
}

meta.channel

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"`
}

meta.customer - deprecated

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,omitempty"`
	Labels     []string               `json:"labels,omitempty"`
	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 {
	// no SpecShared as DockerTaskLsOptions includes it already
	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 FileRedactor added in v0.29.0

type FileRedactor func(string) bool

type GenerateOptions

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

type GlobalRedactionOptions added in v0.22.0

type GlobalRedactionOptions struct {
	SpecShared `json:",inline,omitempty"`
	Scrubs     []Scrub  `json:"scrubs,omitempty"`
	Files      []string `json:"files,omitempty"`
}

meta.redact

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 *apiv1.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 Lifecycle added in v0.23.3

type Lifecycle struct {
	V1 []LifecycleTask `json:"v1,omitempty"`
}

Lifecycle is the top level lifecycle object

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 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"`
	Redacted bool   `json:"redacted"`
	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 {
	// no SpecShared as RetracedAPIClientOptions includes it already
	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"`
	SupportBundleGoroutines *SupportBundleGoroutinesOptions `json:"goroutines,omitempty"`
	SupportBundleLogs       *SupportBundleLogsOptions       `json:"logs,omitempty"`
	CustomerMeta            *CustomerMetaOptions            `json:"meta.customer,omitempty"` // deprecated
	ChannelMeta             *ChannelMetaOptions             `json:"meta.channel,omitempty"`
	WatchMeta               *WatchMetaOptions               `json:"meta.watch,omitempty"`

	// undocumented hack to add global redaction
	GlobalRedaction *GlobalRedactionOptions `json:"meta.redact,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

Shared gets the shared stuff for a spec TODO: maybe cache this or something

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"`
	Defer          bool       `json:"defer,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 SupportBundleGoroutinesOptions added in v0.24.0

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

type SupportBundleLogsOptions added in v0.24.0

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

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"`
}

type WatchMetaOptions added in v0.27.0

type WatchMetaOptions struct {
	SpecShared `json:",inline,omitempty"`
	WatchID    string `json:"watch_id,omitempty"`
	WatchName  string `json:"watch_name,omitempty"`
}

meta.watch

Jump to

Keyboard shortcuts

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