Skip to content

Commit 6fc2e1b

Browse files
author
Per Goncalves da Silva
committed
update golagci-lint
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 1b5e500 commit 6fc2e1b

File tree

107 files changed

+3542
-1336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3542
-1336
lines changed

.github/workflows/sanity.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
with:
2525
go-version-file: "go.mod"
2626
- name: Run linting checks
27-
uses: "golangci/golangci-lint-action@v6"
27+
uses: golangci/golangci-lint-action@v6
2828
with:
29-
version: "v1.55.2"
30-
skip-pkg-cache: true
29+
version: v1.57.2
3130

.golangci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
run:
22
timeout: 8m
3-
skip-dirs:
4-
- pkg/lib
5-
- pkg/api
6-
- pkg/fakes
7-
- pkg/package-server/apis
8-
- test/e2e
93

104
linters:
115
enable:
@@ -41,7 +35,13 @@ linters-settings:
4135
issues:
4236
max-issues-per-linter: 0
4337
max-same-issues: 0
38+
exclude-dirs:
39+
- pkg/lib
40+
- pkg/api
41+
- pkg/fakes
42+
- pkg/package-server/apis
43+
- test/e2e
4444

4545
output:
46-
format: tab
46+
formats: tab
4747
sort-results: true

go.mod

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/operator-framework/operator-lifecycle-manager
22

33
go 1.22.0
44

5-
toolchain go1.22.2
5+
toolchain go1.22.3
66

77
require (
88
github.com/blang/semver/v4 v4.0.0
@@ -31,7 +31,7 @@ require (
3131
github.com/otiai10/copy v1.14.0
3232
github.com/pkg/errors v0.9.1
3333
github.com/prometheus/client_golang v1.19.0
34-
github.com/prometheus/client_model v0.6.0
34+
github.com/prometheus/client_model v0.6.1
3535
github.com/prometheus/common v0.51.1
3636
github.com/sirupsen/logrus v1.9.3
3737
github.com/spf13/cobra v1.8.0
@@ -62,10 +62,8 @@ require (
6262

6363
// todo: remove this once k8s.io/component-base is updated to use the new prometheus/client_model
6464
replace (
65-
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.16.0
66-
github.com/prometheus/client_model => github.com/prometheus/client_model v0.4.0
67-
github.com/prometheus/common => github.com/prometheus/common v0.44.0
68-
github.com/prometheus/procfs => github.com/prometheus/procfs v0.10.1
65+
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.18.0
66+
github.com/prometheus/common => github.com/prometheus/common v0.47.0
6967
)
7068

7169
require (
@@ -170,7 +168,6 @@ require (
170168
github.com/mattn/go-isatty v0.0.20 // indirect
171169
github.com/mattn/go-runewidth v0.0.15 // indirect
172170
github.com/mattn/go-sqlite3 v1.14.22 // indirect
173-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
174171
github.com/mitchellh/copystructure v1.2.0 // indirect
175172
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
176173
github.com/mitchellh/reflectwalk v1.0.2 // indirect

go.sum

Lines changed: 1074 additions & 11 deletions
Large diffs are not rendered by default.

pkg/controller/operators/catalog/operator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
213213
bundleUnpackTimeout: bundleUnpackTimeout,
214214
clientFactory: clients.NewFactory(validatingConfig),
215215
}
216+
216217
op.sources = grpc.NewSourceStore(logger, 10*time.Second, 10*time.Minute, op.syncSourceState)
217218
op.sourceInvalidator = resolver.SourceProviderFromRegistryClientProvider(op.sources, logger)
218219
resolverSourceProvider := NewOperatorGroupToggleSourceProvider(op.sourceInvalidator, logger, op.lister.OperatorsV1().OperatorGroupLister())

pkg/controller/registry/grpc/source.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ func (s *SourceStore) Add(key registry.CatalogKey, address string) (*SourceConn,
174174
return nil, err
175175
}
176176

177+
// non-blocking call to start exercising the connection
178+
// recent changes to the grpc library have changed the way connection status was transitioning.
179+
// it seems that previously, creating the connection would make a connection attempt and start the state machine.
180+
// now, it seems like the connection is no longer being attempted - so we must call it here in lieu of a better
181+
// solution. One suggestion might be to
182+
// conn.Connect()
183+
177184
ctx, cancel := context.WithCancel(context.Background())
178185
source := SourceConn{
179186
SourceMeta: SourceMeta{
@@ -233,6 +240,11 @@ func (s *SourceStore) watch(ctx context.Context, key registry.CatalogKey, source
233240
// This function is non-blocking. Therefore, when it returns we'll still return IDLE
234241
// as the state (we'll see further state changes in subsequent iterations of the loop).
235242
source.Conn.Connect()
243+
regitryClient := registry.NewClientFromConn(source.Conn)
244+
245+
// Let's force a health check to make sure the connection is healthy
246+
c, err := regitryClient.HealthCheck(ctx, 10*time.Second)
247+
s.logger.WithError(err).WithField("address", source.Address).Debugf("gRPC health check: %v", c)
236248

237249
// notify subscriber
238250
s.notify <- SourceState{Key: key, State: newState}

pkg/metrics/metrics.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ var (
147147
catalogSourceReady = prometheus.NewGaugeVec(
148148
prometheus.GaugeOpts{
149149
Name: "catalogsource_ready",
150-
Help: "State of a CatalogSource. 1 indicates that the CatalogSource is in a READY state. 0 indicates CatalogSource is in a Non READY state.",
150+
Help: "State of a CatalogSource. 1 indicates that the CatalogSource is in a READY/IDLE state. 0 indicates CatalogSource is in a Non READY/IDLE state.",
151151
},
152152
[]string{NamespaceLabel, NameLabel},
153153
)
@@ -262,6 +262,8 @@ func CounterForSubscription(name, installedCSV, channelName, packageName, planAp
262262
func RegisterCatalogSourceState(name, namespace string, state connectivity.State) {
263263
switch state {
264264
case connectivity.Ready:
265+
fallthrough
266+
case connectivity.Idle:
265267
catalogSourceReady.WithLabelValues(namespace, name).Set(1)
266268
default:
267269
catalogSourceReady.WithLabelValues(namespace, name).Set(0)

test/e2e/magic_catalog.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package e2e
33
import (
44
"context"
55
"fmt"
6+
"google.golang.org/grpc/connectivity"
67
"os"
78

89
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
@@ -20,7 +21,6 @@ const (
2021
olmCatalogLabel string = "olm.catalogSource"
2122
catalogMountPath string = "/opt/olm"
2223
catalogServicePort int32 = 50051
23-
catalogReadyState string = "READY"
2424
)
2525

2626
type MagicCatalog struct {
@@ -147,7 +147,7 @@ func (c *MagicCatalog) catalogSourceIsReady(ctx context.Context) error {
147147
return false, err
148148
}
149149
state := catalogSource.Status.GRPCConnectionState.LastObservedState
150-
if state != catalogReadyState {
150+
if state != connectivity.Idle.String() && state != connectivity.Ready.String() {
151151
return false, nil
152152
}
153153
return true, nil

test/e2e/subscription_e2e_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"google.golang.org/grpc/connectivity"
78
"os"
89
"path/filepath"
910
"reflect"
@@ -3607,7 +3608,8 @@ func updateInternalCatalog(t GinkgoTInterface, c operatorclient.ClientInterface,
36073608
before := fetchedInitialCatalog.Status.ConfigMapResource
36083609
after := catalog.Status.ConfigMapResource
36093610
if after != nil && after.LastUpdateTime.After(before.LastUpdateTime.Time) && after.ResourceVersion != before.ResourceVersion &&
3610-
catalog.Status.GRPCConnectionState.LastConnectTime.After(after.LastUpdateTime.Time) && catalog.Status.GRPCConnectionState.LastObservedState == "READY" {
3611+
catalog.Status.GRPCConnectionState.LastConnectTime.After(after.LastUpdateTime.Time) &&
3612+
(catalog.Status.GRPCConnectionState.LastObservedState == connectivity.Ready.String() || catalog.Status.GRPCConnectionState.LastObservedState == connectivity.Idle.String()) {
36113613
fmt.Println("catalog updated")
36123614
return true
36133615
}

test/e2e/util.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7+
"google.golang.org/grpc/connectivity"
78
"os"
89
"regexp"
910
"strings"
@@ -364,7 +365,8 @@ func catalogSourceRegistryPodSynced() func(catalog *operatorsv1alpha1.CatalogSou
364365
lastState = state
365366
lastTime = time.Now()
366367
}
367-
if registry != nil && connState != nil && !connState.LastConnectTime.IsZero() && connState.LastObservedState == "READY" {
368+
if registry != nil && connState != nil && !connState.LastConnectTime.IsZero() &&
369+
(connState.LastObservedState == connectivity.Ready.String() || connState.LastObservedState == connectivity.Idle.String()) {
368370
fmt.Printf("probing catalog %s pod with address %s\n", catalog.GetName(), registry.Address())
369371
return registryPodHealthy(registry.Address())
370372
}

vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)