@@ -46,6 +46,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
46
46
pollInterval time.Duration
47
47
pollJitter time.Duration
48
48
preSharedKey string
49
+ provisionerKey string
49
50
verbose bool
50
51
51
52
prometheusEnable bool
@@ -113,6 +114,19 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
113
114
return err
114
115
}
115
116
117
+ if provisionerKey != "" {
118
+ if preSharedKey != "" {
119
+ return xerrors .New ("cannot provide both provisioner key --key and pre-shared key --psk" )
120
+ }
121
+ if len (rawTags ) > 0 {
122
+ return xerrors .New ("cannot provide tags when using provisioner key" )
123
+ }
124
+ // _, err := provisionerkey.Parse(provisionerKey)
125
+ // if err != nil {
126
+ // return xerrors.Errorf("parse provisioner key: %w", err)
127
+ // }
128
+ }
129
+
116
130
logOpts := []clilog.Option {
117
131
clilog .WithFilter (logFilter ... ),
118
132
clilog .WithHuman (logHuman ),
@@ -136,10 +150,10 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
136
150
logger .Info (ctx , "note: untagged provisioners can only pick up jobs from untagged templates" )
137
151
}
138
152
139
- // When authorizing with a PSK, we automatically scope the provisionerd
140
- // to organization. Scoping to user with PSK auth is not a valid configuration.
141
- if preSharedKey != "" {
142
- logger .Info (ctx , "psk auth automatically sets tag " + provisionersdk .TagScope + "=" + provisionersdk .ScopeOrganization )
153
+ // When authorizing with a PSK / provisioner key , we automatically scope the provisionerd
154
+ // to organization. Scoping to user with PSK / provisioner key auth is not a valid configuration.
155
+ if preSharedKey != "" || provisionerKey != "" {
156
+ logger .Info (ctx , "psk or provisioner key auth automatically sets tag " + provisionersdk .TagScope + "=" + provisionersdk .ScopeOrganization )
143
157
tags [provisionersdk .TagScope ] = provisionersdk .ScopeOrganization
144
158
}
145
159
@@ -213,6 +227,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
213
227
Tags : tags ,
214
228
PreSharedKey : preSharedKey ,
215
229
Organization : org .ID ,
230
+ // ProvisionerKey: provisionerKey,
216
231
})
217
232
}, & provisionerd.Options {
218
233
Logger : logger ,
@@ -296,6 +311,13 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
296
311
Description : "Pre-shared key to authenticate with Coder server." ,
297
312
Value : serpent .StringOf (& preSharedKey ),
298
313
},
314
+ {
315
+ Flag : "key" ,
316
+ Env : "CODER_PROVISIONER_DAEMON_KEY" ,
317
+ Description : "Provisioner key to authenticate with Coder server." ,
318
+ Value : serpent .StringOf (& provisionerKey ),
319
+ Hidden : true ,
320
+ },
299
321
{
300
322
Flag : "name" ,
301
323
Env : "CODER_PROVISIONER_DAEMON_NAME" ,
0 commit comments