bugreport

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "bugreport",
	Short: fmt.Sprintf("Generates a zip file of relevant %v debug information.", configmanagement.CLIName),
	Long:  "Generates a zip file in your current directory containing an aggregate of the logs and cluster state for debugging purposes.",
	RunE: func(cmd *cobra.Command, _ []string) error {

		cmd.SilenceUsage = true

		if err := cmd.InheritedFlags().Lookup("stderrthreshold").Value.Set("0"); err != nil {
			klog.Errorf("failed to increase logging STDERR threshold: %v", err)
		}

		cfg, err := restconfig.NewRestConfig(flags.ClientTimeout)
		if err != nil {
			return fmt.Errorf("failed to create rest config: %w", err)
		}
		cs, err := kubernetes.NewForConfig(cfg)
		if err != nil {
			return fmt.Errorf("failed to create kubernetes client set: %w", err)
		}
		c, err := client.New(cfg, client.Options{})
		if err != nil {
			return fmt.Errorf("failed to create kubernetes client: %w", err)
		}

		report, err := bugreport.New(cmd.Context(), c, cs)
		if err != nil {
			return fmt.Errorf("failed to initialize bug reporter: %w", err)
		}

		if err = report.Open(); err != nil {
			return err
		}

		report.WriteRawInZip(report.FetchLogSources(cmd.Context()))
		report.WriteRawInZip(report.FetchResources(cmd.Context()))
		report.WriteRawInZip(report.FetchCMSystemPods(cmd.Context()))
		report.AddNomosStatusToZip(cmd.Context())
		report.AddNomosVersionToZip(cmd.Context())

		report.Close()
		return nil
	},
}

Cmd retrieves readers for all relevant nomos container logs and cluster state commands and writes them to a zip file

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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