reproducer

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, version string, args ...string) error

func QName

func QName(obj kates.Object) string

Types

type Extraction

type Extraction struct {
	ExtractionLog []*LogEntry           // A log of the extraction process itsef.
	Snapshots     map[string][]byte     // Snapshots from all pods in the cluster.
	Resources     []*kates.Unstructured // Interesting resources in the cluster that may not be included in snapshots.
	Environ       map[string]string     // Capture the environment if we are invoked in the cluster.
	// contains filtered or unexported fields
}

func NewExtraction

func NewExtraction(client *kates.Client) *Extraction

func (*Extraction) CaptureEnviron

func (ex *Extraction) CaptureEnviron(ctx context.Context)

CaptureEnviron captures the environment while redacting any secrets.

func (*Extraction) CaptureLogs

func (ex *Extraction) CaptureLogs(ctx context.Context, pods []*kates.Pod) func() PodLogs

CaptureLogs will capture the current and previous logs from all the listed pods. It operates asynchronously and returns a function that can be used to access the final result (i.e. a poor mans future).

func (*Extraction) CaptureRemoteSnapshots

func (ex *Extraction) CaptureRemoteSnapshots(ctx context.Context, pods []*kates.Pod) error

CaptureRemoteSnapshots will exec grab-snapshots on all the supplied pods and capture the resulting tarballs.

func (*Extraction) CaptureResources

func (ex *Extraction) CaptureResources(ctx context.Context) error

CaptureResources will capture and sanitize as many resources as permitted by the RBAC of the system account running the extraction. The code is careful to redact both secrets and config maps as well as the enviornment variables of any unrecognized deployments. For ambassador deployments only the environment variables that contain AUTH and/or PASSWORD are redacted.

func (*Extraction) CaptureSnapshot

func (ex *Extraction) CaptureSnapshot(ctx context.Context)

CaptureSnapshot captures the local snapshot if we are in cluster.

func (*Extraction) ListAmbassadorPods

func (ex *Extraction) ListAmbassadorPods(ctx context.Context) []*kates.Pod

ListAmbassadorPods will search the entire cluster for ambassador pods resulting from either a helm based or manifest based install. It does this by using the service=ambassador labeling used by the manifests and the product=aes labeling used by the helm charts. This may get more pods than just edge-stack, e.g. it may pull in the redis logs since they have the product=aes label, but that is ok we would rather grab more debugging info than less.

func (*Extraction) Printf

func (ex *Extraction) Printf(ctx context.Context, format string, args ...interface{})

func (*Extraction) Warnf

func (ex *Extraction) Warnf(ctx context.Context, err error, format string, args ...interface{})

func (*Extraction) WriteArchive

func (ex *Extraction) WriteArchive(ctx context.Context, filename string, podLogs PodLogs) error

WriteArchive saves all the extracted info into a tarball.

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Message   string    `json:"message"`
	Error     error     `json:"error,omitempty"`
}

type PodLogs

type PodLogs = map[string][]kates.LogEvent

type Repro

type Repro struct {
	Resources  map[string][]*kates.Unstructured
	Namespaces map[string]bool
	Ports      map[string]bool
	Processed  []*kates.Unstructured
}

func NewRepro

func NewRepro() *Repro

func (*Repro) Add

func (r *Repro) Add(resource kates.Object) error

Add an input resource from the source cluster.

func (*Repro) Marshal

func (r *Repro) Marshal() ([]byte, error)

func (*Repro) OrderedKinds

func (r *Repro) OrderedKinds() []string

OrderedKinds returns all the k8s kinds in the proper order to avoid dangling references.

func (*Repro) Process

func (r *Repro) Process(ctx context.Context) error

Jump to

Keyboard shortcuts

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