Skip to content

Commit ac88cdc

Browse files
Merge pull request #30174 from everettraven/monitor/watch-channels-threshold-update
CNTRLPLANE-945: monitor: auditloganalyzer: skip watch channels processing when cluster stability is explicitly marked as `Disruptive`
2 parents e7b4f7e + 3f7e669 commit ac88cdc

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

pkg/defaultmonitortests/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func newUniversalMonitorTests(info monitortestframework.MonitorTestInitializatio
175175
monitorTestRegistry.AddMonitorTestOrDie("etcd-log-analyzer", "etcd", etcdloganalyzer.NewEtcdLogAnalyzer())
176176
monitorTestRegistry.AddMonitorTestOrDie("legacy-etcd-invariants", "etcd", legacyetcdmonitortests.NewLegacyTests())
177177

178-
monitorTestRegistry.AddMonitorTestOrDie("audit-log-analyzer", "kube-apiserver", auditloganalyzer.NewAuditLogAnalyzer())
178+
monitorTestRegistry.AddMonitorTestOrDie("audit-log-analyzer", "kube-apiserver", auditloganalyzer.NewAuditLogAnalyzer(info))
179179
monitorTestRegistry.AddMonitorTestOrDie("legacy-kube-apiserver-invariants", "kube-apiserver", legacykubeapiservermonitortests.NewLegacyTests())
180180
monitorTestRegistry.AddMonitorTestOrDie("graceful-shutdown-analyzer", "kube-apiserver", apiservergracefulrestart.NewGracefulShutdownAnalyzer())
181181

pkg/monitortests/kubeapiserver/auditloganalyzer/monitortest.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ type auditLogAnalyzer struct {
3535
latencyChecker *auditLatencyRecords
3636

3737
countsForInstall *CountsForRun
38+
39+
clusterStability monitortestframework.ClusterStabilityDuringTest
3840
}
3941

40-
func NewAuditLogAnalyzer() monitortestframework.MonitorTest {
42+
func NewAuditLogAnalyzer(info monitortestframework.MonitorTestInitializationInfo) monitortestframework.MonitorTest {
4143
return &auditLogAnalyzer{
4244
summarizer: NewAuditLogSummarizer(),
4345
excessiveApplyChecker: CheckForExcessiveApplies(),
@@ -46,6 +48,7 @@ func NewAuditLogAnalyzer() monitortestframework.MonitorTest {
4648
violationChecker: CheckForViolations(),
4749
watchCountTracking: NewWatchCountTracking(),
4850
latencyChecker: CheckForLatency(),
51+
clusterStability: info.ClusterStabilityDuringTest,
4952
}
5053
}
5154

@@ -93,13 +96,16 @@ func (w *auditLogAnalyzer) CollectData(ctx context.Context, storageDir string, b
9396
w.invalidRequestsChecker,
9497
w.requestsDuringShutdownChecker,
9598
w.violationChecker,
96-
w.watchCountTracking,
9799
w.latencyChecker,
98100
}
99101
if w.requestCountTracking != nil {
100102
auditLogHandlers = append(auditLogHandlers, w.requestCountTracking)
101103
}
102104

105+
if w.clusterStability == monitortestframework.Stable {
106+
auditLogHandlers = append(auditLogHandlers, w.watchCountTracking)
107+
}
108+
103109
err = GetKubeAuditLogSummary(ctx, kubeClient, &beginning, &end, auditLogHandlers)
104110

105111
retIntervals := monitorapi.Intervals{}
@@ -411,10 +417,14 @@ func (w *auditLogAnalyzer) EvaluateTestsFromConstructedIntervals(ctx context.Con
411417
}
412418

413419
ret = append(ret, w.violationChecker.CreateJunits()...)
414-
junits, err := w.watchCountTracking.CreateJunits()
415-
if err == nil {
416-
ret = append(ret, junits...)
420+
421+
if w.clusterStability == monitortestframework.Stable {
422+
junits, err := w.watchCountTracking.CreateJunits()
423+
if err == nil {
424+
ret = append(ret, junits...)
425+
}
417426
}
427+
418428
return ret, err
419429
}
420430

@@ -423,7 +433,7 @@ func (w *auditLogAnalyzer) WriteContentToStorage(ctx context.Context, storageDir
423433
return currErr
424434
}
425435

426-
if w.watchCountTracking != nil {
436+
if w.watchCountTracking != nil && w.clusterStability == monitortestframework.Stable {
427437
err := w.watchCountTracking.WriteAuditLogSummary(ctx, storageDir, "watch-requests", timeSuffix)
428438
if err != nil {
429439
// print any error and continue processing

0 commit comments

Comments
 (0)