1
1
package metrics
2
2
3
3
import (
4
- "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
5
- "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
4
+ "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
6
5
"github.com/prometheus/client_golang/prometheus"
7
6
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8
7
)
@@ -12,15 +11,15 @@ type MetricsProvider interface {
12
11
}
13
12
14
13
type metricsCSV struct {
15
- opClient operatorclient. ClientInterface
14
+ client versioned. Interface
16
15
}
17
16
18
- func NewMetricsCSV (opClient operatorclient. ClientInterface ) MetricsProvider {
19
- return & metricsCSV {opClient }
17
+ func NewMetricsCSV (client versioned. Interface ) MetricsProvider {
18
+ return & metricsCSV {client }
20
19
}
21
20
22
21
func (m * metricsCSV ) HandleMetrics () error {
23
- cList , err := m .opClient . ListCustomResource ( v1alpha1 . GroupName , v1alpha1 . GroupVersion , metav1 .NamespaceAll , v1alpha1 . ClusterServiceVersionKind )
22
+ cList , err := m .client . OperatorsV1alpha1 (). ClusterServiceVersions ( metav1 .NamespaceAll ). List (metav1. ListOptions {} )
24
23
if err != nil {
25
24
return err
26
25
}
@@ -29,15 +28,15 @@ func (m *metricsCSV) HandleMetrics() error {
29
28
}
30
29
31
30
type metricsInstallPlan struct {
32
- opClient operatorclient. ClientInterface
31
+ client versioned. Interface
33
32
}
34
33
35
- func NewMetricsInstallPlan (opClient operatorclient. ClientInterface ) MetricsProvider {
36
- return & metricsInstallPlan {opClient }
34
+ func NewMetricsInstallPlan (client versioned. Interface ) MetricsProvider {
35
+ return & metricsInstallPlan {client }
37
36
}
38
37
39
38
func (m * metricsInstallPlan ) HandleMetrics () error {
40
- cList , err := m .opClient . ListCustomResource ( v1alpha1 . GroupName , v1alpha1 . GroupVersion , metav1 .NamespaceAll , v1alpha1 . InstallPlanKind )
39
+ cList , err := m .client . OperatorsV1alpha1 (). InstallPlans ( metav1 .NamespaceAll ). List (metav1. ListOptions {} )
41
40
if err != nil {
42
41
return err
43
42
}
@@ -46,15 +45,15 @@ func (m *metricsInstallPlan) HandleMetrics() error {
46
45
}
47
46
48
47
type metricsSubscription struct {
49
- opClient operatorclient. ClientInterface
48
+ client versioned. Interface
50
49
}
51
50
52
- func NewMetricsSubscription (opClient operatorclient. ClientInterface ) MetricsProvider {
53
- return & metricsSubscription {opClient }
51
+ func NewMetricsSubscription (client versioned. Interface ) MetricsProvider {
52
+ return & metricsSubscription {client }
54
53
}
55
54
56
55
func (m * metricsSubscription ) HandleMetrics () error {
57
- cList , err := m .opClient . ListCustomResource ( v1alpha1 . GroupName , v1alpha1 . GroupVersion , metav1 .NamespaceAll , v1alpha1 . SubscriptionKind )
56
+ cList , err := m .client . OperatorsV1alpha1 (). Subscriptions ( metav1 .NamespaceAll ). List (metav1. ListOptions {} )
58
57
if err != nil {
59
58
return err
60
59
}
@@ -63,16 +62,16 @@ func (m *metricsSubscription) HandleMetrics() error {
63
62
}
64
63
65
64
type metricsCatalogSource struct {
66
- opClient operatorclient. ClientInterface
65
+ client versioned. Interface
67
66
}
68
67
69
- func NewMetricsCatalogSource (opClient operatorclient. ClientInterface ) MetricsProvider {
70
- return & metricsCatalogSource {opClient }
68
+ func NewMetricsCatalogSource (client versioned. Interface ) MetricsProvider {
69
+ return & metricsCatalogSource {client }
71
70
72
71
}
73
72
74
73
func (m * metricsCatalogSource ) HandleMetrics () error {
75
- cList , err := m .opClient . ListCustomResource ( v1alpha1 . GroupName , v1alpha1 . GroupVersion , metav1 .NamespaceAll , v1alpha1 . CatalogSourceKind )
74
+ cList , err := m .client . OperatorsV1alpha1 (). CatalogSources ( metav1 .NamespaceAll ). List (metav1. ListOptions {} )
76
75
if err != nil {
77
76
return err
78
77
}
0 commit comments