supportbundle

package
v0.123.11 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 54 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SupportBundleNameRegex = regexp.MustCompile(`^\/?support-bundle-(\d{4})-(\d{2})-(\d{2})T(\d{2})_(\d{2})_(\d{2})\/?`)
)

Functions

func AnalyzeSupportBundle

func AnalyzeSupportBundle(ctx context.Context, spec *troubleshootv1beta2.SupportBundleSpec, tmpDir string) ([]*analyzer.AnalyzeResult, error)

AnalyzeSupportBundle performs analysis on a support bundle using the support bundle spec and an already unpacked support bundle on disk

func ConcatSpec added in v0.42.0

ConcatSpec the intention with these appends is to swap them out at a later date with more specific handlers for merging the spec fields

func ExtractAppSlugFromBundle added in v0.123.0

func ExtractAppSlugFromBundle(bundlePath string) (string, error)

ExtractAppSlugFromBundle attempts to extract the app slug from a support bundle by looking in configmaps for appSlug field

func ExtractLicenseFromBundle added in v0.123.0

func ExtractLicenseFromBundle(bundlePath string) (string, string, error)

ExtractLicenseFromBundle extracts the license ID from a support bundle It first looks for cluster-resources/license.json, then falls back to searching cluster-resources/configmaps/* for a license field Returns both the license ID and the app slug

func GetFilesContents added in v0.19.0

func GetFilesContents(bundleArchive string, filenames []string) (map[string][]byte, error)

GetFilesContents will return the file contents for filenames matching the filenames parameter.

func GetPodDetails added in v0.19.0

func GetPodDetails(bundleArchive string, podNamespace string, podName string) (*types.PodDetails, error)

func GetRedactorFromURI

func GetRedactorFromURI(redactorURI string) (*troubleshootv1beta2.Redactor, error)

GetRedactorFromURI parses a redactor from a URI into a Redactor object We will deprecate this in favour of use loader.LoadSpecs once the new API is stable

func GetRedactorsFromURIs added in v0.53.0

func GetRedactorsFromURIs(redactorURIs []string) ([]*troubleshootv1beta2.Redact, error)

GetRedactorsFromURIs parses redactors from a URIs Redactor objects We will deprecate this in favour of use loader.LoadSpecs once the new API is stable

func GetSupportBundleFromURI

func GetSupportBundleFromURI(bundleURI string) (*troubleshootv1beta2.SupportBundle, error)

GetSupportBundleFromURI downloads and parses a support bundle from a URI and returns a SupportBundle object

func LoadRedactorSpec

func LoadRedactorSpec(arg string) ([]byte, error)

func LoadSupportBundleSpec

func LoadSupportBundleSpec(arg string) ([]byte, error)

func ParseRedactorsFromDocs added in v0.47.0

func ParseRedactorsFromDocs(docs []string) ([]*troubleshootv1beta2.Redact, error)

ParseRedactorsFromDocs parses a slice of YAML docs and returns a slice of Redactors We will deprecate this in favour of use loader.LoadSpecs once the new API is stable

func ParseSupportBundle added in v0.44.0

func ParseSupportBundle(doc []byte, followURI bool) (*troubleshootv1beta2.SupportBundle, error)

ParseSupportBundle parses a support bundle from a byte array into a SupportBundle object

func ParseSupportBundleFromDoc

func ParseSupportBundleFromDoc(doc []byte) (*troubleshootv1beta2.SupportBundle, error)

ParseSupportBundle parses a support bundle from a byte array into a SupportBundle object We will deprecate this in favour of use loader.LoadSpecs once the new API is stable

func ProcessSupportBundleAfterCollection

func ProcessSupportBundleAfterCollection(spec *troubleshootv1beta2.SupportBundleSpec, archivePath string) (bool, error)

ProcessSupportBundleAfterCollection performs the after collection actions, like Callbacks and sending the archive to a remote server.

func UploadBundleAutoDetect added in v0.123.0

func UploadBundleAutoDetect(bundlePath string, providedLicenseID, providedAppSlug, uploadDomain string) error

UploadBundleAutoDetect uploads a support bundle with automatic license and app slug detection

func UploadToReplicatedApp added in v0.123.0

func UploadToReplicatedApp(bundlePath, licenseID, appSlug, uploadDomain string) error

UploadToReplicatedApp uploads a support bundle directly to replicated.app using the app slug as the upload path

Types

type NodeList added in v0.105.2

type NodeList struct {
	Nodes []string `json:"nodes"`
}

NodeList is a list of remote nodes to collect data from in a support bundle

type RBACPermissionError added in v0.106.0

type RBACPermissionError struct {
	Forbidden []error
}

Custom error type for RBAC permission errors

func (*RBACPermissionError) Error added in v0.106.0

func (e *RBACPermissionError) Error() string

func (*RBACPermissionError) HasErrors added in v0.106.0

func (e *RBACPermissionError) HasErrors() bool

type SupportBundleCreateOpts

type SupportBundleCreateOpts struct {
	CollectorProgressCallback func(chan interface{}, string)
	CollectWithoutPermissions bool
	HttpClient                *http.Client
	KubernetesRestConfig      *rest.Config
	Namespace                 string
	ProgressChan              chan interface{}
	SinceTime                 *time.Time
	OutputPath                string
	Redact                    bool
	FromCLI                   bool
	RunHostCollectorsInPod    bool

	// Phase 4: Tokenization options
	Tokenize            bool   // Enable intelligent tokenization
	RedactionMapPath    string // Path for redaction mapping file
	EncryptRedactionMap bool   // Encrypt the redaction mapping file
	TokenPrefix         string // Custom token prefix format
	VerifyTokenization  bool   // Validation mode only
	BundleID            string // Custom bundle identifier
	TokenizationStats   bool   // Include detailed tokenization statistics
}

type SupportBundleResponse

type SupportBundleResponse struct {
	AnalyzerResults []*analyzer.AnalyzeResult
	ArchivePath     string
	FileUploaded    bool

	// Phase 4: Tokenization response data
	TokenizationEnabled bool                   // Whether tokenization was used
	RedactionMapPath    string                 // Path to generated redaction mapping file
	TokenizationStats   *redact.RedactionStats // Detailed tokenization statistics
	BundleID            string                 // Bundle identifier for correlation
}

func CollectSupportBundleFromSpec

func CollectSupportBundleFromSpec(
	spec *troubleshootv1beta2.SupportBundleSpec, additionalRedactors *troubleshootv1beta2.Redactor, opts SupportBundleCreateOpts,
) (*SupportBundleResponse, error)

CollectSupportBundleFromSpec collects support bundle from start to finish, including running collectors, analyzers and after collection steps. Input arguments are specifications. if FromCLI option is set to true, the output is the name of the archive on disk in the cwd. if FromCLI option is set to false, the support bundle is archived in the OS temp folder (os.TempDir()).

func CollectSupportBundleFromURI

func CollectSupportBundleFromURI(specURI string, redactorURIs []string, opts SupportBundleCreateOpts) (*SupportBundleResponse, error)

CollectSupportBundleFromURI collects support bundle from start to finish, including running collectors, analyzers and after collection steps. Input arguments are the URIs of the support bundle and redactor specs. The support bundle is archived in the OS temp folder (os.TempDir()).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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