diff --git a/package.json b/package.json index 9f74ca582f..c0cfe2c5f8 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "dependencies": { "@hapi/call": "^6.0.1", "@hapi/subtext": "^6.1.2", - "@kubernetes/client-node": "0.11.0", + "@kubernetes/client-node": "0.11.1", "@types/cookie": "^0.3.3", "@types/fs-extra": "^8.0.0", "@types/proper-lockfile": "^4.1.1", diff --git a/patches/@kubernetes+client-node+0.11.0.patch b/patches/@kubernetes+client-node+0.11.0.patch deleted file mode 100644 index eefea6cb37..0000000000 --- a/patches/@kubernetes+client-node+0.11.0.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/node_modules/@kubernetes/client-node/dist/oidc_auth.js b/node_modules/@kubernetes/client-node/dist/oidc_auth.js -index a393b8d..652ce12 100644 ---- a/node_modules/@kubernetes/client-node/dist/oidc_auth.js -+++ b/node_modules/@kubernetes/client-node/dist/oidc_auth.js -@@ -38,6 +38,7 @@ class OpenIDConnectAuth { - return null; - } - const client = overrideClient ? overrideClient : yield this.getClient(user); -+ client.CLOCK_TOLERANCE = 10; - return this.refresh(user, client); - }); - } -@@ -46,6 +47,7 @@ class OpenIDConnectAuth { - if (Date.now() / 1000 > this.currentTokenExpiration) { - const newToken = yield client.refresh(user.authProvider.config['refresh-token']); - user.authProvider.config['id-token'] = newToken.id_token; -+ user.authProvider.config['refresh-token'] = newToken.refresh_token; - this.currentTokenExpiration = newToken.expires_at || 0; - } - return user.authProvider.config['id-token']; -@@ -53,6 +55,9 @@ class OpenIDConnectAuth { - } - getClient(user) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { -+ openid_client_1.Issuer.defaultHttpOptions = { -+ timeout: 10000 -+ } - const oidcIssuer = yield openid_client_1.Issuer.discover(user.authProvider.config['idp-issuer-url']); - return new oidcIssuer.Client({ - client_id: user.authProvider.config['client-id'], diff --git a/src/main/feature.ts b/src/main/feature.ts index d2494c1ba6..7999733104 100644 --- a/src/main/feature.ts +++ b/src/main/feature.ts @@ -62,7 +62,7 @@ export abstract class Feature { const result = await client.deleteNamespace("lens-metrics", 'false', undefined, undefined, undefined, "Foreground"); const nsVersion = result.body.metadata.resourceVersion; const nsWatch = new Watch(kc); - const req = nsWatch.watch('/api/v1/namespaces', {resourceVersion: nsVersion, fieldSelector: "metadata.name=lens-metrics"}, + const req = await nsWatch.watch('/api/v1/namespaces', {resourceVersion: nsVersion, fieldSelector: "metadata.name=lens-metrics"}, (type, obj) => { if(type === 'DELETED') { logger.debug(`namespace ${name} finally gone`) diff --git a/src/main/node-shell-session.ts b/src/main/node-shell-session.ts index 83bb222851..2593db6f99 100644 --- a/src/main/node-shell-session.ts +++ b/src/main/node-shell-session.ts @@ -101,11 +101,11 @@ export class NodeShellSession extends ShellSession { } protected waitForRunningPod(podId: string) { - return new Promise((resolve, reject) => { + return new Promise(async (resolve, reject) => { const kc = this.getKubeConfig(); const watch = new k8s.Watch(kc); - const req = watch.watch(`/api/v1/namespaces/kube-system/pods`, {}, + const req = await watch.watch(`/api/v1/namespaces/kube-system/pods`, {}, // callback is called for each received object. (_type, obj) => { if (obj.metadata.name == podId && obj.status.phase === "Running") { diff --git a/src/main/routes/watch.ts b/src/main/routes/watch.ts index 043d3bb7d9..8013860969 100644 --- a/src/main/routes/watch.ts +++ b/src/main/routes/watch.ts @@ -19,7 +19,7 @@ class ApiWatcher { this.response = response } - public start() { + public async start() { if (this.processor) { clearInterval(this.processor) } @@ -28,7 +28,7 @@ class ApiWatcher { events.map(event => this.sendEvent(event)) this.response.flushHeaders() }, 50) - this.watchRequest = this.watch.watch(this.apiUrl, {}, this.watchHandler.bind(this), this.doneHandler.bind(this)) + this.watchRequest = await this.watch.watch(this.apiUrl, {}, this.watchHandler.bind(this), this.doneHandler.bind(this)) } public stop() { diff --git a/yarn.lock b/yarn.lock index 6dc8136d8e..695a144da7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1018,10 +1018,10 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" -"@kubernetes/client-node@0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@kubernetes/client-node/-/client-node-0.11.0.tgz#e85a8c970bf784c72ff4d7c63e158a1651ed5394" - integrity sha512-1DQG9rNgn1fNpfStCBnvErGMcuF29ixGuQAjh3CVPLCFVsQCtNQjbSOIEV7XV18YEa2fj2hLU52TmJMSII0Kzw== +"@kubernetes/client-node@0.11.1": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@kubernetes/client-node/-/client-node-0.11.1.tgz#87ae6a8e4f3d1937acdda5ebc21ce49c18c820ae" + integrity sha512-0A4nwErxzJiGt3WYMR6rvcQF46hFz04b6uCmW7Kuj+Cl0zwe7KKxeMiqbZDtHPOq1CcOHOIcKNWCacUKL5CdxQ== dependencies: "@types/js-yaml" "^3.12.1" "@types/node" "^10.12.0" @@ -1035,6 +1035,7 @@ jsonpath-plus "^0.19.0" openid-client "2.5.0" request "^2.88.0" + rfc4648 "^1.3.0" shelljs "^0.8.2" tslib "^1.9.3" underscore "^1.9.1" @@ -9673,6 +9674,11 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= +rfc4648@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/rfc4648/-/rfc4648-1.3.0.tgz#2a69c76f05bc0e388feab933672de9b492af95f1" + integrity sha512-x36K12jOflpm1V8QjPq3I+pt7Z1xzeZIjiC8J2Oxd7bE1efTrOG241DTYVJByP/SxR9jl1t7iZqYxDX864jgBQ== + rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"