prevent npe for old container status readiness
@@ -76,9 +76,10 @@ func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Inter
newContainerReady := containerStatus.Ready
oldContainerReady := false
if oldContainerStatuses != nil {
- oldContainerStatus := findContainerStatus(oldContainerStatuses, containerName, i)
+ if oldContainerStatus := findContainerStatus(oldContainerStatuses, containerName, i); oldContainerStatus != nil {
oldContainerReady = oldContainerStatus.Ready
}
+ }
// always produce conditions during create
if (isCreate && !newContainerReady) || (oldContainerReady && !newContainerReady) {
