Skip to content

Commit

Permalink
feat(insecureSkipTlsVerify): plumb an option to skip verifying server…
Browse files Browse the repository at this point in the history
… certs (#61)
  • Loading branch information
silasbw authored Jan 20, 2017
1 parent f8ae84c commit 901773e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ const k8 = new K8Api({
});
```

or without a certificate authority:

```js
const k8 = new K8Api({
url: 'https://my-k8-api-server.com',
insecureSkipTlsVerify: true,
auth: {
user: 'user',
pass: 'pass'
}
});
```

token authentication:

```js
Expand Down
9 changes: 9 additions & 0 deletions lib/api-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class ApiGroup {
* @param {string} options.api - Kubernetes API URL
* @param {string} options.version - Kubernetes API version
* @param {string} options.namespace - Default namespace
* @param {string} options.ca - Certificate authority
* @param {string} options.cert - Client certificate
* @param {string} options.key - Client key
* @param {boolean} options.insecureSkipTlsVerify - Skip the validity check
* on the server's certificate.
*/
constructor(options) {
this.url = options.url;
Expand All @@ -23,6 +28,10 @@ class ApiGroup {
this.requestOptions.cert = options.cert;
this.requestOptions.key = options.key;

if ('insecureSkipTlsVerify' in options) {
this.requestOptions.strictSSL = !options.insecureSkipTlsVerify;
}

if (options.auth) {
this.requestOptions.auth = options.auth;
}
Expand Down

0 comments on commit 901773e

Please sign in to comment.