MCPcopy
hub / github.com/kubernetes/client-go / populateDefaults

Function populateDefaults

tools/record/events_cache.go:464–490  ·  view source on GitHub ↗

populateDefaults populates the zero value options with defaults

(options CorrelatorOptions)

Source from the content-addressed store, hash-verified

462
463// populateDefaults populates the zero value options with defaults
464func populateDefaults(options CorrelatorOptions) CorrelatorOptions {
465 if options.LRUCacheSize == 0 {
466 options.LRUCacheSize = maxLruCacheEntries
467 }
468 if options.BurstSize == 0 {
469 options.BurstSize = defaultSpamBurst
470 }
471 if options.QPS == 0 {
472 options.QPS = defaultSpamQPS
473 }
474 if options.KeyFunc == nil {
475 options.KeyFunc = EventAggregatorByReasonFunc
476 }
477 if options.MessageFunc == nil {
478 options.MessageFunc = EventAggregatorByReasonMessageFunc
479 }
480 if options.MaxEvents == 0 {
481 options.MaxEvents = defaultAggregateMaxEvents
482 }
483 if options.MaxIntervalInSeconds == 0 {
484 options.MaxIntervalInSeconds = defaultAggregateIntervalInSeconds
485 }
486 if options.Clock == nil {
487 options.Clock = clock.RealClock{}
488 }
489 return options
490}
491
492// EventCorrelate filters, aggregates, counts, and de-duplicates all incoming events
493func (c *EventCorrelator) EventCorrelate(newEvent *v1.Event) (*EventCorrelateResult, error) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected