Skip to content

Commit

Permalink
chore: update @kubernetes/client-node to v1.0.0 (#10436)
Browse files Browse the repository at this point in the history
* chore: kubernetes client v1.0.0 + remove patches
Signed-off-by: Philippe Martin <[email protected]>

* fix: do not use AbortError
Signed-off-by: Philippe Martin <[email protected]>
  • Loading branch information
feloy authored Dec 19, 2024
1 parent 0c48de3 commit e310ee9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 253 deletions.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
},
"dependencies": {
"@docker/extension-api-client-types": "0.3.4",
"@kubernetes/client-node": "^1.0.0-rc7",
"@kubernetes/client-node": "^1.0.0",
"@segment/analytics-node": "^2.2.0",
"@types/semver": "^7.5.8",
"@types/stream-json": "^1.7.8",
Expand Down Expand Up @@ -218,9 +218,6 @@
"@docusaurus/theme-mermaid>mermaid": "^10.9.3",
"webpack-dev-server>http-proxy-middleware": "^2.0.7",
"@kubernetes/client-node>jsonpath-plus": "^10.0.7"
},
"patchedDependencies": {
"@kubernetes/[email protected]": "patches/@[email protected]"
}
},
"packageManager": "[email protected]+sha512.7f1de9cffea40ff4594c48a94776112a0db325e81fb18a9400362ff7b7247f4fbd76c3011611c9f8ac58743c3dc526017894e07948de9b72052f874ee2edfdcd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
***********************************************************************/

import type { Cluster, Context, User } from '@kubernetes/client-node';
import { AbortError, Health } from '@kubernetes/client-node';
import { Health } from '@kubernetes/client-node';
import { beforeEach, describe, expect, test, vi } from 'vitest';

import { ContextHealthChecker } from './context-health-checker.js';
Expand Down Expand Up @@ -158,7 +158,9 @@ test('onStateChange is not fired when readyz is rejected with an abort error', a
const onStateChangeCB = vi.fn();
hc.onStateChange(onStateChangeCB);

readyzMock.mockRejectedValue(new AbortError('a message'));
const err = new Error('a message');
err.name = 'AbortError';
readyzMock.mockRejectedValue(err);
await hc.start();
expect(onStateChangeCB).toHaveBeenCalledOnce();
expect(onStateChangeCB).toHaveBeenCalledWith({
Expand Down
8 changes: 6 additions & 2 deletions packages/main/src/plugin/kubernetes/context-health-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import { AbortError, Health } from '@kubernetes/client-node';
import { Health } from '@kubernetes/client-node';
import type { Disposable } from '@podman-desktop/api';

import type { Event } from '../events/emitter.js';
Expand Down Expand Up @@ -90,7 +90,7 @@ export class ContextHealthChecker implements Disposable {
};
this.#onStateChange.fire(this.#currentState);
} catch (err: unknown) {
if (!(err instanceof AbortError)) {
if (!this.isAbortError(err)) {
this.#currentState = {
kubeConfig: this.#kubeConfig,
contextName: this.#contextName,
Expand All @@ -111,4 +111,8 @@ export class ContextHealthChecker implements Disposable {
public getState(): ContextHealthState {
return this.#currentState;
}

private isAbortError(err: unknown): boolean {
return err instanceof Error && err.name === 'AbortError';
}
}
199 changes: 0 additions & 199 deletions patches/@[email protected]

This file was deleted.

Loading

0 comments on commit e310ee9

Please sign in to comment.