()
| 28 | ) |
| 29 | |
| 30 | func 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 | } |
no test coverage detected