@@ -8,19 +8,20 @@ import (
8
8
9
9
"github.com/google/go-cmp/cmp"
10
10
"github.com/operator-framework/api/pkg/operators/v1alpha1"
11
- "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
12
- controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
13
- hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
14
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
15
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister"
16
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
17
11
"github.com/pkg/errors"
18
12
"github.com/sirupsen/logrus"
19
13
corev1 "k8s.io/api/core/v1"
20
14
apierrors "k8s.io/apimachinery/pkg/api/errors"
21
15
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22
16
"k8s.io/apimachinery/pkg/labels"
23
17
"k8s.io/apimachinery/pkg/util/intstr"
18
+
19
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
20
+ controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
21
+ hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
22
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
23
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister"
24
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/ownerutil"
24
25
)
25
26
26
27
const (
@@ -525,12 +526,20 @@ func imageChanged(logger *logrus.Entry, updatePod *corev1.Pod, servingPods []*co
525
526
// imageID returns the ImageID of the primary catalog source container or an empty string if the image ID isn't available yet.
526
527
// Note: the pod must be running and the container in a ready status to return a valid ImageID.
527
528
func imageID (pod * corev1.Pod ) string {
528
- if len (pod .Status .ContainerStatuses ) < 1 {
529
- logrus . WithField ( "CatalogSource" , pod . GetName ()). Warn ( "pod status unknown" )
530
- return ""
529
+ if len (pod .Status .InitContainerStatuses ) == 2 && len ( pod . Status . ContainerStatuses ) == 1 {
530
+ // spec.grpcPodConfig.extractContent mode was used for this pod
531
+ return pod . Status . InitContainerStatuses [ 1 ]. ImageID
531
532
}
532
-
533
- return pod .Status .ContainerStatuses [0 ].ImageID
533
+ if len (pod .Status .InitContainerStatuses ) == 0 && len (pod .Status .ContainerStatuses ) == 1 {
534
+ // spec.grpcPodConfig.extractContent mode was NOT used for this pod (i.e. we're just running the catalog image directly)
535
+ return pod .Status .ContainerStatuses [0 ].ImageID
536
+ }
537
+ if len (pod .Status .InitContainerStatuses ) == 0 && len (pod .Status .ContainerStatuses ) == 0 {
538
+ logrus .WithField ("CatalogSource" , pod .GetName ()).Warn ("pod status unknown; pod has not yet populated initContainer and container status" )
539
+ } else {
540
+ logrus .WithField ("CatalogSource" , pod .GetName ()).Warn ("pod status unknown; pod contains unexpected initContainer and container configuration" )
541
+ }
542
+ return ""
534
543
}
535
544
536
545
func (c * GrpcRegistryReconciler ) removePods (pods []* corev1.Pod , namespace string ) error {
0 commit comments