kubernetes-fluent-client 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fluent/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAS,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAO5E;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkBvF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAqBvE;AACD;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMvD;AACD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,YAAY,EAChD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,OAAO,EAChB,WAAW,UAAQ,OAwDpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CA+BnE;AASD;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EACrD,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,CA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k8sExec(model, filters, method, payload, applyCfg = { force: fals
189
189
  const reconstruct = async (method) => {
190
190
  const configMethod = method === "LOG" ? "GET" : method;
191
191
  const { opts, serverUrl } = await k8sCfg(configMethod);
192
- const isPost = method === "POST";
193
- const baseUrl = pathBuilder(serverUrl.toString(), model, filters, isPost);
194
- if (method === "LOG") {
195
- baseUrl.pathname = `${baseUrl.pathname}/log`;
192
+ // Build the base path once, using excludeName only for standard POST requests
193
+ const shouldExcludeName = method === "POST" && !(payload && isEvictionPayload(payload));
194
+ const baseUrl = pathBuilder(serverUrl.toString(), model, filters, shouldExcludeName);
195
+ // Append appropriate subresource paths
196
+ if (payload && isEvictionPayload(payload)) {
197
+ baseUrl.pathname = `${baseUrl.pathname}/eviction`;
196
198
  }
197
- // Check if payload is an Eviction with metadata
198
- if (payload && isEvictionPayload(payload) && payload.metadata?.name) {
199
- baseUrl.pathname = `${baseUrl.pathname}/${payload.metadata.name}/eviction`;
199
+ else if (method === "LOG") {
200
+ baseUrl.pathname = `${baseUrl.pathname}/log`;
200
201
  }
201
202
  return {
202
203
  serverUrl: baseUrl,
@@ -372,7 +372,7 @@ class Watcher {
372
372
  }
373
373
  const now = Date.now();
374
374
  // If the last seen time is greater than the limit, trigger a resync
375
- if (this.#lastSeenTime == OVERRIDE || now - this.#lastSeenTime > this.#lastSeenLimit) {
375
+ if (this.#lastSeenTime === OVERRIDE || now - this.#lastSeenTime > this.#lastSeenLimit) {
376
376
  // Reset the last seen time to now to allow the resync to be called again in case of failure
377
377
  this.#lastSeenTime = now;
378
378
  // If there are more attempts, retry the watch (undefined is unlimited retries)
@@ -35,10 +35,9 @@ export declare function prepareInputData(name: string, schema: string): Promise<
35
35
  * Generates TypeScript types using quicktype.
36
36
  *
37
37
  * @param inputData - The input data for quicktype.
38
- * @param opts - The options for generating the TypeScript types.
39
38
  * @returns A promise that resolves to an array of generated TypeScript type lines.
40
39
  */
41
- export declare function generateTypes(inputData: InputData, opts: GenerateOptions): Promise<string[]>;
40
+ export declare function generateTypes(inputData: InputData): Promise<string[]>;
42
41
  /**
43
42
  * Writes the processed lines to the output file.
44
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,SAAS,EAET,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,wBAAwB,EAC7B,IAAI,EAAE,eAAe,GACpB,OAAO,CACR;IACE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,EAAE,CACJ,CAuCA;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAYvF;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CAYnB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EAC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,CACR;IACE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,EAAE,CACJ,CAuCA;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAYvF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAW3E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,MAAM,GAAG,cAAc,GAChC,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CA0B/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAMtD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAC5D;IACE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,EAAE,CACJ,CA8BA"}
package/dist/generate.js CHANGED
@@ -75,7 +75,7 @@ async function convertCRDtoTS(crd, opts) {
75
75
  const schema = JSON.stringify(match.schema.openAPIV3Schema);
76
76
  opts.logFn(`- Generating ${crd.spec.group}/${match.name} types for ${name}`);
77
77
  const inputData = await prepareInputData(name, schema);
78
- const generatedTypes = await generateTypes(inputData, opts);
78
+ const generatedTypes = await generateTypes(inputData);
79
79
  const fileName = `${name.toLowerCase()}-${match.name.toLowerCase()}`;
80
80
  writeGeneratedFile(fileName, opts.directory || "", generatedTypes, opts.language || "ts");
81
81
  results[fileName] = generatedTypes;
@@ -104,16 +104,14 @@ async function prepareInputData(name, schema) {
104
104
  * Generates TypeScript types using quicktype.
105
105
  *
106
106
  * @param inputData - The input data for quicktype.
107
- * @param opts - The options for generating the TypeScript types.
108
107
  * @returns A promise that resolves to an array of generated TypeScript type lines.
109
108
  */
110
- async function generateTypes(inputData, opts) {
109
+ async function generateTypes(inputData) {
111
110
  // If the language is not specified, default to TypeScript
112
- const language = opts.language || "ts";
113
111
  // Generate the types
114
112
  const out = await (0, quicktype_core_1.quicktype)({
115
113
  inputData,
116
- lang: language,
114
+ lang: "ts",
117
115
  rendererOptions: { "just-types": "true" },
118
116
  });
119
117
  return out.lines;
@@ -1,4 +1,4 @@
1
1
  /** a is a collection of K8s types to be used within an action: `When(a.Configmap)` */
2
- export { CoreV1Event as CoreEvent, EventsV1Event as Event, V1APIService as APIService, V1CSIDriver as CSIDriver, V1CertificateSigningRequest as CertificateSigningRequest, V1ClusterRole as ClusterRole, V1ClusterRoleBinding as ClusterRoleBinding, V1ConfigMap as ConfigMap, V1ControllerRevision as ControllerRevision, V1CronJob as CronJob, V1CustomResourceDefinition as CustomResourceDefinition, V1DaemonSet as DaemonSet, V1Deployment as Deployment, V1EndpointSlice as EndpointSlice, V1Endpoints as Endpoints, V1Eviction as Eviction, V1HorizontalPodAutoscaler as HorizontalPodAutoscaler, V1Ingress as Ingress, V1IngressClass as IngressClass, V1Job as Job, V1LimitRange as LimitRange, V1LocalSubjectAccessReview as LocalSubjectAccessReview, V1MutatingWebhookConfiguration as MutatingWebhookConfiguration, V1Namespace as Namespace, V1NetworkPolicy as NetworkPolicy, V1Node as Node, V1PersistentVolume as PersistentVolume, V1PersistentVolumeClaim as PersistentVolumeClaim, V1Pod as Pod, V1PodDisruptionBudget as PodDisruptionBudget, V1PodTemplate as PodTemplate, V1ReplicaSet as ReplicaSet, V1ReplicationController as ReplicationController, V1ResourceQuota as ResourceQuota, V1Role as Role, V1RoleBinding as RoleBinding, V1RuntimeClass as RuntimeClass, V1Secret as Secret, V1SelfSubjectAccessReview as SelfSubjectAccessReview, V1SelfSubjectRulesReview as SelfSubjectRulesReview, V1Service as Service, V1ServiceAccount as ServiceAccount, V1StatefulSet as StatefulSet, V1StorageClass as StorageClass, V1SubjectAccessReview as SubjectAccessReview, V1TokenReview as TokenReview, V1ValidatingWebhookConfiguration as ValidatingWebhookConfiguration, V1VolumeAttachment as VolumeAttachment, } from "@kubernetes/client-node";
2
+ export { CoreV1Event as CoreEvent, EventsV1Event as Event, V1APIService as APIService, V1CSIDriver as CSIDriver, V1CertificateSigningRequest as CertificateSigningRequest, V1ClusterRole as ClusterRole, V1ClusterRoleBinding as ClusterRoleBinding, V1ConfigMap as ConfigMap, V1ControllerRevision as ControllerRevision, V1CronJob as CronJob, V1CustomResourceDefinition as CustomResourceDefinition, V1DaemonSet as DaemonSet, V1Deployment as Deployment, V1EndpointSlice as EndpointSlice, V1Endpoints as Endpoints, V1HorizontalPodAutoscaler as HorizontalPodAutoscaler, V1Ingress as Ingress, V1IngressClass as IngressClass, V1Job as Job, V1LimitRange as LimitRange, V1LocalSubjectAccessReview as LocalSubjectAccessReview, V1MutatingWebhookConfiguration as MutatingWebhookConfiguration, V1Namespace as Namespace, V1NetworkPolicy as NetworkPolicy, V1Node as Node, V1PersistentVolume as PersistentVolume, V1PersistentVolumeClaim as PersistentVolumeClaim, V1Pod as Pod, V1PodDisruptionBudget as PodDisruptionBudget, V1PodTemplate as PodTemplate, V1ReplicaSet as ReplicaSet, V1ReplicationController as ReplicationController, V1ResourceQuota as ResourceQuota, V1Role as Role, V1RoleBinding as RoleBinding, V1RuntimeClass as RuntimeClass, V1Secret as Secret, V1SelfSubjectAccessReview as SelfSubjectAccessReview, V1SelfSubjectRulesReview as SelfSubjectRulesReview, V1Service as Service, V1ServiceAccount as ServiceAccount, V1StatefulSet as StatefulSet, V1StorageClass as StorageClass, V1SubjectAccessReview as SubjectAccessReview, V1TokenReview as TokenReview, V1ValidatingWebhookConfiguration as ValidatingWebhookConfiguration, V1VolumeAttachment as VolumeAttachment, } from "@kubernetes/client-node";
3
3
  export { GenericKind } from "./types";
4
4
  //# sourceMappingURL=upstream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upstream.d.ts","sourceRoot":"","sources":["../src/upstream.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,OAAO,EACL,WAAW,IAAI,SAAS,EACxB,aAAa,IAAI,KAAK,EACtB,YAAY,IAAI,UAAU,EAC1B,WAAW,IAAI,SAAS,EACxB,2BAA2B,IAAI,yBAAyB,EACxD,aAAa,IAAI,WAAW,EAC5B,oBAAoB,IAAI,kBAAkB,EAC1C,WAAW,IAAI,SAAS,EACxB,oBAAoB,IAAI,kBAAkB,EAC1C,SAAS,IAAI,OAAO,EACpB,0BAA0B,IAAI,wBAAwB,EACtD,WAAW,IAAI,SAAS,EACxB,YAAY,IAAI,UAAU,EAC1B,eAAe,IAAI,aAAa,EAChC,WAAW,IAAI,SAAS,EACxB,UAAU,IAAI,QAAQ,EACtB,yBAAyB,IAAI,uBAAuB,EACpD,SAAS,IAAI,OAAO,EACpB,cAAc,IAAI,YAAY,EAC9B,KAAK,IAAI,GAAG,EACZ,YAAY,IAAI,UAAU,EAC1B,0BAA0B,IAAI,wBAAwB,EACtD,8BAA8B,IAAI,4BAA4B,EAC9D,WAAW,IAAI,SAAS,EACxB,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,kBAAkB,IAAI,gBAAgB,EACtC,uBAAuB,IAAI,qBAAqB,EAChD,KAAK,IAAI,GAAG,EACZ,qBAAqB,IAAI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9D,WAAW,IAAI,SAAS,EACxB,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,kBAAkB,IAAI,gBAAgB,EACtC,uBAAuB,IAAI,qBAAqB,EAChD,KAAK,IAAI,GAAG,EACZ,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,YAAY,IAAI,UAAU,EAC1B,uBAAuB,IAAI,qBAAqB,EAChD,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,QAAQ,IAAI,MAAM,EAClB,yBAAyB,IAAI,uBAAuB,EACpD,wBAAwB,IAAI,sBAAsB,EAClD,SAAS,IAAI,OAAO,EACpB,gBAAgB,IAAI,cAAc,EAClC,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,gCAAgC,IAAI,8BAA8B,EAClE,kBAAkB,IAAI,gBAAgB,GACvC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
package/dist/upstream.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: 2023-Present The Kubernetes Fluent Client Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.GenericKind = exports.VolumeAttachment = exports.ValidatingWebhookConfiguration = exports.TokenReview = exports.SubjectAccessReview = exports.StorageClass = exports.StatefulSet = exports.ServiceAccount = exports.Service = exports.SelfSubjectRulesReview = exports.SelfSubjectAccessReview = exports.Secret = exports.RuntimeClass = exports.RoleBinding = exports.Role = exports.ResourceQuota = exports.ReplicationController = exports.ReplicaSet = exports.PodTemplate = exports.PodDisruptionBudget = exports.Pod = exports.PersistentVolumeClaim = exports.PersistentVolume = exports.Node = exports.NetworkPolicy = exports.Namespace = exports.MutatingWebhookConfiguration = exports.LocalSubjectAccessReview = exports.LimitRange = exports.Job = exports.IngressClass = exports.Ingress = exports.HorizontalPodAutoscaler = exports.Eviction = exports.Endpoints = exports.EndpointSlice = exports.Deployment = exports.DaemonSet = exports.CustomResourceDefinition = exports.CronJob = exports.ControllerRevision = exports.ConfigMap = exports.ClusterRoleBinding = exports.ClusterRole = exports.CertificateSigningRequest = exports.CSIDriver = exports.APIService = exports.Event = exports.CoreEvent = void 0;
5
+ exports.GenericKind = exports.VolumeAttachment = exports.ValidatingWebhookConfiguration = exports.TokenReview = exports.SubjectAccessReview = exports.StorageClass = exports.StatefulSet = exports.ServiceAccount = exports.Service = exports.SelfSubjectRulesReview = exports.SelfSubjectAccessReview = exports.Secret = exports.RuntimeClass = exports.RoleBinding = exports.Role = exports.ResourceQuota = exports.ReplicationController = exports.ReplicaSet = exports.PodTemplate = exports.PodDisruptionBudget = exports.Pod = exports.PersistentVolumeClaim = exports.PersistentVolume = exports.Node = exports.NetworkPolicy = exports.Namespace = exports.MutatingWebhookConfiguration = exports.LocalSubjectAccessReview = exports.LimitRange = exports.Job = exports.IngressClass = exports.Ingress = exports.HorizontalPodAutoscaler = exports.Endpoints = exports.EndpointSlice = exports.Deployment = exports.DaemonSet = exports.CustomResourceDefinition = exports.CronJob = exports.ControllerRevision = exports.ConfigMap = exports.ClusterRoleBinding = exports.ClusterRole = exports.CertificateSigningRequest = exports.CSIDriver = exports.APIService = exports.Event = exports.CoreEvent = void 0;
6
6
  /** a is a collection of K8s types to be used within an action: `When(a.Configmap)` */
7
7
  var client_node_1 = require("@kubernetes/client-node");
8
8
  Object.defineProperty(exports, "CoreEvent", { enumerable: true, get: function () { return client_node_1.CoreV1Event; } });
@@ -20,7 +20,6 @@ Object.defineProperty(exports, "DaemonSet", { enumerable: true, get: function ()
20
20
  Object.defineProperty(exports, "Deployment", { enumerable: true, get: function () { return client_node_1.V1Deployment; } });
21
21
  Object.defineProperty(exports, "EndpointSlice", { enumerable: true, get: function () { return client_node_1.V1EndpointSlice; } });
22
22
  Object.defineProperty(exports, "Endpoints", { enumerable: true, get: function () { return client_node_1.V1Endpoints; } });
23
- Object.defineProperty(exports, "Eviction", { enumerable: true, get: function () { return client_node_1.V1Eviction; } });
24
23
  Object.defineProperty(exports, "HorizontalPodAutoscaler", { enumerable: true, get: function () { return client_node_1.V1HorizontalPodAutoscaler; } });
25
24
  Object.defineProperty(exports, "Ingress", { enumerable: true, get: function () { return client_node_1.V1Ingress; } });
26
25
  Object.defineProperty(exports, "IngressClass", { enumerable: true, get: function () { return client_node_1.V1IngressClass; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubernetes-fluent-client",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "A @kubernetes/client-node fluent API wrapper that leverages K8s Server Side Apply.",
5
5
  "bin": "./dist/cli.js",
6
6
  "main": "dist/index.js",
@@ -53,7 +53,7 @@
53
53
  "fast-json-patch": "3.1.1",
54
54
  "http-status-codes": "2.3.0",
55
55
  "node-fetch": "2.7.0",
56
- "quicktype-core": "23.0.171",
56
+ "quicktype-core": "23.1.1",
57
57
  "type-fest": "^4.39.1",
58
58
  "undici": "^7.7.0",
59
59
  "yargs": "17.7.2"
@@ -68,9 +68,9 @@
68
68
  "@types/readable-stream": "4.0.18",
69
69
  "@types/urijs": "^1.19.25",
70
70
  "@types/yargs": "17.0.33",
71
- "@typescript-eslint/eslint-plugin": "8.30.1",
72
- "@typescript-eslint/parser": "8.30.1",
73
- "eslint-plugin-jsdoc": "50.6.9",
71
+ "@typescript-eslint/eslint-plugin": "8.31.1",
72
+ "@typescript-eslint/parser": "8.31.1",
73
+ "eslint-plugin-jsdoc": "50.6.11",
74
74
  "globals": "^16.0.0",
75
75
  "husky": "^9.1.6",
76
76
  "jest": "29.7.0",
@@ -11,8 +11,7 @@ import { modelToGroupVersionKind } from "../kinds";
11
11
  import { GenericClass } from "../types";
12
12
  import { ApplyCfg, FetchMethods, Filters, K8sConfigPromise } from "./types";
13
13
  import fs from "fs";
14
- import { Eviction } from "../upstream";
15
-
14
+ import { V1Eviction as Eviction } from "@kubernetes/client-node";
16
15
  const SSA_CONTENT_TYPE = "application/apply-patch+yaml";
17
16
  const K8S_SA_TOKEN_PATH = "/var/run/secrets/kubernetes.io/serviceaccount/token";
18
17
 
@@ -225,15 +224,18 @@ export async function k8sExec<T extends GenericClass, K>(
225
224
  const reconstruct = async (method: FetchMethods): K8sConfigPromise => {
226
225
  const configMethod = method === "LOG" ? "GET" : method;
227
226
  const { opts, serverUrl } = await k8sCfg(configMethod);
228
- const isPost = method === "POST";
229
- const baseUrl = pathBuilder(serverUrl.toString(), model, filters, isPost);
230
- if (method === "LOG") {
227
+
228
+ // Build the base path once, using excludeName only for standard POST requests
229
+ const shouldExcludeName = method === "POST" && !(payload && isEvictionPayload(payload));
230
+ const baseUrl = pathBuilder(serverUrl.toString(), model, filters, shouldExcludeName);
231
+
232
+ // Append appropriate subresource paths
233
+ if (payload && isEvictionPayload(payload)) {
234
+ baseUrl.pathname = `${baseUrl.pathname}/eviction`;
235
+ } else if (method === "LOG") {
231
236
  baseUrl.pathname = `${baseUrl.pathname}/log`;
232
237
  }
233
- // Check if payload is an Eviction with metadata
234
- if (payload && isEvictionPayload(payload) && payload.metadata?.name) {
235
- baseUrl.pathname = `${baseUrl.pathname}/${payload.metadata.name}/eviction`;
236
- }
238
+
237
239
  return {
238
240
  serverUrl: baseUrl,
239
241
  opts,
@@ -467,7 +467,7 @@ export class Watcher<T extends GenericClass> {
467
467
  const now = Date.now();
468
468
 
469
469
  // If the last seen time is greater than the limit, trigger a resync
470
- if (this.#lastSeenTime == OVERRIDE || now - this.#lastSeenTime > this.#lastSeenLimit) {
470
+ if (this.#lastSeenTime === OVERRIDE || now - this.#lastSeenTime > this.#lastSeenLimit) {
471
471
  // Reset the last seen time to now to allow the resync to be called again in case of failure
472
472
  this.#lastSeenTime = now;
473
473
 
package/src/generate.ts CHANGED
@@ -73,7 +73,7 @@ export async function convertCRDtoTS(
73
73
  opts.logFn(`- Generating ${crd.spec.group}/${match.name} types for ${name}`);
74
74
 
75
75
  const inputData = await prepareInputData(name, schema);
76
- const generatedTypes = await generateTypes(inputData, opts);
76
+ const generatedTypes = await generateTypes(inputData);
77
77
 
78
78
  const fileName = `${name.toLowerCase()}-${match.name.toLowerCase()}`;
79
79
  writeGeneratedFile(fileName, opts.directory || "", generatedTypes, opts.language || "ts");
@@ -110,20 +110,15 @@ export async function prepareInputData(name: string, schema: string): Promise<In
110
110
  * Generates TypeScript types using quicktype.
111
111
  *
112
112
  * @param inputData - The input data for quicktype.
113
- * @param opts - The options for generating the TypeScript types.
114
113
  * @returns A promise that resolves to an array of generated TypeScript type lines.
115
114
  */
116
- export async function generateTypes(
117
- inputData: InputData,
118
- opts: GenerateOptions,
119
- ): Promise<string[]> {
115
+ export async function generateTypes(inputData: InputData): Promise<string[]> {
120
116
  // If the language is not specified, default to TypeScript
121
- const language = opts.language || "ts";
122
117
 
123
118
  // Generate the types
124
119
  const out = await quicktype({
125
120
  inputData,
126
- lang: language,
121
+ lang: "ts",
127
122
  rendererOptions: { "just-types": "true" },
128
123
  });
129
124
 
package/src/upstream.ts CHANGED
@@ -18,7 +18,6 @@ export {
18
18
  V1Deployment as Deployment,
19
19
  V1EndpointSlice as EndpointSlice,
20
20
  V1Endpoints as Endpoints,
21
- V1Eviction as Eviction,
22
21
  V1HorizontalPodAutoscaler as HorizontalPodAutoscaler,
23
22
  V1Ingress as Ingress,
24
23
  V1IngressClass as IngressClass,