MCPcopy
hub / github.com/vmware-tanzu/sonobuoy / New

Function New

pkg/config/config.go:291–342  ·  view source on GitHub ↗

New returns a newly-constructed Config object with default values.

()

Source from the content-addressed store, hash-verified

289
290// New returns a newly-constructed Config object with default values.
291func 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.

Callers 13

E2EManifestFunction · 0.92
ExampleFunction · 0.92
NewGenConfigFunction · 0.92
TestGenerateManifestFunction · 0.92
TestDefaultsFunction · 0.92
NewCmdQueryFunction · 0.92
GenFlagSetFunction · 0.92
SetMethod · 0.92
TestSaveAndLoadFunction · 0.85

Calls

no outgoing calls

Tested by 7

ExampleFunction · 0.74
TestGenerateManifestFunction · 0.74
TestDefaultsFunction · 0.74
TestSaveAndLoadFunction · 0.68
TestLoadConfigSetsUUIDFunction · 0.68