@@ -6,20 +6,20 @@ import (
6
6
"hash/fnv"
7
7
"time"
8
8
9
- controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
10
-
11
- "github.com/operator-framework/api/pkg/operators/v1alpha1"
12
- hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
13
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
14
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister"
15
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
16
9
"github.com/pkg/errors"
17
10
"github.com/sirupsen/logrus"
18
11
corev1 "k8s.io/api/core/v1"
19
12
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20
13
"k8s.io/apimachinery/pkg/labels"
21
14
"k8s.io/apimachinery/pkg/util/intstr"
22
15
"k8s.io/apimachinery/pkg/util/rand"
16
+
17
+ "github.com/operator-framework/api/pkg/operators/v1alpha1"
18
+ controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
19
+ hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
20
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
21
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister"
22
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
23
23
)
24
24
25
25
const (
@@ -349,9 +349,14 @@ func imageChanged(updatePod *corev1.Pod, servingPods []*corev1.Pod) bool {
349
349
return false
350
350
}
351
351
352
- // imageID returns the ImageID of the primary catalog source container.
352
+ // imageID returns the ImageID of the primary catalog source container or an empty string if the image ID isn't available yet .
353
353
// Note: the pod must be running and the container in a ready status to return a valid ImageID.
354
354
func imageID (pod * corev1.Pod ) string {
355
+ if len (pod .Status .ContainerStatuses ) < 1 {
356
+ logrus .WithField ("CatalogSource" , pod .GetName ()).Warn ("pod status unknown" )
357
+ return ""
358
+ }
359
+
355
360
return pod .Status .ContainerStatuses [0 ].ImageID
356
361
}
357
362
0 commit comments