Skip to content

Commit 41323d2

Browse files
committed
Fix
Signed-off-by: perdasilva <perdasilva@redhat.com>
1 parent c3d97d8 commit 41323d2

File tree

8 files changed

+54
-4
lines changed

8 files changed

+54
-4
lines changed

staging/operator-lifecycle-manager/cmd/catalog/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func main() {
4747
}
4848

4949
func (o *options) run(ctx context.Context, logger *logrus.Logger) error {
50+
logger.Info("[CHECK] YES!!!!")
5051
// If the catalogNamespaceEnvVarName environment variable is set, then update the value of catalogNamespace.
5152
if catalogNamespaceEnvVarValue := os.Getenv(catalogNamespaceEnvVarName); catalogNamespaceEnvVarValue != "" {
5253
logger.Infof("%s environment variable is set. Updating Global Catalog Namespace to %s", catalogNamespaceEnvVarName, catalogNamespaceEnvVarValue)

staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,12 @@ func (o *Operator) syncSourceState(state grpc.SourceState) {
463463
o.sourcesLastUpdate.Set(o.now().Time)
464464

465465
o.logger.Debugf("state.Key.Namespace=%s state.Key.Name=%s state.State=%s", state.Key.Namespace, state.Key.Name, state.State.String())
466+
o.logger.Debug("[STATE] hello")
466467
metrics.RegisterCatalogSourceState(state.Key.Name, state.Key.Namespace, state.State)
467468

468469
switch state.State {
470+
case connectivity.Idle:
471+
fallthrough
469472
case connectivity.Ready:
470473
o.resolverSourceProvider.Invalidate(resolvercache.SourceKey(state.Key))
471474
if o.namespace == state.Key.Namespace {
@@ -765,6 +768,8 @@ func (o *Operator) syncConnection(logger *logrus.Entry, in *v1alpha1.CatalogSour
765768
}
766769

767770
updateConnectionStateFunc := func(out *v1alpha1.CatalogSource, source *grpc.SourceMeta) {
771+
logger.Infof("[TAG] Updating connection state: %s -> %s (%s)", source.Address, source.ConnectionState.String(), source.LastConnect.String())
772+
fmt.Printf("[TAG] Updating connection state: %s -> %s (%s)\n", source.Address, source.ConnectionState.String(), source.LastConnect.String())
768773
out.Status.GRPCConnectionState = &v1alpha1.GRPCConnectionState{
769774
Address: source.Address,
770775
LastObservedState: source.ConnectionState.String(),
@@ -862,15 +867,19 @@ func (o *Operator) syncCatalogSources(obj interface{}) (syncError error) {
862867
out, syncError := syncFunc(in, chain)
863868

864869
if out == nil {
870+
logger.Debug("[TAG] out is nil -- skipping update")
865871
return
866872
}
867873

868874
if equalFunc(&catsrc.Status, &out.Status) {
875+
logger.Debug("[TAG] no change in status -- skipping update")
869876
return
870877
}
871878

879+
logger.Debug("[TAG] Updating status")
872880
updateErr := catalogsource.UpdateStatus(logger, o.client, out)
873881
if syncError == nil && updateErr != nil {
882+
logger.Debugf("[TAG] error updating: %s\n", updateErr)
874883
syncError = updateErr
875884
}
876885

staging/operator-lifecycle-manager/pkg/controller/registry/grpc/source.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ func grpcConnection(address string) (*grpc.ClientConn, error) {
169169
func (s *SourceStore) Add(key registry.CatalogKey, address string) (*SourceConn, error) {
170170
_ = s.Remove(key)
171171

172-
conn, err := grpcConnection(address)
172+
s.logger.Debugf("[STATE] (%s) Adding new source with address: %s", key, address)
173+
conn, err := grpc.Dial(address, grpc.WithInsecure())
174+
// conn, err := grpcConnection(address)
173175
if err != nil {
174176
return nil, err
175177
}
@@ -189,6 +191,7 @@ func (s *SourceStore) Add(key registry.CatalogKey, address string) (*SourceConn,
189191
s.sources[key] = source
190192
s.sourcesLock.Unlock()
191193

194+
s.logger.Debugf("[STATE] (%s) watching source with address: %s", key, address)
192195
go s.watch(ctx, key, source)
193196

194197
return &source, nil
@@ -203,21 +206,29 @@ func (s *SourceStore) stateTimeout(state connectivity.State) time.Duration {
203206

204207
func (s *SourceStore) watch(ctx context.Context, key registry.CatalogKey, source SourceConn) {
205208
state := source.ConnectionState
209+
s.logger.Debugf("[STATE] (%s) Watching for state changes", key)
206210
for {
207211
select {
208212
case <-ctx.Done():
213+
s.logger.Debugf("[STATE] (%s) Done", key)
209214
return
210215
default:
211216
func() {
217+
s.logger.Debugf("[STATE] (%s) Checking", key)
212218
timer, cancel := context.WithTimeout(ctx, s.stateTimeout(state))
213-
defer cancel()
219+
defer func() {
220+
s.logger.Debugf("[STATE] (%s) Cancelling", key)
221+
cancel()
222+
}()
214223
if source.Conn.WaitForStateChange(timer, state) {
215224
newState := source.Conn.GetState()
216225
state = newState
226+
s.logger.Debugf("[STATE] (%s) State: %s", key, state)
217227

218228
// update connection state
219229
src := s.Get(key)
220230
if src == nil {
231+
s.logger.Debugf("[STATE] (%s) source not found -- clean up", key)
221232
// source was removed, cleanup this goroutine
222233
return
223234
}
@@ -229,7 +240,10 @@ func (s *SourceStore) watch(ctx context.Context, key registry.CatalogKey, source
229240
s.sourcesLock.Unlock()
230241

231242
// notify subscriber
243+
s.logger.Debugf("[STATE] (%s) publishing state", key)
232244
s.notify <- SourceState{Key: key, State: newState}
245+
} else {
246+
s.logger.Debugf("[STATE] no state change within timeout window")
233247
}
234248
}()
235249
}

staging/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func (o *operator) start(ctx context.Context) error {
195195
return
196196
}
197197
o.logger.Infof("connection established. cluster-version: %v", v)
198+
o.logger.Infof("connection is _really_ established: %v", v)
198199
}()
199200

200201
select {

vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/catalog/main.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/grpc/source.go

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)