Skip to content

Commit bb5a352

Browse files
author
Jeff Peeler
authored
Merge branch 'master' into deploy-debug
2 parents 612900f + a46227b commit bb5a352

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

pkg/controller/operators/catalog/operator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func NewOperator(kubeconfigPath string, wakeupInterval time.Duration, operatorNa
106106
op.syncCatalogSources,
107107
nil,
108108
"catsrc",
109-
metrics.NewMetricsCatalogSource(op.Operator.OpClient),
109+
metrics.NewMetricsCatalogSource(op.client),
110110
)
111111
for _, informer := range catsrcQueueInformer {
112112
op.RegisterQueueInformer(informer)
@@ -120,7 +120,7 @@ func NewOperator(kubeconfigPath string, wakeupInterval time.Duration, operatorNa
120120
op.syncInstallPlans,
121121
nil,
122122
"installplan",
123-
metrics.NewMetricsInstallPlan(op.Operator.OpClient),
123+
metrics.NewMetricsInstallPlan(op.client),
124124
)
125125
for _, informer := range ipQueueInformers {
126126
op.RegisterQueueInformer(informer)
@@ -134,7 +134,7 @@ func NewOperator(kubeconfigPath string, wakeupInterval time.Duration, operatorNa
134134
op.syncSubscriptions,
135135
nil,
136136
"subscription",
137-
metrics.NewMetricsSubscription(op.Operator.OpClient),
137+
metrics.NewMetricsSubscription(op.client),
138138
)
139139
op.subQueue = subscriptionQueue
140140
for _, informer := range subscriptionQueueInformers {

pkg/controller/operators/olm/operator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func NewOperator(crClient versioned.Interface, opClient operatorclient.ClientInt
153153
op.syncClusterServiceVersion,
154154
nil,
155155
"csv",
156-
metrics.NewMetricsCSV(op.Operator.OpClient),
156+
metrics.NewMetricsCSV(op.client),
157157
)
158158
for _, informer := range queueInformers {
159159
op.RegisterQueueInformer(informer)

pkg/metrics/metrics.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package metrics
22

33
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"
65
"github.com/prometheus/client_golang/prometheus"
76
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
87
)
@@ -12,15 +11,15 @@ type MetricsProvider interface {
1211
}
1312

1413
type metricsCSV struct {
15-
opClient operatorclient.ClientInterface
14+
client versioned.Interface
1615
}
1716

18-
func NewMetricsCSV(opClient operatorclient.ClientInterface) MetricsProvider {
19-
return &metricsCSV{opClient}
17+
func NewMetricsCSV(client versioned.Interface) MetricsProvider {
18+
return &metricsCSV{client}
2019
}
2120

2221
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{})
2423
if err != nil {
2524
return err
2625
}
@@ -29,15 +28,15 @@ func (m *metricsCSV) HandleMetrics() error {
2928
}
3029

3130
type metricsInstallPlan struct {
32-
opClient operatorclient.ClientInterface
31+
client versioned.Interface
3332
}
3433

35-
func NewMetricsInstallPlan(opClient operatorclient.ClientInterface) MetricsProvider {
36-
return &metricsInstallPlan{opClient}
34+
func NewMetricsInstallPlan(client versioned.Interface) MetricsProvider {
35+
return &metricsInstallPlan{client}
3736
}
3837

3938
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{})
4140
if err != nil {
4241
return err
4342
}
@@ -46,15 +45,15 @@ func (m *metricsInstallPlan) HandleMetrics() error {
4645
}
4746

4847
type metricsSubscription struct {
49-
opClient operatorclient.ClientInterface
48+
client versioned.Interface
5049
}
5150

52-
func NewMetricsSubscription(opClient operatorclient.ClientInterface) MetricsProvider {
53-
return &metricsSubscription{opClient}
51+
func NewMetricsSubscription(client versioned.Interface) MetricsProvider {
52+
return &metricsSubscription{client}
5453
}
5554

5655
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{})
5857
if err != nil {
5958
return err
6059
}
@@ -63,16 +62,16 @@ func (m *metricsSubscription) HandleMetrics() error {
6362
}
6463

6564
type metricsCatalogSource struct {
66-
opClient operatorclient.ClientInterface
65+
client versioned.Interface
6766
}
6867

69-
func NewMetricsCatalogSource(opClient operatorclient.ClientInterface) MetricsProvider {
70-
return &metricsCatalogSource{opClient}
68+
func NewMetricsCatalogSource(client versioned.Interface) MetricsProvider {
69+
return &metricsCatalogSource{client}
7170

7271
}
7372

7473
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{})
7675
if err != nil {
7776
return err
7877
}

0 commit comments

Comments
 (0)