@@ -93,6 +93,7 @@ func (cs *commandService) CreateConnection(
9393 Error : err .Error (),
9494 },
9595 }
96+ cs .logger .Error (err , "error getting pod owner" )
9697 return response , grpcStatus .Errorf (codes .Internal , "error getting pod owner %s" , err .Error ())
9798 }
9899
@@ -145,12 +146,12 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
145146
146147 return err
147148 }
149+ deployment .Lock .RUnlock ()
148150
149151 // subscribe to the deployment broadcaster to get file updates
150152 broadcaster := deployment .GetBroadcaster ()
151153 channels := broadcaster .Subscribe ()
152154 defer broadcaster .CancelSubscription (channels .ID )
153- deployment .Lock .RUnlock ()
154155
155156 for {
156157 select {
@@ -175,7 +176,10 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
175176 return grpcStatus .Error (codes .Internal , err .Error ())
176177 }
177178 case err = <- msgr .Errors ():
178- cs .logger .Error (err , "connection error" )
179+ cs .logger .Error (err , "connection error" , "pod" , conn .PodName )
180+ deployment .SetPodErrorStatus (conn .PodName , err )
181+ channels .ResponseCh <- struct {}{}
182+
179183 if errors .Is (err , io .EOF ) {
180184 return grpcStatus .Error (codes .Aborted , err .Error ())
181185 }
@@ -214,7 +218,7 @@ func (cs *commandService) waitForConnection(
214218 case <- timer .C :
215219 return nil , nil , err
216220 case <- ticker .C :
217- if conn , ok := cs .connTracker .ConnectionIsReady (gi .IPAddress ); ok {
221+ if conn , ok := cs .connTracker .Ready (gi .IPAddress ); ok {
218222 // connection has been established, now ensure that the deployment exists in the store
219223 if deployment := cs .nginxDeployments .Get (conn .Parent ); deployment != nil {
220224 return & conn , deployment , nil
@@ -332,7 +336,7 @@ func (cs *commandService) logAndSendErrorStatus(deployment *Deployment, conn *ag
332336 if err != nil {
333337 cs .logger .Error (err , "error sending request to agent" )
334338 } else {
335- cs .logger .Info (fmt . Sprintf ( "Successfully configured nginx for new subscription %q" , conn .PodName ) )
339+ cs .logger .Info ("Successfully configured nginx for new subscription" , "pod" , conn .PodName )
336340 }
337341 deployment .SetPodErrorStatus (conn .PodName , err )
338342
0 commit comments