Skip to content

Commit 848143e

Browse files
Merge pull request #29710 from vrutkovs/disruption-exclude-localhost
OCPBUGS-55238: spyglass: hide disruption events for localhost
2 parents b392d63 + da1a05c commit 848143e

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

e2echart/non-spyglass-e2e-chart-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ <h5 class="modal-title">Resource</h5>
419419
if (eventInterval.message.reason !== "DisruptionBegan" && eventInterval.message.reason !== "DisruptionSamplerOutageBegan") {
420420
return false
421421
}
422-
if (eventInterval.source === "Disruption") {
422+
if (eventInterval.source === "Disruption" || eventInterval.source === "DisruptionLocalhost") {
423423
return true
424424
}
425425
if (eventInterval.locator.keys["namespace"] === "e2e-k8s-service-lb-available") {

pkg/disruption/backend/disruption/handler.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (h *ciHandler) Unavailable(from, to *backend.SampleResult) {
7676
&v1.ObjectReference{Kind: "OpenShiftTest", Namespace: "kube-system", Name: h.descriptor.Name()},
7777
nil, v1.EventTypeWarning, string(eventReason), "detected", message.BuildString())
7878

79-
interval := monitorapi.NewInterval(monitorapi.SourceDisruption, level).Locator(h.descriptor.DisruptionLocator()).
79+
interval := monitorapi.NewInterval(h.getSource(), level).Locator(h.descriptor.DisruptionLocator()).
8080
Display().
8181
Message(message).Build(fs.StartedAt, time.Time{})
8282
openIntervalID := h.monitorRecorder.StartInterval(interval)
@@ -100,8 +100,16 @@ func (h *ciHandler) Available(from, to *backend.SampleResult) {
100100
h.eventRecorder.Eventf(
101101
&v1.ObjectReference{Kind: "OpenShiftTest", Namespace: "kube-system", Name: h.descriptor.Name()}, nil,
102102
v1.EventTypeNormal, string(monitorapi.DisruptionEndedEventReason), "detected", message.BuildString())
103-
interval := monitorapi.NewInterval(monitorapi.SourceDisruption, monitorapi.Info).Locator(h.descriptor.DisruptionLocator()).
103+
interval := monitorapi.NewInterval(h.getSource(), monitorapi.Info).Locator(h.descriptor.DisruptionLocator()).
104104
Message(message).Build(fs.StartedAt, time.Time{})
105105
openIntervalID := h.monitorRecorder.StartInterval(interval)
106106
h.monitorRecorder.EndInterval(openIntervalID, ts.StartedAt)
107107
}
108+
109+
// getSource returns the source of the interval based on the load balancer type. Localhost disruptions need to be separated, as in some cases these are expected
110+
func (h *ciHandler) getSource() monitorapi.IntervalSource {
111+
if h.descriptor.GetLoadBalancerType() == backend.LocalhostType {
112+
return monitorapi.SourceDisruptionLocalhost
113+
}
114+
return monitorapi.SourceDisruption
115+
}

pkg/monitor/monitorapi/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ const (
348348
SourceAlert IntervalSource = "Alert"
349349
SourceAPIServerShutdown IntervalSource = "APIServerShutdown"
350350
SourceDisruption IntervalSource = "Disruption"
351+
SourceDisruptionLocalhost IntervalSource = "DisruptionLocalhost"
351352
SourceE2ETest IntervalSource = "E2ETest"
352353
SourceKubeEvent IntervalSource = "KubeEvent"
353354
SourceNetworkManagerLog IntervalSource = "NetworkMangerLog"

test/extended/testdata/bindata.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)