Skip to content

Commit b392d63

Browse files
Merge pull request #29279 from vrutkovs/interesting-cert-rotation-events-chart
API-1802: chart template: show cert rotation events
2 parents 47eed7a + 38ed251 commit b392d63

File tree

4 files changed

+104
-2
lines changed

4 files changed

+104
-2
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ <h5 class="modal-title">Resource</h5>
254254
<option value="e2e_test_failed">e2e Test Failed</option>
255255
<option value="e2e_test_flaked">e2e Test Flaked</option>
256256
<option value="interesting_events">Interesting Events</option>
257+
<option value="certificate_rotation">Certificate Rotation</option>
257258
</select>
258259
`
259260

@@ -296,6 +297,7 @@ <h5 class="modal-title">Resource</h5>
296297
eventInterval.categories.e2e_test_flaked = isE2EFlaked(eventInterval);
297298
eventInterval.categories.e2e_test_passed = isE2EPassed(eventInterval);
298299
eventInterval.categories.endpoint_availability = isEndpointConnectivity(eventInterval);
300+
eventInterval.categories.certificate_rotation = isCertificateRotation(eventInterval);
299301
eventInterval.categories.uncategorized = !_.some(eventInterval.categories); // will save time later during filtering and re-rendering since we don't render any uncategorized events
300302
});
301303

@@ -438,6 +440,52 @@ <h5 class="modal-title">Resource</h5>
438440
return eventInterval.source === "Alert"
439441
}
440442

443+
444+
function isCertificateRotation(eventInterval) {
445+
if (eventInterval.source != 'KubeEvent') {
446+
return false
447+
}
448+
if (eventInterval.message.reason === "CertificateUpdated") {
449+
return true
450+
};
451+
if (eventInterval.message.reason === "CertificateRemoved") {
452+
return true
453+
};
454+
if (eventInterval.message.reason === "CertificateUpdateFailed") {
455+
return true
456+
};
457+
if (eventInterval.message.reason === "ConfigMapUpdated") {
458+
return true
459+
};
460+
if (eventInterval.message.reason === "SignerUpdateRequired") {
461+
return true
462+
};
463+
if (eventInterval.message.reason === "CABundleUpdateRequired") {
464+
return true
465+
};
466+
if (eventInterval.message.reason === "TargetUpdateRequired") {
467+
return true
468+
};
469+
if (eventInterval.message.reason === "CSRCreated") {
470+
return true
471+
};
472+
if (eventInterval.message.reason === "CSRApproved") {
473+
return true
474+
};
475+
if (eventInterval.message.reason === "CertificateRotationStarted") {
476+
return true
477+
};
478+
if (eventInterval.message.reason === "ClientCertificateCreated") {
479+
return true
480+
};
481+
if (eventInterval.message.reason === "NoValidCertificateFound") {
482+
return true
483+
};
484+
485+
486+
return false;
487+
}
488+
441489
function interestingEvents(item) {
442490
if (item.message.annotations["pathological"] === "true") {
443491
if (item.message.annotations["interesting"] === "true") {
@@ -866,6 +914,9 @@ <h5 class="modal-title">Resource</h5>
866914
timelineGroups.push({group: "interesting-events", data: []});
867915
createTimelineData(interestingEvents, timelineGroups[timelineGroups.length - 1].data, filteredEvents, "interesting_events");
868916

917+
timelineGroups.push({group: "certificate-rotation", data: []})
918+
createTimelineData("CertificateRotation", timelineGroups[timelineGroups.length - 1].data, filteredEvents, "certificate_rotation")
919+
869920
var segmentFunc = function (segment) {
870921
// Copy label to clipboard
871922
navigator.clipboard.writeText(segment.labelVal);

pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ var KubeAPIServerAvoids500s = &SimplePathologicalEventMatcher{
706706

707707
var CertificateRotation = &SimplePathologicalEventMatcher{
708708
name: "CertificateRotation",
709-
messageReasonRegex: regexp.MustCompile(`^(CABundleUpdateRequired|SignerUpdateRequired|TargetUpdateRequired|CertificateUpdated|CertificateRemoved|CertificateUpdateFailed)$`),
709+
messageReasonRegex: regexp.MustCompile(`^(CABundleUpdateRequired|SignerUpdateRequired|TargetUpdateRequired|CertificateUpdated|CertificateRemoved|CertificateUpdateFailed|CSRCreated|CSRApproved|CertificateRotationStarted|ClientCertificateCreated|NoValidCertificateFound)$`),
710710
}
711711

712712
// IsEventAfterInstallation returns true if the monitorEvent represents an event that happened after installation.

pkg/monitortests/testframework/watchevents/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func recordAddOrUpdateEvent(
150150
}
151151
}
152152
}
153-
case "CABundleUpdateRequired", "SignerUpdateRequired", "TargetUpdateRequired", "CertificateUpdated", "CertificateRemoved", "CertificateUpdateFailed":
153+
case "CABundleUpdateRequired", "SignerUpdateRequired", "TargetUpdateRequired", "CertificateUpdated", "CertificateRemoved", "CertificateUpdateFailed", "CSRCreated", "CSRApproved", "CertificateRotationStarted", "ClientCertificateCreated", "NoValidCertificateFound":
154154
message = message.WithAnnotation(monitorapi.AnnotationInteresting, "true")
155155
default:
156156
}

test/extended/testdata/bindata.go

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)