@@ -2,8 +2,6 @@ package clusterconfig
2
2
3
3
import (
4
4
"k8s.io/client-go/kubernetes"
5
-
6
- "github.com/openshift/insights-operator/pkg/record"
7
5
)
8
6
9
7
// GatherOpenshiftSDNLogs collects logs from pods in openshift-sdn namespace with following substrings:
@@ -16,7 +14,8 @@ import (
16
14
// Response see https://docs.openshift.com/container-platform/4.6/rest_api/workloads_apis/pod-core-v1.html#apiv1namespacesnamespacepodsnamelog
17
15
//
18
16
// Location in archive: config/pod/openshift-sdn/logs/{pod-name}/errors.log
19
- func GatherOpenshiftSDNLogs (g * Gatherer ) ([]record.Record , []error ) {
17
+ func GatherOpenshiftSDNLogs (g * Gatherer , c chan <- gatherResult ) {
18
+ defer close (c )
20
19
messagesToSearch := []string {
21
20
"Got OnEndpointsUpdate for unknown Endpoints" ,
22
21
"Got OnEndpointsDelete for unknown Endpoints" ,
@@ -26,7 +25,8 @@ func GatherOpenshiftSDNLogs(g *Gatherer) ([]record.Record, []error) {
26
25
27
26
gatherKubeClient , err := kubernetes .NewForConfig (g .gatherProtoKubeConfig )
28
27
if err != nil {
29
- return nil , []error {err }
28
+ c <- gatherResult {nil , []error {err }}
29
+ return
30
30
}
31
31
32
32
coreClient := gatherKubeClient .CoreV1 ()
@@ -42,8 +42,9 @@ func GatherOpenshiftSDNLogs(g *Gatherer) ([]record.Record, []error) {
42
42
"app=sdn" ,
43
43
)
44
44
if err != nil {
45
- return nil , []error {err }
45
+ c <- gatherResult {nil , []error {err }}
46
+ return
46
47
}
47
48
48
- return records , nil
49
+ c <- gatherResult { records , nil }
49
50
}
0 commit comments