@@ -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
@@ -105,6 +112,7 @@ func MonitorClusterStatus(name string, syncCh <-chan error, stopCh <-chan struct
105
112
},
106
113
},
107
114
})
115
+ created .Status .RelatedObjects = relatedObjects (name , namespace )
108
116
if createErr != nil {
109
117
log .Errorf ("Failed to create cluster operator: %v\n " , createErr )
110
118
return
@@ -234,3 +242,43 @@ func findOperatorStatusCondition(conditions []configv1.ClusterOperatorStatusCond
234
242
235
243
return nil
236
244
}
245
+
246
+ // relatedObjects returns RelatedObjects in the ClusterOperator.Status.
247
+ // RelatedObjects are consumed by https://github.com/openshift/must-gather
248
+ func relatedObjects (name , namespace string ) []configv1.ObjectReference {
249
+ var objectReferences []configv1.ObjectReference
250
+ switch name {
251
+ case clusterOperatorOLM :
252
+ objectReferences = []configv1.ObjectReference {
253
+ {
254
+ Group : olmv1 .GroupName ,
255
+ Resource : olmv1 .OperatorGroupKind ,
256
+ Namespace : namespace ,
257
+ },
258
+ {
259
+ Group : olmv1alpha1 .GroupName ,
260
+ Resource : olmv1alpha1 .ClusterServiceVersionKind ,
261
+ Namespace : namespace ,
262
+ },
263
+ }
264
+ case clusterOperatorCatalogSource :
265
+ objectReferences = []configv1.ObjectReference {
266
+ {
267
+ Group : olmv1alpha1 .GroupName ,
268
+ Resource : olmv1alpha1 .SubscriptionKind ,
269
+ Namespace : namespace ,
270
+ },
271
+ {
272
+ Group : olmv1alpha1 .GroupName ,
273
+ Resource : olmv1alpha1 .InstallPlanKind ,
274
+ Namespace : namespace ,
275
+ },
276
+ }
277
+ }
278
+ namespaces := configv1.ObjectReference {
279
+ Resource : "namespaces" ,
280
+ Name : namespace ,
281
+ }
282
+ objectReferences = append (objectReferences , namespaces )
283
+ return objectReferences
284
+ }
0 commit comments