diff --git a/patches/@kubernetes__client-node@1.0.0-rc7.patch b/patches/@kubernetes__client-node@1.0.0-rc7.patch index 7dd20c334c6d1..1f8550ed4e9d5 100644 --- a/patches/@kubernetes__client-node@1.0.0-rc7.patch +++ b/patches/@kubernetes__client-node@1.0.0-rc7.patch @@ -14,3 +14,103 @@ index 3f7f6d2942d046a375f01a6c5a49d8b5cad8e2a7..f36613e12c280266768f5e7575c0970c case 'ADDED': case 'MODIFIED': addOrUpdateObject(this.objects, obj, this.callbackCache[informer_1.ADD].slice(), this.callbackCache[informer_1.UPDATE].slice()); +diff --git a/dist/health.d.ts b/dist/health.d.ts +new file mode 100644 +index 0000000000000000000000000000000000000000..aeedff6524c952b712330d02738898a99071632d +--- /dev/null ++++ b/dist/health.d.ts +@@ -0,0 +1,10 @@ ++import { KubeConfig } from './config'; ++import { RequestOptions } from 'node:https'; ++export declare class Health { ++ config: KubeConfig; ++ constructor(config: KubeConfig); ++ readyz(opts: RequestOptions): Promise; ++ livez(opts: RequestOptions): Promise; ++ private healthz; ++ private check; ++} +diff --git a/dist/health.js b/dist/health.js +new file mode 100644 +index 0000000000000000000000000000000000000000..bdd7eb7e3105431a2195c2a3f63a28a3598ce4d1 +--- /dev/null ++++ b/dist/health.js +@@ -0,0 +1,54 @@ ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); ++exports.Health = void 0; ++const tslib_1 = require("tslib"); ++const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); ++class Health { ++ constructor(config) { ++ this.config = config; ++ } ++ async readyz(opts) { ++ return this.check('/readyz', opts); ++ } ++ async livez(opts) { ++ return this.check('/livez', opts); ++ } ++ async healthz(opts) { ++ return this.check('/healthz', opts); ++ } ++ async check(path, opts) { ++ const cluster = this.config.getCurrentCluster(); ++ if (!cluster) { ++ throw new Error('No currently active cluster'); ++ } ++ const requestURL = new URL(cluster.server + path); ++ const requestInit = await this.config.applyToFetchOptions(opts); ++ if (opts.signal) { ++ requestInit.signal = opts.signal; ++ } ++ requestInit.method = 'GET'; ++ try { ++ const response = await (0, node_fetch_1.default)(requestURL.toString(), requestInit); ++ const status = response.status; ++ if (status === 200) { ++ return true; ++ } ++ if (status === 404) { ++ if (path === '/healthz') { ++ // /livez/readyz return 404 and healthz also returns 404, let's consider it is live ++ return true; ++ } ++ return this.healthz(opts); ++ } ++ return false; ++ } ++ catch (err) { ++ if (err instanceof Error && err.name === 'AbortError') { ++ throw err; ++ } ++ throw new Error('Error occurred in health request'); ++ } ++ } ++} ++exports.Health = Health; ++//# sourceMappingURL=health.js.map +\ No newline at end of file +diff --git a/dist/index.d.ts b/dist/index.d.ts +index 04f5e65e76c7cec21d02d29613e6ed04ff72c79f..2f1798f1c85920e7c3c425db1cab225eed72f2b5 100644 +--- a/dist/index.d.ts ++++ b/dist/index.d.ts +@@ -14,5 +14,6 @@ export * from './cp'; + export * from './patch'; + export * from './metrics'; + export * from './object'; ++export * from './health'; + export { ConfigOptions, User, Cluster, Context } from './config_types'; + export { AbortError, FetchError } from 'node-fetch'; +diff --git a/dist/index.js b/dist/index.js +index 9c3ad1c9cbe64251c4e7cd6de0ebb4f5543243f6..64d0491a7df5ca623f0aacb0f251a43a4de5e017 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -18,6 +18,7 @@ tslib_1.__exportStar(require("./cp"), exports); + tslib_1.__exportStar(require("./patch"), exports); + tslib_1.__exportStar(require("./metrics"), exports); + tslib_1.__exportStar(require("./object"), exports); ++tslib_1.__exportStar(require("./health"), exports); + // Export AbortError and FetchError so that instanceof checks in user code will definitely use the same instances + var node_fetch_1 = require("node-fetch"); + Object.defineProperty(exports, "AbortError", { enumerable: true, get: function () { return node_fetch_1.AbortError; } }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c9a0ed18f187..6ff222b92d2e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,7 +15,7 @@ overrides: patchedDependencies: '@kubernetes/client-node@1.0.0-rc7': - hash: nvb6em7iqff4wvrdgasjxmjpju + hash: itrsbkb3fr7spxemffsb4x737y path: patches/@kubernetes__client-node@1.0.0-rc7.patch importers: @@ -27,7 +27,7 @@ importers: version: 0.3.4 '@kubernetes/client-node': specifier: ^1.0.0-rc7 - version: 1.0.0-rc7(patch_hash=nvb6em7iqff4wvrdgasjxmjpju)(encoding@0.1.13) + version: 1.0.0-rc7(patch_hash=itrsbkb3fr7spxemffsb4x737y)(encoding@0.1.13) '@segment/analytics-node': specifier: ^2.2.0 version: 2.2.0(encoding@0.1.13) @@ -223,7 +223,7 @@ importers: version: 9.15.0(jiti@1.21.6) eslint-import-resolver-custom-alias: specifier: ^1.3.2 - version: 1.3.2(eslint-plugin-import@2.31.0) + version: 1.3.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6))) eslint-import-resolver-typescript: specifier: ^3.6.3 version: 3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)) @@ -247,7 +247,7 @@ importers: version: 12.1.1(eslint@9.15.0(jiti@1.21.6)) eslint-plugin-sonarjs: specifier: ^2.0.4 - version: 2.0.4(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) + version: 2.0.4(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)) eslint-plugin-unicorn: specifier: ^56.0.1 version: 56.0.1(eslint@9.15.0(jiti@1.21.6)) @@ -15220,11 +15220,11 @@ snapshots: '@isaacs/cliui@8.0.2': dependencies: - string-width: 5.1.2 + string-width: 4.2.3 string-width-cjs: string-width@4.2.3 strip-ansi: 7.1.0 strip-ansi-cjs: strip-ansi@6.0.1 - wrap-ansi: 8.1.0 + wrap-ansi: 7.0.0 wrap-ansi-cjs: wrap-ansi@7.0.0 '@isaacs/fs-minipass@4.0.1': @@ -15276,7 +15276,7 @@ snapshots: dependencies: jsep: 1.4.0 - '@kubernetes/client-node@1.0.0-rc7(patch_hash=nvb6em7iqff4wvrdgasjxmjpju)(encoding@0.1.13)': + '@kubernetes/client-node@1.0.0-rc7(patch_hash=itrsbkb3fr7spxemffsb4x737y)(encoding@0.1.13)': dependencies: '@types/js-yaml': 4.0.9 '@types/node': 22.9.1 @@ -17163,7 +17163,7 @@ snapshots: app-builder-bin@5.0.0-alpha.10: {} - app-builder-lib@25.1.8(dmg-builder@25.1.8)(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)): + app-builder-lib@25.1.8(dmg-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)))(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)): dependencies: '@develar/schema-utils': 2.6.5 '@electron/notarize': 2.5.0 @@ -18710,7 +18710,7 @@ snapshots: dmg-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)): dependencies: - app-builder-lib: 25.1.8(dmg-builder@25.1.8)(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) + app-builder-lib: 25.1.8(dmg-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)))(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) builder-util: 25.1.7 builder-util-runtime: 9.2.10 fs-extra: 10.1.0 @@ -18877,7 +18877,7 @@ snapshots: electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8): dependencies: - app-builder-lib: 25.1.8(dmg-builder@25.1.8)(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) + app-builder-lib: 25.1.8(dmg-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)))(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) archiver: 5.3.2 builder-util: 25.1.7 fs-extra: 10.1.0 @@ -18888,7 +18888,7 @@ snapshots: electron-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)): dependencies: - app-builder-lib: 25.1.8(dmg-builder@25.1.8)(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) + app-builder-lib: 25.1.8(dmg-builder@25.1.8(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)))(electron-builder-squirrel-windows@25.1.8(dmg-builder@25.1.8)) builder-util: 25.1.7 builder-util-runtime: 9.2.10 chalk: 4.1.2 @@ -19271,7 +19271,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-custom-alias@1.3.2(eslint-plugin-import@2.31.0): + eslint-import-resolver-custom-alias@1.3.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6))): dependencies: eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) glob-parent: 6.0.2 @@ -19291,7 +19291,7 @@ snapshots: debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 9.15.0(jiti@1.21.6) - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 @@ -19304,7 +19304,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)): dependencies: debug: 3.2.7 optionalDependencies: @@ -19334,7 +19334,7 @@ snapshots: nanospinner: 1.2.0 picocolors: 1.1.1 - eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)): + eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -19345,7 +19345,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.15.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -19373,7 +19373,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.15.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -19454,7 +19454,7 @@ snapshots: dependencies: eslint: 9.15.0(jiti@1.21.6) - eslint-plugin-sonarjs@2.0.4(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)): + eslint-plugin-sonarjs@2.0.4(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)): dependencies: '@babel/core': 7.25.2 '@babel/eslint-parser': 7.25.1(@babel/core@7.25.2)(eslint@9.15.0(jiti@1.21.6)) @@ -19468,7 +19468,7 @@ snapshots: builtin-modules: 3.3.0 bytes: 3.1.2 eslint: 9.15.0(jiti@1.21.6) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.15.0(jiti@1.21.6)) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6)) eslint-plugin-jsx-a11y: 6.10.0(eslint@9.15.0(jiti@1.21.6)) eslint-plugin-react: 7.36.1(eslint@9.15.0(jiti@1.21.6)) eslint-plugin-react-hooks: 4.6.2(eslint@9.15.0(jiti@1.21.6))