(cmd *cobra.Command, args *config2.BugReportConfig)
| 38 | ) |
| 39 | |
| 40 | func addFlags(cmd *cobra.Command, args *config2.BugReportConfig) { |
| 41 | // k8s client config |
| 42 | cmd.PersistentFlags().StringVarP(&args.KubeConfigPath, "kubeconfig", "c", "", |
| 43 | "Path to kube config.") |
| 44 | cmd.PersistentFlags().StringVar(&args.Context, "context", "", |
| 45 | "Name of the kubeconfig Context to use.") |
| 46 | |
| 47 | // input config |
| 48 | cmd.PersistentFlags().StringVarP(&configFile, "filename", "f", "", |
| 49 | "Path to a file containing configuration in YAML format. The file contents are applied over the default "+ |
| 50 | "values and flag settings, with lists being replaced per JSON merge semantics.") |
| 51 | |
| 52 | // dry run |
| 53 | cmd.PersistentFlags().BoolVarP(&args.DryRun, "dry-run", "", false, |
| 54 | "Only log commands that would be run, don't fetch or write.") |
| 55 | |
| 56 | cmd.PersistentFlags().IntVar(&args.ProxyAdminPort, "proxy-admin-port", util.DefaultProxyAdminPort, |
| 57 | "Envoy proxy admin port") |
| 58 | |
| 59 | // full secrets |
| 60 | cmd.PersistentFlags().BoolVarP(&args.FullSecrets, "full-secrets", "", false, |
| 61 | "If set, secret contents are included in output.") |
| 62 | |
| 63 | // istio namespaces |
| 64 | cmd.PersistentFlags().StringVar(&args.IstioNamespace, "istio-namespace", bugReportDefaultIstioNamespace, |
| 65 | "Namespace where Istio control plane is installed.") |
| 66 | |
| 67 | // timeouts and max sizes |
| 68 | cmd.PersistentFlags().DurationVar(&commandTimeout, "timeout", bugReportDefaultTimeout, |
| 69 | "Maximum amount of time to spend fetching logs. When timeout is reached "+ |
| 70 | "only the logs captured so far are saved to the archive.") |
| 71 | // include / exclude specs |
| 72 | cmd.PersistentFlags().StringArrayVar(&included, "include", bugReportDefaultInclude, |
| 73 | "Spec for which pod's proxy logs to include in the archive. See above for format and examples.") |
| 74 | cmd.PersistentFlags().StringArrayVar(&excluded, "exclude", bugReportDefaultExclude, |
| 75 | "Spec for which pod's proxy logs to exclude from the archive, after the include spec "+ |
| 76 | "is processed. See above for format and examples.") |
| 77 | |
| 78 | // log time ranges |
| 79 | cmd.PersistentFlags().StringVar(&startTime, "start-time", "", |
| 80 | "Start time for the range of log entries to include in the archive. "+ |
| 81 | "Default is the infinite past. If set, --duration must be unset.") |
| 82 | cmd.PersistentFlags().StringVar(&endTime, "end-time", "", |
| 83 | "End time for the range of log entries to include in the archive. Default is now.") |
| 84 | cmd.PersistentFlags().DurationVar(&since, "duration", 0, |
| 85 | "How far to go back in time from end-time for log entries to include in the archive. "+ |
| 86 | "Default is infinity. If set, --start-time must be unset.") |
| 87 | |
| 88 | // log error control |
| 89 | cmd.PersistentFlags().StringSliceVar(&args.CriticalErrors, "critical-errs", nil, |
| 90 | "List of comma separated glob patterns to match against log error strings. "+ |
| 91 | "If any pattern matches an error in the log, the logs is given the highest priority for archive inclusion.") |
| 92 | cmd.PersistentFlags().StringSliceVar(&args.IgnoredErrors, "ignore-errs", nil, |
| 93 | "List of comma separated glob patterns to match against log error strings. "+ |
| 94 | "Any error matching these patterns is ignored when calculating the log importance heuristic.") |
| 95 | |
| 96 | // working dir to store temporary artifacts |
| 97 | cmd.PersistentFlags().StringVar(&tempDir, "dir", "", |
no outgoing calls
searching dependent graphs…