@@ -56,11 +56,12 @@ type Options struct {
56
56
TracerProvider trace.TracerProvider
57
57
Metrics * Metrics
58
58
59
- ForceCancelInterval time.Duration
60
- UpdateInterval time.Duration
61
- LogBufferInterval time.Duration
62
- Connector Connector
63
- InitConnectionCh chan struct {} // only to be used in tests
59
+ IsExternalProvisioner bool
60
+ ForceCancelInterval time.Duration
61
+ UpdateInterval time.Duration
62
+ LogBufferInterval time.Duration
63
+ Connector Connector
64
+ InitConnectionCh chan struct {} // only to be used in tests
64
65
}
65
66
66
67
// New creates and starts a provisioner daemon.
@@ -97,12 +98,13 @@ func New(clientDialer Dialer, opts *Options) *Server {
97
98
clientDialer : clientDialer ,
98
99
clientCh : make (chan proto.DRPCProvisionerDaemonClient ),
99
100
100
- closeContext : ctx ,
101
- closeCancel : ctxCancel ,
102
- closedCh : make (chan struct {}),
103
- shuttingDownCh : make (chan struct {}),
104
- acquireDoneCh : make (chan struct {}),
105
- initConnectionCh : opts .InitConnectionCh ,
101
+ closeContext : ctx ,
102
+ closeCancel : ctxCancel ,
103
+ closedCh : make (chan struct {}),
104
+ shuttingDownCh : make (chan struct {}),
105
+ acquireDoneCh : make (chan struct {}),
106
+ initConnectionCh : opts .InitConnectionCh ,
107
+ isExternalProvisioner : opts .IsExternalProvisioner ,
106
108
}
107
109
108
110
daemon .wg .Add (2 )
@@ -141,8 +143,9 @@ type Server struct {
141
143
// shuttingDownCh will receive when we start graceful shutdown
142
144
shuttingDownCh chan struct {}
143
145
// acquireDoneCh will receive when the acquireLoop exits
144
- acquireDoneCh chan struct {}
145
- activeJob * runner.Runner
146
+ acquireDoneCh chan struct {}
147
+ activeJob * runner.Runner
148
+ isExternalProvisioner bool
146
149
}
147
150
148
151
type Metrics struct {
@@ -239,7 +242,16 @@ connectLoop:
239
242
p .opts .Logger .Warn (p .closeContext , "coderd client failed to dial" , slog .Error (err ))
240
243
continue
241
244
}
242
- p .opts .Logger .Info (p .closeContext , "successfully connected to coderd" )
245
+ // This log is useful to verify that an external provisioner daemon is
246
+ // successfully connecting to coderd. It doesn't add much value if the
247
+ // daemon is built-in, so we only log it on the info level if isExternalProvisioner
248
+ // is true. This log message is mentioned in the docs:
249
+ // https://github.com/coder/coder/blob/5bd86cb1c06561d1d3e90ce689da220467e525c0/docs/admin/provisioners.md#L346
250
+ if p .isExternalProvisioner {
251
+ p .opts .Logger .Info (p .closeContext , "successfully connected to coderd" )
252
+ } else {
253
+ p .opts .Logger .Debug (p .closeContext , "successfully connected to coderd" )
254
+ }
243
255
retrier .Reset ()
244
256
p .initConnectionOnce .Do (func () {
245
257
close (p .initConnectionCh )
@@ -252,7 +264,11 @@ connectLoop:
252
264
client .DRPCConn ().Close ()
253
265
return
254
266
case <- client .DRPCConn ().Closed ():
255
- p .opts .Logger .Info (p .closeContext , "connection to coderd closed" )
267
+ if p .isExternalProvisioner {
268
+ p .opts .Logger .Info (p .closeContext , "connection to coderd closed" )
269
+ } else {
270
+ p .opts .Logger .Debug (p .closeContext , "connection to coderd closed" )
271
+ }
256
272
continue connectLoop
257
273
case p .clientCh <- client :
258
274
continue
0 commit comments