Bug Report
Module version: 0.3.1 / 0.4.0 (present in both)
Description
ConditionRenderer::assembleExtendedInfo() throws a fatal TypeError when a condition has a null value for last_transition. This causes the Kubernetes web view to crash when
rendering conditions that have never transitioned.
Error
TypeError: Call to a member function getTimestamp() on null
in library/Kubernetes/View/ConditionRenderer.php:50
Steps to reproduce
- Have a Kubernetes resource (e.g. a Node or Pod) with a condition where
lastTransitionTime is not set or is null in the cluster.
- Open the resource detail view in Icinga for Kubernetes Web.
- The page fails to render.
Root cause
In library/Kubernetes/View/ConditionRenderer.php, line 50:
// Current code — crashes when last_transition is null
$info->addHtml(new TimeAgo($item->last_transition->getTimestamp()));
last_transition can be null when a condition has no transition timestamp, but there is no null check before calling getTimestamp().
Fix
if ($item->last_transition !== null) {
$info->addHtml(new TimeAgo($item->last_transition->getTimestamp()));
}
Environment
- Icinga for Kubernetes Web: 0.3.1 / 0.4.0
- Icinga for Kubernetes daemon: 0.3.0
- IcingaWeb2: 2.12.x
- Kubernetes: GKE
Bug Report
Module version: 0.3.1 / 0.4.0 (present in both)
Description
ConditionRenderer::assembleExtendedInfo()throws a fatalTypeErrorwhen a condition has anullvalue forlast_transition. This causes the Kubernetes web view to crash whenrendering conditions that have never transitioned.
Error
TypeError: Call to a member function getTimestamp() on null
in library/Kubernetes/View/ConditionRenderer.php:50
Steps to reproduce
lastTransitionTimeis not set or is null in the cluster.Root cause
In
library/Kubernetes/View/ConditionRenderer.php, line 50: