@@ -270,15 +270,42 @@ local function get_apiserver(conf)
270270 if err then
271271 return nil , err
272272 end
273+ elseif conf .client .certificate and conf .client .key then
274+ apiserver .certificate , err = read_env (conf .client .certificate )
275+ if err then
276+ return nil , err
277+ end
278+ apiserver .key , err = read_env (conf .client .key )
279+ if err then
280+ return nil , err
281+ end
273282 else
274- return nil , " one of [client.token,client.token_file] should be set but none"
283+ return nil , " one of [client.token,client.token_file, (client.certificate, client.key)] should be set but none"
284+ end
285+
286+ apiserver .ssl_verify = false
287+ if conf .client .ssl_verify then
288+ apiserver .ssl_verify , err = read_env (conf .client .ssl_verify )
289+ if err then
290+ return nil , err
291+ end
292+ if apiserver .ssl_verify ~= " true" and apiserver .ssl_verify ~= " false" then
293+ return nil , " client.ssl_verify should be set to one of [true,false] but " .. apiserver .ssl_verify
294+ end
295+ if apiserver .ssl_verify == " true" then
296+ apiserver .ssl_verify = true
297+ end
275298 end
276299
277300 -- remove possible extra whitespace
278301 apiserver .token = apiserver .token :gsub (" %s+" , " " )
302+ apiserver .certificate = apiserver .certificate :gsub (" %s+" , " " )
303+ apiserver .key = apiserver .key :gsub (" %s+" , " " )
279304
280- if apiserver .schema == " https" and apiserver .token == " " then
281- return nil , " apiserver.token should set to non-empty string when service.schema is https"
305+ if apiserver .schema == " https" then
306+ if (apiserver .token == " " or apiserver .certificate == " " or apiserver .key == " " ) then
307+ return nil , " apiserver.token or (apiserver.certificate and apiserver.key) should set to non-empty string when service.schema is https"
308+ end
282309 end
283310
284311 return apiserver
0 commit comments