@@ -77,7 +77,7 @@ func (cs *commandService) CreateConnection(
7777 return nil , errors .New ("empty connection request" )
7878 }
7979
80- gi , ok := grpcContext .FromContext (ctx )
80+ grpcInfo , ok := grpcContext .FromContext (ctx )
8181 if ! ok {
8282 return nil , agentgrpc .ErrStatusInvalidConnection
8383 }
@@ -105,7 +105,7 @@ func (cs *commandService) CreateConnection(
105105 ParentType : depType ,
106106 InstanceID : getNginxInstanceID (resource .GetInstances ()),
107107 }
108- cs .connTracker .Track (gi .UUID , conn )
108+ cs .connTracker .Track (grpcInfo .UUID , conn )
109109
110110 return & pb.CreateConnectionResponse {
111111 Response : & pb.CommandResponse {
@@ -127,31 +127,31 @@ func (cs *commandService) CreateConnection(
127127func (cs * commandService ) Subscribe (in pb.CommandService_SubscribeServer ) error {
128128 ctx := in .Context ()
129129
130- gi , ok := grpcContext .FromContext (ctx )
130+ grpcInfo , ok := grpcContext .FromContext (ctx )
131131 if ! ok {
132132 return agentgrpc .ErrStatusInvalidConnection
133133 }
134- defer cs .connTracker .RemoveConnection (gi .UUID )
134+ defer cs .connTracker .RemoveConnection (grpcInfo .UUID )
135135
136136 // wait for the agent to report itself and nginx
137- conn , deployment , err := cs .waitForConnection (ctx , gi )
137+ conn , deployment , err := cs .waitForConnection (ctx , grpcInfo )
138138 if err != nil {
139139 cs .logger .Error (err , "error waiting for connection" )
140140 return err
141141 }
142- defer deployment .RemovePodStatus (gi .UUID )
142+ defer deployment .RemovePodStatus (grpcInfo .UUID )
143143
144144 cs .logger .Info (
145145 "Successfully connected to nginx agent" ,
146146 conn .ParentType , conn .ParentName ,
147- "uuid" , gi .UUID ,
147+ "uuid" , grpcInfo .UUID ,
148148 )
149149
150150 msgr := messenger .New (in )
151151 go msgr .Run (ctx )
152152
153153 // apply current config before starting event loop
154- if err := cs .setInitialConfig (ctx , & gi , deployment , conn , msgr ); err != nil {
154+ if err := cs .setInitialConfig (ctx , & grpcInfo , deployment , conn , msgr ); err != nil {
155155 return err
156156 }
157157
@@ -193,7 +193,7 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
193193 cs .logger .V (1 ).Info ("Sending configuration to agent" , "requestType" , msg .Type )
194194 if err := msgr .Send (ctx , req ); err != nil {
195195 cs .logger .Error (err , "error sending request to agent" )
196- deployment .SetPodErrorStatus (gi .UUID , err )
196+ deployment .SetPodErrorStatus (grpcInfo .UUID , err )
197197 channels .ResponseCh <- struct {}{}
198198
199199 return grpcStatus .Error (codes .Internal , err .Error ())
@@ -203,8 +203,8 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
203203 // Only broadcast operations should signal ResponseCh for coordination.
204204 pendingBroadcastRequest = & msg
205205 case err = <- msgr .Errors ():
206- cs .logger .Error (err , "connection error" , conn .ParentType , conn .ParentName , "uuid" , gi .UUID )
207- deployment .SetPodErrorStatus (gi .UUID , err )
206+ cs .logger .Error (err , "connection error" , conn .ParentType , conn .ParentName , "uuid" , grpcInfo .UUID )
207+ deployment .SetPodErrorStatus (grpcInfo .UUID , err )
208208 select {
209209 case channels .ResponseCh <- struct {}{}:
210210 default :
@@ -225,9 +225,9 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
225225 continue
226226 }
227227 err := fmt .Errorf ("msg: %s; error: %s" , res .GetMessage (), res .GetError ())
228- deployment .SetPodErrorStatus (gi .UUID , err )
228+ deployment .SetPodErrorStatus (grpcInfo .UUID , err )
229229 } else {
230- deployment .SetPodErrorStatus (gi .UUID , nil )
230+ deployment .SetPodErrorStatus (grpcInfo .UUID , nil )
231231 }
232232
233233 // Signal broadcast completion only for tracked broadcast operations.
@@ -239,7 +239,7 @@ func (cs *commandService) Subscribe(in pb.CommandService_SubscribeServer) error
239239 cs .logger .V (1 ).Info (
240240 "Received response for non-broadcast request (likely initial config)" ,
241241 conn .ParentType , conn .ParentName ,
242- "uuid" , gi .UUID ,
242+ "uuid" , grpcInfo .UUID ,
243243 )
244244 }
245245 }
@@ -537,7 +537,7 @@ func (cs *commandService) UpdateDataPlaneStatus(
537537 return nil , errors .New ("empty UpdateDataPlaneStatus request" )
538538 }
539539
540- gi , ok := grpcContext .FromContext (ctx )
540+ grpcInfo , ok := grpcContext .FromContext (ctx )
541541 if ! ok {
542542 return nil , agentgrpc .ErrStatusInvalidConnection
543543 }
@@ -547,7 +547,7 @@ func (cs *commandService) UpdateDataPlaneStatus(
547547 return nil , grpcStatus .Errorf (codes .InvalidArgument , "request does not contain nginx instanceID" )
548548 }
549549
550- cs .connTracker .SetInstanceID (gi .UUID , instanceID )
550+ cs .connTracker .SetInstanceID (grpcInfo .UUID , instanceID )
551551
552552 return & pb.UpdateDataPlaneStatusResponse {}, nil
553553}
0 commit comments