New returns a newly-constructed Config object with default values.
()
| 289 | |
| 290 | // New returns a newly-constructed Config object with default values. |
| 291 | func New() *Config { |
| 292 | var cfg Config |
| 293 | cfg.Description = "DEFAULT" |
| 294 | // Note: The resultsDir here is just for the plugins, not the aggregator. |
| 295 | cfg.ResultsDir = plugin.ResultsDir |
| 296 | cfg.Version = buildinfo.Version |
| 297 | |
| 298 | cfg.Filters.Namespaces = ".*" |
| 299 | |
| 300 | cfg.QPS = DefaultQueryQPS |
| 301 | cfg.Burst = DefaultQueryBurst |
| 302 | cfg.Resources = DefaultResources |
| 303 | |
| 304 | cfg.Namespace = DefaultNamespace |
| 305 | cfg.Limits.PodLogs.Namespaces = "kube-system" |
| 306 | cfg.Limits.PodLogs.SonobuoyNamespace = new(bool) |
| 307 | *cfg.Limits.PodLogs.SonobuoyNamespace = true |
| 308 | cfg.Limits.PodLogs.FieldSelectors = []string{} |
| 309 | |
| 310 | cfg.Aggregation.BindAddress = DefaultAggregationServerBindAddress |
| 311 | cfg.Aggregation.BindPort = DefaultAggregationServerBindPort |
| 312 | cfg.Aggregation.TimeoutSeconds = DefaultAggregationServerTimeoutSeconds |
| 313 | |
| 314 | cfg.PluginSearchPath = []string{ |
| 315 | "./plugins.d", |
| 316 | "/etc/sonobuoy/plugins.d", |
| 317 | "~/sonobuoy/plugins.d", |
| 318 | } |
| 319 | |
| 320 | switch devRepo := os.Getenv("SONOBUOY_DEV_REPO"); { |
| 321 | case len(devRepo) > 0: |
| 322 | cfg.WorkerImage = fmt.Sprintf("%v/sonobuoy:%v", devRepo, buildinfo.Version) |
| 323 | default: |
| 324 | cfg.WorkerImage = DefaultImage |
| 325 | } |
| 326 | |
| 327 | cfg.ImagePullPolicy = DefaultSonobuoyPullPolicy |
| 328 | |
| 329 | cfg.ProgressUpdatesPort = DefaultProgressUpdatesPort |
| 330 | |
| 331 | cfg.SecurityContextMode = DefaultSecurityContextMode |
| 332 | |
| 333 | cfg.AggregatorPermissions = DefaultAggregatorPermissions |
| 334 | |
| 335 | cfg.ServiceAccountName = DefaultServiceAccountName |
| 336 | |
| 337 | cfg.ExistingServiceAccount = false |
| 338 | |
| 339 | cfg.NamespacePSAEnforceLevel = DefaultNamespacePSAEnforceLevel |
| 340 | |
| 341 | return &cfg |
| 342 | } |
| 343 | |
| 344 | // addPlugin adds a (configured, initialized) plugin to the config object so |
| 345 | // that it can be executed. |
no outgoing calls