kubernetes-fluent-client 1.5.0 → 1.5.1

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.
package/dist/kinds.js CHANGED
@@ -10,6 +10,7 @@ const gvkMap = {
10
10
  * Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not
11
11
  * rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued
12
12
  * existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.
13
+ *
13
14
  * @see {@link https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/event-v1/}
14
15
  */
15
16
  CoreV1Event: {
@@ -20,6 +21,7 @@ const gvkMap = {
20
21
  /**
21
22
  * Represents a K8s ClusterRole resource.
22
23
  * ClusterRole is a set of permissions that can be bound to a user or group in a cluster-wide scope.
24
+ *
23
25
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole}
24
26
  */
25
27
  V1ClusterRole: {
@@ -30,6 +32,7 @@ const gvkMap = {
30
32
  /**
31
33
  * Represents a K8s ClusterRoleBinding resource.
32
34
  * ClusterRoleBinding binds a ClusterRole to a user or group in a cluster-wide scope.
35
+ *
33
36
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding}
34
37
  */
35
38
  V1ClusterRoleBinding: {
@@ -40,6 +43,7 @@ const gvkMap = {
40
43
  /**
41
44
  * Represents a K8s Role resource.
42
45
  * Role is a set of permissions that can be bound to a user or group in a namespace scope.
46
+ *
43
47
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole}
44
48
  */
45
49
  V1Role: {
@@ -50,6 +54,7 @@ const gvkMap = {
50
54
  /**
51
55
  * Represents a K8s RoleBinding resource.
52
56
  * RoleBinding binds a Role to a user or group in a namespace scope.
57
+ *
53
58
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding}
54
59
  */
55
60
  V1RoleBinding: {
@@ -60,6 +65,7 @@ const gvkMap = {
60
65
  /**
61
66
  * Represents a K8s ConfigMap resource.
62
67
  * ConfigMap holds configuration data for pods to consume.
68
+ *
63
69
  * @see {@link https://kubernetes.io/docs/concepts/configuration/configmap/}
64
70
  */
65
71
  V1ConfigMap: {
@@ -70,6 +76,7 @@ const gvkMap = {
70
76
  /**
71
77
  * Represents a K8s Endpoints resource.
72
78
  * Endpoints expose a service's IP addresses and ports to other resources.
79
+ *
73
80
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/service/#endpoints}
74
81
  */
75
82
  V1Endpoint: {
@@ -81,6 +88,7 @@ const gvkMap = {
81
88
  /**
82
89
  * Represents a K8s LimitRange resource.
83
90
  * LimitRange enforces constraints on the resource consumption of objects in a namespace.
91
+ *
84
92
  * @see {@link https://kubernetes.io/docs/concepts/policy/limit-range/}
85
93
  */
86
94
  V1LimitRange: {
@@ -91,6 +99,7 @@ const gvkMap = {
91
99
  /**
92
100
  * Represents a K8s Namespace resource.
93
101
  * Namespace is a way to divide cluster resources between multiple users.
102
+ *
94
103
  * @see {@link https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/}
95
104
  */
96
105
  V1Namespace: {
@@ -101,6 +110,7 @@ const gvkMap = {
101
110
  /**
102
111
  * Represents a K8s Node resource.
103
112
  * Node is a worker machine in Kubernetes.
113
+ *
104
114
  * @see {@link https://kubernetes.io/docs/concepts/architecture/nodes/}
105
115
  */
106
116
  V1Node: {
@@ -111,6 +121,7 @@ const gvkMap = {
111
121
  /**
112
122
  * Represents a K8s PersistentVolumeClaim resource.
113
123
  * PersistentVolumeClaim is a user's request for and claim to a persistent volume.
124
+ *
114
125
  * @see {@link https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims}
115
126
  */
116
127
  V1PersistentVolumeClaim: {
@@ -121,6 +132,7 @@ const gvkMap = {
121
132
  /**
122
133
  * Represents a K8s PersistentVolume resource.
123
134
  * PersistentVolume is a piece of storage in the cluster that has been provisioned by an administrator.
135
+ *
124
136
  * @see {@link https://kubernetes.io/docs/concepts/storage/persistent-volumes/}
125
137
  */
126
138
  V1PersistentVolume: {
@@ -131,6 +143,7 @@ const gvkMap = {
131
143
  /**
132
144
  * Represents a K8s Pod resource.
133
145
  * Pod is the smallest and simplest unit in the Kubernetes object model.
146
+ *
134
147
  * @see {@link https://kubernetes.io/docs/concepts/workloads/pods/}
135
148
  */
136
149
  V1Pod: {
@@ -141,6 +154,7 @@ const gvkMap = {
141
154
  /**
142
155
  * Represents a K8s PodTemplate resource.
143
156
  * PodTemplate is an object that describes the pod that will be created from a higher level abstraction.
157
+ *
144
158
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/#pod-template}
145
159
  */
146
160
  V1PodTemplate: {
@@ -151,6 +165,7 @@ const gvkMap = {
151
165
  /**
152
166
  * Represents a K8s ReplicationController resource.
153
167
  * ReplicationController ensures that a specified number of pod replicas are running at any given time.
168
+ *
154
169
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/}
155
170
  */
156
171
  V1ReplicationController: {
@@ -161,6 +176,7 @@ const gvkMap = {
161
176
  /**
162
177
  * Represents a K8s ResourceQuota resource.
163
178
  * ResourceQuota provides constraints that limit resource consumption per namespace.
179
+ *
164
180
  * @see {@link https://kubernetes.io/docs/concepts/policy/resource-quotas/}
165
181
  */
166
182
  V1ResourceQuota: {
@@ -171,6 +187,7 @@ const gvkMap = {
171
187
  /**
172
188
  * Represents a K8s Secret resource.
173
189
  * Secret holds secret data of a certain type.
190
+ *
174
191
  * @see {@link https://kubernetes.io/docs/concepts/configuration/secret/}
175
192
  */
176
193
  V1Secret: {
@@ -181,6 +198,7 @@ const gvkMap = {
181
198
  /**
182
199
  * Represents a K8s ServiceAccount resource.
183
200
  * ServiceAccount is an identity that processes in a pod can use to access the Kubernetes API.
201
+ *
184
202
  * @see {@link https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/}
185
203
  */
186
204
  V1ServiceAccount: {
@@ -191,6 +209,7 @@ const gvkMap = {
191
209
  /**
192
210
  * Represents a K8s Service resource.
193
211
  * Service is an abstraction which defines a logical set of Pods and a policy by which to access them.
212
+ *
194
213
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/service/}
195
214
  */
196
215
  V1Service: {
@@ -201,6 +220,7 @@ const gvkMap = {
201
220
  /**
202
221
  * Represents a K8s MutatingWebhookConfiguration resource.
203
222
  * MutatingWebhookConfiguration configures a mutating admission webhook.
223
+ *
204
224
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly}
205
225
  */
206
226
  V1MutatingWebhookConfiguration: {
@@ -211,6 +231,7 @@ const gvkMap = {
211
231
  /**
212
232
  * Represents a K8s ValidatingWebhookConfiguration resource.
213
233
  * ValidatingWebhookConfiguration configures a validating admission webhook.
234
+ *
214
235
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly}
215
236
  */
216
237
  V1ValidatingWebhookConfiguration: {
@@ -221,6 +242,7 @@ const gvkMap = {
221
242
  /**
222
243
  * Represents a K8s CustomResourceDefinition resource.
223
244
  * CustomResourceDefinition is a custom resource in a Kubernetes cluster.
245
+ *
224
246
  * @see {@link https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/}
225
247
  */
226
248
  V1CustomResourceDefinition: {
@@ -231,6 +253,7 @@ const gvkMap = {
231
253
  /**
232
254
  * Represents a K8s APIService resource.
233
255
  * APIService represents a server for a particular API version and group.
256
+ *
234
257
  * @see {@link https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/}
235
258
  */
236
259
  V1APIService: {
@@ -241,6 +264,7 @@ const gvkMap = {
241
264
  /**
242
265
  * Represents a K8s ControllerRevision resource.
243
266
  * ControllerRevision is used to manage the history of a StatefulSet or DaemonSet.
267
+ *
244
268
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#revision-history}
245
269
  */
246
270
  V1ControllerRevision: {
@@ -251,6 +275,7 @@ const gvkMap = {
251
275
  /**
252
276
  * Represents a K8s DaemonSet resource.
253
277
  * DaemonSet ensures that all (or some) nodes run a copy of a Pod.
278
+ *
254
279
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/}
255
280
  */
256
281
  V1DaemonSet: {
@@ -261,6 +286,7 @@ const gvkMap = {
261
286
  /**
262
287
  * Represents a K8s Deployment resource.
263
288
  * Deployment provides declarative updates for Pods and ReplicaSets.
289
+ *
264
290
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/deployment/}
265
291
  */
266
292
  V1Deployment: {
@@ -271,6 +297,7 @@ const gvkMap = {
271
297
  /**
272
298
  * Represents a K8s ReplicaSet resource.
273
299
  * ReplicaSet ensures that a specified number of pod replicas are running at any given time.
300
+ *
274
301
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/}
275
302
  */
276
303
  V1ReplicaSet: {
@@ -281,6 +308,7 @@ const gvkMap = {
281
308
  /**
282
309
  * Represents a K8s StatefulSet resource.
283
310
  * StatefulSet is used to manage stateful applications.
311
+ *
284
312
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/}
285
313
  */
286
314
  V1StatefulSet: {
@@ -291,6 +319,7 @@ const gvkMap = {
291
319
  /**
292
320
  * Represents a K8s TokenReview resource.
293
321
  * TokenReview attempts to authenticate a token to a known user.
322
+ *
294
323
  * @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#tokenreview-v1-authentication-k8s-io}
295
324
  */
296
325
  V1TokenReview: {
@@ -301,6 +330,7 @@ const gvkMap = {
301
330
  /**
302
331
  * Represents a K8s LocalSubjectAccessReview resource.
303
332
  * LocalSubjectAccessReview checks whether a specific user can perform a specific action in a specific namespace.
333
+ *
304
334
  * @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#localsubjectaccessreview-v1-authorization-k8s-io}
305
335
  */
306
336
  V1LocalSubjectAccessReview: {
@@ -311,6 +341,7 @@ const gvkMap = {
311
341
  /**
312
342
  * Represents a K8s SelfSubjectAccessReview resource.
313
343
  * SelfSubjectAccessReview checks whether the current user can perform a specific action.
344
+ *
314
345
  * @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#selfsubjectaccessreview-v1-authorization-k8s-io}
315
346
  */
316
347
  V1SelfSubjectAccessReview: {
@@ -321,6 +352,7 @@ const gvkMap = {
321
352
  /**
322
353
  * Represents a K8s SelfSubjectRulesReview resource.
323
354
  * SelfSubjectRulesReview lists the permissions a specific user has within a namespace.
355
+ *
324
356
  * @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#selfsubjectrulesreview-v1-authorization-k8s-io}
325
357
  */
326
358
  V1SelfSubjectRulesReview: {
@@ -331,6 +363,7 @@ const gvkMap = {
331
363
  /**
332
364
  * Represents a K8s SubjectAccessReview resource.
333
365
  * SubjectAccessReview checks whether a specific user can perform a specific action.
366
+ *
334
367
  * @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#subjectaccessreview-v1-authorization-k8s-io}
335
368
  */
336
369
  V1SubjectAccessReview: {
@@ -341,6 +374,7 @@ const gvkMap = {
341
374
  /**
342
375
  * Represents a K8s HorizontalPodAutoscaler resource.
343
376
  * HorizontalPodAutoscaler automatically scales the number of Pods in a replication controller, deployment, or replica set.
377
+ *
344
378
  * @see {@link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/}
345
379
  */
346
380
  V1HorizontalPodAutoscaler: {
@@ -351,6 +385,7 @@ const gvkMap = {
351
385
  /**
352
386
  * Represents a K8s CronJob resource.
353
387
  * CronJob manages time-based jobs, specifically those that run periodically and complete after a successful execution.
388
+ *
354
389
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/}
355
390
  */
356
391
  V1CronJob: {
@@ -361,6 +396,7 @@ const gvkMap = {
361
396
  /**
362
397
  * Represents a K8s Job resource.
363
398
  * Job represents the configuration of a single job.
399
+ *
364
400
  * @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/job/}
365
401
  */
366
402
  V1Job: {
@@ -371,6 +407,7 @@ const gvkMap = {
371
407
  /**
372
408
  * Represents a K8s CertificateSigningRequest resource.
373
409
  * CertificateSigningRequest represents a certificate signing request.
410
+ *
374
411
  * @see {@link https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/}
375
412
  */
376
413
  V1CertificateSigningRequest: {
@@ -381,6 +418,7 @@ const gvkMap = {
381
418
  /**
382
419
  * Represents a K8s EndpointSlice resource.
383
420
  * EndpointSlice represents a scalable set of network endpoints for a Kubernetes Service.
421
+ *
384
422
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/}
385
423
  */
386
424
  V1EndpointSlice: {
@@ -391,6 +429,7 @@ const gvkMap = {
391
429
  /**
392
430
  * Represents a K8s IngressClass resource.
393
431
  * IngressClass represents the class of the Ingress, referenced by the Ingress spec.
432
+ *
394
433
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/ingress/}
395
434
  */
396
435
  V1IngressClass: {
@@ -401,6 +440,7 @@ const gvkMap = {
401
440
  /**
402
441
  * Represents a K8s Ingress resource.
403
442
  * Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
443
+ *
404
444
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/ingress/}
405
445
  */
406
446
  V1Ingress: {
@@ -412,6 +452,7 @@ const gvkMap = {
412
452
  /**
413
453
  * Represents a K8s NetworkPolicy resource.
414
454
  * NetworkPolicy defines a set of rules for how pods communicate with each other.
455
+ *
415
456
  * @see {@link https://kubernetes.io/docs/concepts/services-networking/network-policies/}
416
457
  */
417
458
  V1NetworkPolicy: {
@@ -422,6 +463,7 @@ const gvkMap = {
422
463
  /**
423
464
  * Represents a K8s RuntimeClass resource.
424
465
  * RuntimeClass is a cluster-scoped resource that surfaces container runtime properties to the control plane.
466
+ *
425
467
  * @see {@link https://kubernetes.io/docs/concepts/containers/runtime-class/}
426
468
  */
427
469
  V1RuntimeClass: {
@@ -432,6 +474,7 @@ const gvkMap = {
432
474
  /**
433
475
  * Represents a K8s PodDisruptionBudget resource.
434
476
  * PodDisruptionBudget is an API object that limits the number of pods of a replicated application that are down simultaneously.
477
+ *
435
478
  * @see {@link https://kubernetes.io/docs/concepts/workloads/pods/disruptions/}
436
479
  */
437
480
  V1PodDisruptionBudget: {
@@ -442,6 +485,7 @@ const gvkMap = {
442
485
  /**
443
486
  * Represents a K8s VolumeAttachment resource.
444
487
  * VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.
488
+ *
445
489
  * @see {@link https://kubernetes.io/docs/concepts/storage/storage-classes/}
446
490
  */
447
491
  V1VolumeAttachment: {
@@ -452,6 +496,7 @@ const gvkMap = {
452
496
  /**
453
497
  * Represents a K8s CSIDriver resource.
454
498
  * CSIDriver captures information about a Container Storage Interface (CSI) volume driver.
499
+ *
455
500
  * @see {@link https://kubernetes.io/docs/concepts/storage/volumes/}
456
501
  */
457
502
  V1CSIDriver: {
@@ -462,6 +507,7 @@ const gvkMap = {
462
507
  /**
463
508
  * Represents a K8s CSIStorageCapacity resource.
464
509
  * CSIStorageCapacity stores the reported storage capacity of a CSI node or storage class.
510
+ *
465
511
  * @see {@link https://kubernetes.io/docs/concepts/storage/csi/}
466
512
  */
467
513
  V1CSIStorageCapacity: {
@@ -472,6 +518,7 @@ const gvkMap = {
472
518
  /**
473
519
  * Represents a K8s StorageClass resource.
474
520
  * StorageClass is a cluster-scoped resource that provides a way for administrators to describe the classes of storage they offer.
521
+ *
475
522
  * @see {@link https://kubernetes.io/docs/concepts/storage/storage-classes/}
476
523
  */
477
524
  V1StorageClass: {
@@ -480,6 +527,12 @@ const gvkMap = {
480
527
  group: "storage.k8s.io",
481
528
  },
482
529
  };
530
+ /**
531
+ * Converts a model name to a GroupVersionKind
532
+ *
533
+ * @param key The name of the model
534
+ * @returns The GroupVersionKind for the model
535
+ */
483
536
  function modelToGroupVersionKind(key) {
484
537
  return gvkMap[key];
485
538
  }
package/dist/types.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class GenericKind implements KubernetesObject {
15
15
  /**
16
16
  * GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion
17
17
  * to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
18
- **/
18
+ */
19
19
  export interface GroupVersionKind {
20
20
  /** The K8s resource kind, e..g "Pod". */
21
21
  readonly kind: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGjF,MAAM,MAAM,YAAY,GAAG,QAAQ,WAAW,GAAG,CAAC;AAElD;;;;GAIG;AACH,qBAAa,WAAY,YAAW,gBAAgB;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;IAGI;AACJ,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IAEpB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACjE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACrD,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACvC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGjF,MAAM,MAAM,YAAY,GAAG,QAAQ,WAAW,GAAG,CAAC;AAElD;;;;GAIG;AACH,qBAAa,WAAY,YAAW,gBAAgB;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IAEpB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACjE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACrD,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubernetes-fluent-client",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A @kubernetes/client-node fluent API wrapper that leverages K8s Server Side Apply",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,8 +9,8 @@
9
9
  "build": "tsc",
10
10
  "semantic-release": "semantic-release",
11
11
  "test": "jest src --coverage",
12
- "format:check": "eslint && prettier . --check",
13
- "format:fix": "eslint --fix && prettier . --write"
12
+ "format:check": "eslint src && prettier . --check",
13
+ "format:fix": "eslint --fix src && prettier . --write"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">=18.0.0"
@@ -48,6 +48,7 @@
48
48
  "@types/byline": "4.2.34",
49
49
  "@typescript-eslint/eslint-plugin": "6.7.4",
50
50
  "@typescript-eslint/parser": "6.7.4",
51
+ "eslint-plugin-jsdoc": "46.8.2",
51
52
  "jest": "29.7.0",
52
53
  "nock": "13.3.3",
53
54
  "prettier": "3.0.3",
package/src/fetch.ts CHANGED
@@ -22,7 +22,7 @@ export type FetchResponse<T> = {
22
22
  *
23
23
  * @param url The URL or Request object to fetch
24
24
  * @param init Additional options for the request
25
- * @returns
25
+ * @returns The parsed JSON response
26
26
  */
27
27
  export async function fetch<T>(
28
28
  url: URL | RequestInfo,
@@ -8,16 +8,17 @@ import type { PartialDeep } from "type-fest";
8
8
 
9
9
  import { modelToGroupVersionKind } from "../kinds";
10
10
  import { GenericClass } from "../types";
11
+ import { ApplyCfg } from "./apply";
11
12
  import { Filters, K8sInit, Paths, WatchAction } from "./types";
12
13
  import { k8sExec } from "./utils";
13
14
  import { ExecWatch, WatchCfg } from "./watch";
14
- import { ApplyCfg } from "./apply";
15
15
 
16
16
  /**
17
17
  * Kubernetes fluent API inspired by Kubectl. Pass in a model, then call filters and actions on it.
18
18
  *
19
19
  * @param model - the model to use for the API
20
20
  * @param filters - (optional) filter overrides, can also be chained
21
+ * @returns a fluent API for the model
21
22
  */
22
23
  export function K8s<T extends GenericClass, K extends KubernetesObject = InstanceType<T>>(
23
24
  model: T,
@@ -26,27 +27,44 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
26
27
  const withFilters = { WithField, WithLabel, Get, Delete, Watch };
27
28
  const matchedKind = filters.kindOverride || modelToGroupVersionKind(model.name);
28
29
 
29
- function InNamespace(namespaces: string) {
30
+ /**
31
+ * @inheritdoc
32
+ * @see {@link K8sInit.InNamespace}
33
+ */
34
+ function InNamespace(namespace: string) {
30
35
  if (filters.namespace) {
31
36
  throw new Error(`Namespace already specified: ${filters.namespace}`);
32
37
  }
33
38
 
34
- filters.namespace = namespaces;
39
+ filters.namespace = namespace;
35
40
  return withFilters;
36
41
  }
37
42
 
43
+ /**
44
+ * @inheritdoc
45
+ * @see {@link K8sInit.WithField}
46
+ */
38
47
  function WithField<P extends Paths<K>>(key: P, value: string) {
39
48
  filters.fields = filters.fields || {};
40
49
  filters.fields[key] = value;
41
50
  return withFilters;
42
51
  }
43
52
 
53
+ /**
54
+ * @inheritdoc
55
+ * @see {@link K8sInit.WithLabel}
56
+ */
44
57
  function WithLabel(key: string, value: string) {
45
58
  filters.labels = filters.labels || {};
46
59
  filters.labels[key] = value;
47
60
  return withFilters;
48
61
  }
49
62
 
63
+ /**
64
+ * Sync the filters with the provided payload.
65
+ *
66
+ * @param payload - the payload to sync with
67
+ */
50
68
  function syncFilters(payload: K) {
51
69
  // Ensure the payload has metadata
52
70
  payload.metadata = payload.metadata || {};
@@ -70,6 +88,10 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
70
88
 
71
89
  async function Get(): Promise<KubernetesListObject<K>>;
72
90
  async function Get(name: string): Promise<K>;
91
+ /**
92
+ * @inheritdoc
93
+ * @see {@link K8sInit.Get}
94
+ */
73
95
  async function Get(name?: string) {
74
96
  if (name) {
75
97
  if (filters.name) {
@@ -81,6 +103,10 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
81
103
  return k8sExec<T, K | KubernetesListObject<K>>(model, filters, "GET");
82
104
  }
83
105
 
106
+ /**
107
+ * @inheritdoc
108
+ * @see {@link K8sInit.Delete}
109
+ */
84
110
  async function Delete(filter?: K | string): Promise<void> {
85
111
  if (typeof filter === "string") {
86
112
  filters.name = filter;
@@ -101,6 +127,10 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
101
127
  }
102
128
  }
103
129
 
130
+ /**
131
+ * @inheritdoc
132
+ * @see {@link K8sInit.Apply}
133
+ */
104
134
  async function Apply(
105
135
  resource: PartialDeep<K>,
106
136
  applyCfg: ApplyCfg = { force: false },
@@ -109,11 +139,19 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
109
139
  return k8sExec(model, filters, "APPLY", resource, applyCfg);
110
140
  }
111
141
 
142
+ /**
143
+ * @inheritdoc
144
+ * @see {@link K8sInit.Create}
145
+ */
112
146
  async function Create(resource: K): Promise<K> {
113
147
  syncFilters(resource);
114
148
  return k8sExec(model, filters, "POST", resource);
115
149
  }
116
150
 
151
+ /**
152
+ * @inheritdoc
153
+ * @see {@link K8sInit.Patch}
154
+ */
117
155
  async function Patch(payload: Operation[]): Promise<K> {
118
156
  // If there are no operations, throw an error
119
157
  if (payload.length < 1) {
@@ -123,6 +161,10 @@ export function K8s<T extends GenericClass, K extends KubernetesObject = Instanc
123
161
  return k8sExec<T, K>(model, filters, "PATCH", payload);
124
162
  }
125
163
 
164
+ /**
165
+ * @inheritdoc
166
+ * @see {@link K8sInit.Watch}
167
+ */
126
168
  async function Watch(callback: WatchAction<T>, watchCfg?: WatchCfg) {
127
169
  return ExecWatch(model, filters, callback, watchCfg);
128
170
  }
@@ -28,6 +28,14 @@ export interface Filters {
28
28
  namespace?: string;
29
29
  }
30
30
 
31
+ /**
32
+ * Get the resource or resources matching the filters.
33
+ * If no filters are specified, all resources will be returned.
34
+ * If a name is specified, only a single resource will be returned.
35
+ *
36
+ * @param name - (optional) the name of the resource to get
37
+ * @returns the resource or list of resources
38
+ */
31
39
  export type GetFunction<K extends KubernetesObject> = {
32
40
  (): Promise<KubernetesListObject<K>>;
33
41
  (name: string): Promise<K>;
@@ -42,16 +50,18 @@ export type K8sFilteredActions<K extends KubernetesObject> = {
42
50
  Get: GetFunction<K>;
43
51
 
44
52
  /**
45
- * Delete the resource if it exists.
53
+ * Delete the resource matching the filters.
46
54
  *
47
55
  * @param filter - the resource or resource name to delete
48
56
  */
49
57
  Delete: (filter?: K | string) => Promise<void>;
50
58
 
51
59
  /**
60
+ * Watch the resource matching the filters.
52
61
  *
53
- * @param callback
54
- * @returns
62
+ * @param callback - the callback function to call when an event occurs
63
+ * @param watchCfg - (optional) watch configuration
64
+ * @returns a watch controller
55
65
  */
56
66
  Watch: (
57
67
  callback: (payload: K, phase: WatchPhase) => void,
@@ -63,16 +73,17 @@ export type K8sUnfilteredActions<K extends KubernetesObject> = {
63
73
  /**
64
74
  * Perform a server-side apply of the provided K8s resource.
65
75
  *
66
- * @param resource
67
- * @returns
76
+ * @param resource - the resource to apply
77
+ * @param applyCfg - (optional) apply configuration
78
+ * @returns the applied resource
68
79
  */
69
80
  Apply: (resource: PartialDeep<K>, applyCfg?: ApplyCfg) => Promise<K>;
70
81
 
71
82
  /**
72
83
  * Create the provided K8s resource or throw an error if it already exists.
73
84
  *
74
- * @param resource
75
- * @returns
85
+ * @param resource - the resource to create
86
+ * @returns the created resource
76
87
  */
77
88
  Create: (resource: K) => Promise<K>;
78
89
 
@@ -94,18 +105,18 @@ export type K8sWithFilters<K extends KubernetesObject> = K8sFilteredActions<K> &
94
105
  *
95
106
  * ```ts
96
107
  * K8s(kind.Deployment)
97
- * .WithField("metadata.name", "bar")
98
- * .WithField("metadata.namespace", "qux")
99
- * .Delete(...)
108
+ * .WithField("metadata.name", "bar")
109
+ * .WithField("metadata.namespace", "qux")
110
+ * .Delete(...)
100
111
  * ```
101
112
  *
102
113
  * Will only delete the Deployment if it has the `metadata.name=bar` and `metadata.namespace=qux` fields.
103
114
  * Not all fields are supported, see https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/#supported-fields,
104
115
  * but Typescript will limit to only fields that exist on the resource.
105
116
  *
106
- * @param key The field key
107
- * @param value The field value
108
- * @returns
117
+ * @param key - the field key
118
+ * @param value - the field value
119
+ * @returns the fluent API
109
120
  */
110
121
  WithField: <P extends Paths<K>>(key: P, value: string) => K8sWithFilters<K>;
111
122
 
@@ -115,15 +126,16 @@ export type K8sWithFilters<K extends KubernetesObject> = K8sFilteredActions<K> &
115
126
  *
116
127
  * ```ts
117
128
  * K8s(kind.Deployment)
118
- * .WithLabel("foo", "bar")
119
- * .WithLabel("baz", "qux")
120
- * .Delete(...)
129
+ * .WithLabel("foo", "bar")
130
+ * .WithLabel("baz", "qux")
131
+ * .Delete(...)
121
132
  * ```
122
133
  *
123
134
  * Will only delete the Deployment if it has the`foo=bar` and `baz=qux` labels.
124
135
  *
125
- * @param key The label key
126
- * @param value (optional) The label value
136
+ * @param key - the label key
137
+ * @param value - the label value
138
+ * @returns the fluent API
127
139
  */
128
140
  WithLabel: (key: string, value: string) => K8sWithFilters<K>;
129
141
  };
@@ -131,10 +143,10 @@ export type K8sWithFilters<K extends KubernetesObject> = K8sFilteredActions<K> &
131
143
  export type K8sInit<K extends KubernetesObject> = K8sWithFilters<K> &
132
144
  K8sUnfilteredActions<K> & {
133
145
  /**
134
- * Filter the query by the given namespace.
146
+ * Set the namespace filter.
135
147
  *
136
- * @param namespace
137
- * @returns
148
+ * @param namespace - the namespace to filter on
149
+ * @returns the fluent API
138
150
  */
139
151
  InNamespace: (namespace: string) => K8sWithFilters<K>;
140
152
  };