@@ -81,6 +81,7 @@ type RktDriverConfig struct {
81
81
PortMapRaw []map [string ]string `mapstructure:"port_map"` //
82
82
PortMap map [string ]string `mapstructure:"-"` // A map of host port and the port name defined in the image manifest file
83
83
Volumes []string `mapstructure:"volumes"` // Host-Volumes to mount in, syntax: /path/to/host/directory:/destination/path/in/container
84
+ InsecureOptions []string `mapstructure:"insecure_options"` // list of args for --insecure-options
84
85
85
86
Debug bool `mapstructure:"debug"` // Enable debug option for rkt command
86
87
}
@@ -155,6 +156,9 @@ func (d *RktDriver) Validate(config map[string]interface{}) error {
155
156
"volumes" : & fields.FieldSchema {
156
157
Type : fields .TypeArray ,
157
158
},
159
+ "insecure_options" : & fields.FieldSchema {
160
+ Type : fields .TypeArray ,
161
+ },
158
162
},
159
163
}
160
164
@@ -262,6 +266,18 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
262
266
// Disble signature verification if the trust command was not run.
263
267
insecure = true
264
268
}
269
+
270
+ // if we have a selective insecure_options, prefer them
271
+ // insecure options are rkt's global argument, so we do this before the actual "run"
272
+ if len (driverConfig .InsecureOptions ) > 0 {
273
+ cmdArgs = append (cmdArgs , fmt .Sprintf ("--insecure-options=%s" , strings .Join (driverConfig .InsecureOptions , "," )))
274
+ } else if insecure {
275
+ cmdArgs = append (cmdArgs , "--insecure-options=all" )
276
+ }
277
+
278
+ // same for debug
279
+ cmdArgs = append (cmdArgs , fmt .Sprintf ("--debug=%t" , debug ))
280
+
265
281
cmdArgs = append (cmdArgs , "run" )
266
282
267
283
// Write the UUID out to a file in the state dir so we can read it back
@@ -304,10 +320,6 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
304
320
}
305
321
306
322
cmdArgs = append (cmdArgs , img )
307
- if insecure {
308
- cmdArgs = append (cmdArgs , "--insecure-options=all" )
309
- }
310
- cmdArgs = append (cmdArgs , fmt .Sprintf ("--debug=%t" , debug ))
311
323
312
324
// Inject environment variables
313
325
for k , v := range ctx .TaskEnv .Map () {
0 commit comments