MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / operatorCmd

Function operatorCmd

internal/cmd/plugin/report/operator.go:30–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28)
29
30func operatorCmd() *cobra.Command {
31 var (
32 file, output string
33 stopRedaction bool
34 includeLogs, logTimeStamp bool
35 )
36
37 const filePlaceholder = "report_operator_<timestamp>.zip"
38
39 cmd := &cobra.Command{
40 Use: "operator",
41 Short: "Report operator deployment, pod, events, logs (opt-in)",
42 Long: "Collects combined information on the operator in a Zip file",
43 RunE: func(cmd *cobra.Command, _ []string) error {
44 now := time.Now().UTC()
45 if file == filePlaceholder {
46 file = reportName("operator", now) + ".zip"
47 }
48 return operator(cmd.Context(), plugin.OutputFormat(output),
49 file, stopRedaction, includeLogs, logTimeStamp, now)
50 },
51 }
52
53 cmd.Flags().StringVarP(&file, "file", "f", filePlaceholder,
54 "Output file")
55 cmd.Flags().StringVarP(&output, "output", "o", "yaml",
56 "Output format for manifests (yaml or json)")
57 cmd.Flags().BoolVarP(&stopRedaction, "stopRedaction", "S", false,
58 "Don't redact secrets")
59 cmd.Flags().BoolVarP(&includeLogs, "logs", "l", false, "include logs")
60 cmd.Flags().BoolVarP(&logTimeStamp, "timestamps", "t", false,
61 "Prepend human-readable timestamp to each log line")
62
63 return cmd
64}

Callers 1

NewCmdFunction · 0.85

Calls 3

OutputFormatTypeAlias · 0.92
reportNameFunction · 0.85
operatorFunction · 0.85

Tested by

no test coverage detected