@@ -15,11 +15,18 @@ import (
15
15
"k8s.io/apimachinery/pkg/util/wait"
16
16
"k8s.io/client-go/discovery"
17
17
18
+ olmv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1"
19
+ olmv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
18
20
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
19
21
olmversion "github.com/operator-framework/operator-lifecycle-manager/pkg/version"
20
22
)
21
23
22
- func MonitorClusterStatus (name string , syncCh <- chan error , stopCh <- chan struct {}, opClient operatorclient.ClientInterface , configClient configv1client.ConfigV1Interface ) {
24
+ const (
25
+ clusterOperatorOLM = "operator-lifecycle-manager"
26
+ clusterOperatorCatalogSource = "operator-lifecycle-manager-catalog"
27
+ )
28
+
29
+ func MonitorClusterStatus (name , namespace string , syncCh <- chan error , stopCh <- chan struct {}, opClient operatorclient.ClientInterface , configClient configv1client.ConfigV1Interface ) {
23
30
var (
24
31
syncs int
25
32
successfulSyncs int
@@ -100,6 +107,7 @@ func MonitorClusterStatus(name string, syncCh <-chan error, stopCh <-chan struct
100
107
},
101
108
},
102
109
})
110
+ created .Status .RelatedObjects = relatedObjects (name , namespace )
103
111
if createErr != nil {
104
112
log .Errorf ("Failed to create cluster operator: %v\n " , createErr )
105
113
return
@@ -220,3 +228,43 @@ func findOperatorStatusCondition(conditions []configv1.ClusterOperatorStatusCond
220
228
221
229
return nil
222
230
}
231
+
232
+ // relatedObjects returns RelatedObjects in the ClusterOperator.Status.
233
+ // RelatedObjects are consumed by https://github.com/openshift/must-gather
234
+ func relatedObjects (name , namespace string ) []configv1.ObjectReference {
235
+ var objectReferences []configv1.ObjectReference
236
+ switch name {
237
+ case clusterOperatorOLM :
238
+ objectReferences = []configv1.ObjectReference {
239
+ {
240
+ Group : olmv1 .GroupName ,
241
+ Resource : olmv1 .OperatorGroupKind ,
242
+ Namespace : namespace ,
243
+ },
244
+ {
245
+ Group : olmv1alpha1 .GroupName ,
246
+ Resource : olmv1alpha1 .ClusterServiceVersionKind ,
247
+ Namespace : namespace ,
248
+ },
249
+ }
250
+ case clusterOperatorCatalogSource :
251
+ objectReferences = []configv1.ObjectReference {
252
+ {
253
+ Group : olmv1alpha1 .GroupName ,
254
+ Resource : olmv1alpha1 .SubscriptionKind ,
255
+ Namespace : namespace ,
256
+ },
257
+ {
258
+ Group : olmv1alpha1 .GroupName ,
259
+ Resource : olmv1alpha1 .InstallPlanKind ,
260
+ Namespace : namespace ,
261
+ },
262
+ }
263
+ }
264
+ namespaces := configv1.ObjectReference {
265
+ Resource : "namespaces" ,
266
+ Name : namespace ,
267
+ }
268
+ objectReferences = append (objectReferences , namespaces )
269
+ return objectReferences
270
+ }
0 commit comments