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/fetch.d.ts +1 -1
- package/dist/fetch.js +1 -1
- package/dist/fluent/index.d.ts +1 -0
- package/dist/fluent/index.d.ts.map +1 -1
- package/dist/fluent/index.js +44 -2
- package/dist/fluent/types.d.ts +33 -21
- package/dist/fluent/types.d.ts.map +1 -1
- package/dist/fluent/utils.d.ts +18 -7
- package/dist/fluent/utils.d.ts.map +1 -1
- package/dist/fluent/utils.js +18 -7
- package/dist/fluent/watch.d.ts +9 -2
- package/dist/fluent/watch.d.ts.map +1 -1
- package/dist/fluent/watch.js +18 -1
- package/dist/kinds.d.ts +6 -0
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +53 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/fetch.ts +1 -1
- package/src/fluent/index.ts +45 -3
- package/src/fluent/types.ts +33 -21
- package/src/fluent/utils.ts +18 -7
- package/src/fluent/watch.ts +21 -3
- package/src/kinds.ts +53 -0
- package/src/types.ts +1 -1
package/src/fluent/utils.ts
CHANGED
|
@@ -16,11 +16,11 @@ const SSA_CONTENT_TYPE = "application/apply-patch+yaml";
|
|
|
16
16
|
/**
|
|
17
17
|
* Generate a path to a Kubernetes resource
|
|
18
18
|
*
|
|
19
|
-
* @param serverUrl
|
|
20
|
-
* @param model
|
|
21
|
-
* @param filters
|
|
22
|
-
* @param excludeName
|
|
23
|
-
* @returns
|
|
19
|
+
* @param serverUrl - the URL of the Kubernetes API server
|
|
20
|
+
* @param model - the model to use for the API
|
|
21
|
+
* @param filters - (optional) filter overrides, can also be chained
|
|
22
|
+
* @param excludeName - (optional) exclude the name from the path
|
|
23
|
+
* @returns the path to the resource
|
|
24
24
|
*/
|
|
25
25
|
export function pathBuilder<T extends GenericClass>(
|
|
26
26
|
serverUrl: string,
|
|
@@ -90,8 +90,8 @@ export function pathBuilder<T extends GenericClass>(
|
|
|
90
90
|
* - We have to create an agent to handle the TLS connection (for the custom CA + mTLS in some cases)
|
|
91
91
|
* - The K8s lib uses request instead of node-fetch today so the object is slightly different
|
|
92
92
|
*
|
|
93
|
-
* @param method
|
|
94
|
-
* @returns
|
|
93
|
+
* @param method - the HTTP method to use
|
|
94
|
+
* @returns the fetch options and server URL
|
|
95
95
|
*/
|
|
96
96
|
export async function k8sCfg(method: FetchMethods) {
|
|
97
97
|
const kubeConfig = new KubeConfig();
|
|
@@ -119,6 +119,17 @@ export async function k8sCfg(method: FetchMethods) {
|
|
|
119
119
|
return { opts, serverUrl: cluster.server };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Execute a request against the Kubernetes API server.
|
|
124
|
+
*
|
|
125
|
+
* @param model - the model to use for the API
|
|
126
|
+
* @param filters - (optional) filter overrides, can also be chained
|
|
127
|
+
* @param method - the HTTP method to use
|
|
128
|
+
* @param payload - (optional) the payload to send
|
|
129
|
+
* @param applyCfg - (optional) configuration for the apply method
|
|
130
|
+
*
|
|
131
|
+
* @returns the parsed JSON response
|
|
132
|
+
*/
|
|
122
133
|
export async function k8sExec<T extends GenericClass, K>(
|
|
123
134
|
model: T,
|
|
124
135
|
filters: Filters,
|
package/src/fluent/watch.ts
CHANGED
|
@@ -14,13 +14,14 @@ import { k8sCfg, pathBuilder } from "./utils";
|
|
|
14
14
|
export type WatchController = {
|
|
15
15
|
/**
|
|
16
16
|
* Abort the watch.
|
|
17
|
+
*
|
|
17
18
|
* @param reason optional reason for aborting the watch
|
|
18
|
-
* @returns
|
|
19
19
|
*/
|
|
20
20
|
abort: (reason?: string) => void;
|
|
21
21
|
/**
|
|
22
22
|
* Get the AbortSignal for the watch.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* @returns the AbortSignal
|
|
24
25
|
*/
|
|
25
26
|
signal: () => AbortSignal;
|
|
26
27
|
};
|
|
@@ -49,6 +50,12 @@ export type WatchCfg = {
|
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Execute a watch on the specified resource.
|
|
53
|
+
*
|
|
54
|
+
* @param model - the model to use for the API
|
|
55
|
+
* @param filters - (optional) filter overrides, can also be chained
|
|
56
|
+
* @param callback - the callback function to call when an event is received
|
|
57
|
+
* @param watchCfg - (optional) watch configuration
|
|
58
|
+
* @returns a WatchController to allow the watch to be aborted externally
|
|
52
59
|
*/
|
|
53
60
|
export async function ExecWatch<T extends GenericClass>(
|
|
54
61
|
model: T,
|
|
@@ -94,6 +101,9 @@ export async function ExecWatch<T extends GenericClass>(
|
|
|
94
101
|
// Create a wrapped AbortController to allow the watch to be aborted externally
|
|
95
102
|
const abortWrapper = {} as WatchController;
|
|
96
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Bind the abort controller to the wrapper.
|
|
106
|
+
*/
|
|
97
107
|
function bindAbortController() {
|
|
98
108
|
// Create a new AbortController
|
|
99
109
|
abortController = new AbortController();
|
|
@@ -106,6 +116,9 @@ export async function ExecWatch<T extends GenericClass>(
|
|
|
106
116
|
opts.signal = abortController.signal;
|
|
107
117
|
}
|
|
108
118
|
|
|
119
|
+
/**
|
|
120
|
+
* The main watch runner. This will run until the process is terminated or the watch is aborted.
|
|
121
|
+
*/
|
|
109
122
|
async function runner() {
|
|
110
123
|
let doneCalled = false;
|
|
111
124
|
|
|
@@ -130,6 +143,7 @@ export async function ExecWatch<T extends GenericClass>(
|
|
|
130
143
|
}
|
|
131
144
|
};
|
|
132
145
|
|
|
146
|
+
// Cleanup the stream listeners
|
|
133
147
|
const cleanup = () => {
|
|
134
148
|
if (!doneCalled) {
|
|
135
149
|
doneCalled = true;
|
|
@@ -181,7 +195,11 @@ export async function ExecWatch<T extends GenericClass>(
|
|
|
181
195
|
onError(e);
|
|
182
196
|
}
|
|
183
197
|
|
|
184
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Reload the watch.
|
|
200
|
+
*
|
|
201
|
+
* @param e - the error that caused the reload
|
|
202
|
+
*/
|
|
185
203
|
async function reload(e: Error) {
|
|
186
204
|
// If there are more attempts, retry the watch
|
|
187
205
|
if (watchCfg.retryMax! > retryCount) {
|
package/src/kinds.ts
CHANGED
|
@@ -10,6 +10,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
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: {
|
|
@@ -21,6 +22,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Represents a K8s ClusterRole resource.
|
|
23
24
|
* ClusterRole is a set of permissions that can be bound to a user or group in a cluster-wide scope.
|
|
25
|
+
*
|
|
24
26
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole}
|
|
25
27
|
*/
|
|
26
28
|
V1ClusterRole: {
|
|
@@ -31,6 +33,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
31
33
|
/**
|
|
32
34
|
* Represents a K8s ClusterRoleBinding resource.
|
|
33
35
|
* ClusterRoleBinding binds a ClusterRole to a user or group in a cluster-wide scope.
|
|
36
|
+
*
|
|
34
37
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding}
|
|
35
38
|
*/
|
|
36
39
|
V1ClusterRoleBinding: {
|
|
@@ -41,6 +44,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
41
44
|
/**
|
|
42
45
|
* Represents a K8s Role resource.
|
|
43
46
|
* Role is a set of permissions that can be bound to a user or group in a namespace scope.
|
|
47
|
+
*
|
|
44
48
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole}
|
|
45
49
|
*/
|
|
46
50
|
V1Role: {
|
|
@@ -51,6 +55,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
51
55
|
/**
|
|
52
56
|
* Represents a K8s RoleBinding resource.
|
|
53
57
|
* RoleBinding binds a Role to a user or group in a namespace scope.
|
|
58
|
+
*
|
|
54
59
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding}
|
|
55
60
|
*/
|
|
56
61
|
V1RoleBinding: {
|
|
@@ -61,6 +66,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
61
66
|
/**
|
|
62
67
|
* Represents a K8s ConfigMap resource.
|
|
63
68
|
* ConfigMap holds configuration data for pods to consume.
|
|
69
|
+
*
|
|
64
70
|
* @see {@link https://kubernetes.io/docs/concepts/configuration/configmap/}
|
|
65
71
|
*/
|
|
66
72
|
V1ConfigMap: {
|
|
@@ -72,6 +78,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
72
78
|
/**
|
|
73
79
|
* Represents a K8s Endpoints resource.
|
|
74
80
|
* Endpoints expose a service's IP addresses and ports to other resources.
|
|
81
|
+
*
|
|
75
82
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/service/#endpoints}
|
|
76
83
|
*/
|
|
77
84
|
V1Endpoint: {
|
|
@@ -84,6 +91,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
84
91
|
/**
|
|
85
92
|
* Represents a K8s LimitRange resource.
|
|
86
93
|
* LimitRange enforces constraints on the resource consumption of objects in a namespace.
|
|
94
|
+
*
|
|
87
95
|
* @see {@link https://kubernetes.io/docs/concepts/policy/limit-range/}
|
|
88
96
|
*/
|
|
89
97
|
V1LimitRange: {
|
|
@@ -95,6 +103,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
95
103
|
/**
|
|
96
104
|
* Represents a K8s Namespace resource.
|
|
97
105
|
* Namespace is a way to divide cluster resources between multiple users.
|
|
106
|
+
*
|
|
98
107
|
* @see {@link https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/}
|
|
99
108
|
*/
|
|
100
109
|
V1Namespace: {
|
|
@@ -106,6 +115,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
106
115
|
/**
|
|
107
116
|
* Represents a K8s Node resource.
|
|
108
117
|
* Node is a worker machine in Kubernetes.
|
|
118
|
+
*
|
|
109
119
|
* @see {@link https://kubernetes.io/docs/concepts/architecture/nodes/}
|
|
110
120
|
*/
|
|
111
121
|
V1Node: {
|
|
@@ -117,6 +127,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
117
127
|
/**
|
|
118
128
|
* Represents a K8s PersistentVolumeClaim resource.
|
|
119
129
|
* PersistentVolumeClaim is a user's request for and claim to a persistent volume.
|
|
130
|
+
*
|
|
120
131
|
* @see {@link https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims}
|
|
121
132
|
*/
|
|
122
133
|
V1PersistentVolumeClaim: {
|
|
@@ -128,6 +139,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
128
139
|
/**
|
|
129
140
|
* Represents a K8s PersistentVolume resource.
|
|
130
141
|
* PersistentVolume is a piece of storage in the cluster that has been provisioned by an administrator.
|
|
142
|
+
*
|
|
131
143
|
* @see {@link https://kubernetes.io/docs/concepts/storage/persistent-volumes/}
|
|
132
144
|
*/
|
|
133
145
|
V1PersistentVolume: {
|
|
@@ -139,6 +151,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
139
151
|
/**
|
|
140
152
|
* Represents a K8s Pod resource.
|
|
141
153
|
* Pod is the smallest and simplest unit in the Kubernetes object model.
|
|
154
|
+
*
|
|
142
155
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/pods/}
|
|
143
156
|
*/
|
|
144
157
|
V1Pod: {
|
|
@@ -149,6 +162,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
149
162
|
/**
|
|
150
163
|
* Represents a K8s PodTemplate resource.
|
|
151
164
|
* PodTemplate is an object that describes the pod that will be created from a higher level abstraction.
|
|
165
|
+
*
|
|
152
166
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/#pod-template}
|
|
153
167
|
*/
|
|
154
168
|
V1PodTemplate: {
|
|
@@ -160,6 +174,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
160
174
|
/**
|
|
161
175
|
* Represents a K8s ReplicationController resource.
|
|
162
176
|
* ReplicationController ensures that a specified number of pod replicas are running at any given time.
|
|
177
|
+
*
|
|
163
178
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/}
|
|
164
179
|
*/
|
|
165
180
|
V1ReplicationController: {
|
|
@@ -171,6 +186,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
171
186
|
/**
|
|
172
187
|
* Represents a K8s ResourceQuota resource.
|
|
173
188
|
* ResourceQuota provides constraints that limit resource consumption per namespace.
|
|
189
|
+
*
|
|
174
190
|
* @see {@link https://kubernetes.io/docs/concepts/policy/resource-quotas/}
|
|
175
191
|
*/
|
|
176
192
|
V1ResourceQuota: {
|
|
@@ -182,6 +198,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
182
198
|
/**
|
|
183
199
|
* Represents a K8s Secret resource.
|
|
184
200
|
* Secret holds secret data of a certain type.
|
|
201
|
+
*
|
|
185
202
|
* @see {@link https://kubernetes.io/docs/concepts/configuration/secret/}
|
|
186
203
|
*/
|
|
187
204
|
V1Secret: {
|
|
@@ -193,6 +210,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
193
210
|
/**
|
|
194
211
|
* Represents a K8s ServiceAccount resource.
|
|
195
212
|
* ServiceAccount is an identity that processes in a pod can use to access the Kubernetes API.
|
|
213
|
+
*
|
|
196
214
|
* @see {@link https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/}
|
|
197
215
|
*/
|
|
198
216
|
V1ServiceAccount: {
|
|
@@ -204,6 +222,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
204
222
|
/**
|
|
205
223
|
* Represents a K8s Service resource.
|
|
206
224
|
* Service is an abstraction which defines a logical set of Pods and a policy by which to access them.
|
|
225
|
+
*
|
|
207
226
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/service/}
|
|
208
227
|
*/
|
|
209
228
|
V1Service: {
|
|
@@ -215,6 +234,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
215
234
|
/**
|
|
216
235
|
* Represents a K8s MutatingWebhookConfiguration resource.
|
|
217
236
|
* MutatingWebhookConfiguration configures a mutating admission webhook.
|
|
237
|
+
*
|
|
218
238
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly}
|
|
219
239
|
*/
|
|
220
240
|
V1MutatingWebhookConfiguration: {
|
|
@@ -226,6 +246,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
226
246
|
/**
|
|
227
247
|
* Represents a K8s ValidatingWebhookConfiguration resource.
|
|
228
248
|
* ValidatingWebhookConfiguration configures a validating admission webhook.
|
|
249
|
+
*
|
|
229
250
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly}
|
|
230
251
|
*/
|
|
231
252
|
V1ValidatingWebhookConfiguration: {
|
|
@@ -236,6 +257,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
236
257
|
/**
|
|
237
258
|
* Represents a K8s CustomResourceDefinition resource.
|
|
238
259
|
* CustomResourceDefinition is a custom resource in a Kubernetes cluster.
|
|
260
|
+
*
|
|
239
261
|
* @see {@link https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/}
|
|
240
262
|
*/
|
|
241
263
|
V1CustomResourceDefinition: {
|
|
@@ -247,6 +269,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
247
269
|
/**
|
|
248
270
|
* Represents a K8s APIService resource.
|
|
249
271
|
* APIService represents a server for a particular API version and group.
|
|
272
|
+
*
|
|
250
273
|
* @see {@link https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/}
|
|
251
274
|
*/
|
|
252
275
|
V1APIService: {
|
|
@@ -258,6 +281,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
258
281
|
/**
|
|
259
282
|
* Represents a K8s ControllerRevision resource.
|
|
260
283
|
* ControllerRevision is used to manage the history of a StatefulSet or DaemonSet.
|
|
284
|
+
*
|
|
261
285
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#revision-history}
|
|
262
286
|
*/
|
|
263
287
|
V1ControllerRevision: {
|
|
@@ -269,6 +293,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
269
293
|
/**
|
|
270
294
|
* Represents a K8s DaemonSet resource.
|
|
271
295
|
* DaemonSet ensures that all (or some) nodes run a copy of a Pod.
|
|
296
|
+
*
|
|
272
297
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/}
|
|
273
298
|
*/
|
|
274
299
|
V1DaemonSet: {
|
|
@@ -280,6 +305,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
280
305
|
/**
|
|
281
306
|
* Represents a K8s Deployment resource.
|
|
282
307
|
* Deployment provides declarative updates for Pods and ReplicaSets.
|
|
308
|
+
*
|
|
283
309
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/deployment/}
|
|
284
310
|
*/
|
|
285
311
|
V1Deployment: {
|
|
@@ -291,6 +317,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
291
317
|
/**
|
|
292
318
|
* Represents a K8s ReplicaSet resource.
|
|
293
319
|
* ReplicaSet ensures that a specified number of pod replicas are running at any given time.
|
|
320
|
+
*
|
|
294
321
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/}
|
|
295
322
|
*/
|
|
296
323
|
V1ReplicaSet: {
|
|
@@ -302,6 +329,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
302
329
|
/**
|
|
303
330
|
* Represents a K8s StatefulSet resource.
|
|
304
331
|
* StatefulSet is used to manage stateful applications.
|
|
332
|
+
*
|
|
305
333
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/}
|
|
306
334
|
*/
|
|
307
335
|
V1StatefulSet: {
|
|
@@ -313,6 +341,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
313
341
|
/**
|
|
314
342
|
* Represents a K8s TokenReview resource.
|
|
315
343
|
* TokenReview attempts to authenticate a token to a known user.
|
|
344
|
+
*
|
|
316
345
|
* @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#tokenreview-v1-authentication-k8s-io}
|
|
317
346
|
*/
|
|
318
347
|
V1TokenReview: {
|
|
@@ -324,6 +353,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
324
353
|
/**
|
|
325
354
|
* Represents a K8s LocalSubjectAccessReview resource.
|
|
326
355
|
* LocalSubjectAccessReview checks whether a specific user can perform a specific action in a specific namespace.
|
|
356
|
+
*
|
|
327
357
|
* @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#localsubjectaccessreview-v1-authorization-k8s-io}
|
|
328
358
|
*/
|
|
329
359
|
V1LocalSubjectAccessReview: {
|
|
@@ -335,6 +365,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
335
365
|
/**
|
|
336
366
|
* Represents a K8s SelfSubjectAccessReview resource.
|
|
337
367
|
* SelfSubjectAccessReview checks whether the current user can perform a specific action.
|
|
368
|
+
*
|
|
338
369
|
* @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#selfsubjectaccessreview-v1-authorization-k8s-io}
|
|
339
370
|
*/
|
|
340
371
|
V1SelfSubjectAccessReview: {
|
|
@@ -346,6 +377,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
346
377
|
/**
|
|
347
378
|
* Represents a K8s SelfSubjectRulesReview resource.
|
|
348
379
|
* SelfSubjectRulesReview lists the permissions a specific user has within a namespace.
|
|
380
|
+
*
|
|
349
381
|
* @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#selfsubjectrulesreview-v1-authorization-k8s-io}
|
|
350
382
|
*/
|
|
351
383
|
V1SelfSubjectRulesReview: {
|
|
@@ -357,6 +389,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
357
389
|
/**
|
|
358
390
|
* Represents a K8s SubjectAccessReview resource.
|
|
359
391
|
* SubjectAccessReview checks whether a specific user can perform a specific action.
|
|
392
|
+
*
|
|
360
393
|
* @see {@link https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#subjectaccessreview-v1-authorization-k8s-io}
|
|
361
394
|
*/
|
|
362
395
|
V1SubjectAccessReview: {
|
|
@@ -368,6 +401,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
368
401
|
/**
|
|
369
402
|
* Represents a K8s HorizontalPodAutoscaler resource.
|
|
370
403
|
* HorizontalPodAutoscaler automatically scales the number of Pods in a replication controller, deployment, or replica set.
|
|
404
|
+
*
|
|
371
405
|
* @see {@link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/}
|
|
372
406
|
*/
|
|
373
407
|
V1HorizontalPodAutoscaler: {
|
|
@@ -379,6 +413,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
379
413
|
/**
|
|
380
414
|
* Represents a K8s CronJob resource.
|
|
381
415
|
* CronJob manages time-based jobs, specifically those that run periodically and complete after a successful execution.
|
|
416
|
+
*
|
|
382
417
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/}
|
|
383
418
|
*/
|
|
384
419
|
V1CronJob: {
|
|
@@ -390,6 +425,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
390
425
|
/**
|
|
391
426
|
* Represents a K8s Job resource.
|
|
392
427
|
* Job represents the configuration of a single job.
|
|
428
|
+
*
|
|
393
429
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/controllers/job/}
|
|
394
430
|
*/
|
|
395
431
|
V1Job: {
|
|
@@ -401,6 +437,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
401
437
|
/**
|
|
402
438
|
* Represents a K8s CertificateSigningRequest resource.
|
|
403
439
|
* CertificateSigningRequest represents a certificate signing request.
|
|
440
|
+
*
|
|
404
441
|
* @see {@link https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/}
|
|
405
442
|
*/
|
|
406
443
|
V1CertificateSigningRequest: {
|
|
@@ -412,6 +449,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
412
449
|
/**
|
|
413
450
|
* Represents a K8s EndpointSlice resource.
|
|
414
451
|
* EndpointSlice represents a scalable set of network endpoints for a Kubernetes Service.
|
|
452
|
+
*
|
|
415
453
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/}
|
|
416
454
|
*/
|
|
417
455
|
V1EndpointSlice: {
|
|
@@ -423,6 +461,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
423
461
|
/**
|
|
424
462
|
* Represents a K8s IngressClass resource.
|
|
425
463
|
* IngressClass represents the class of the Ingress, referenced by the Ingress spec.
|
|
464
|
+
*
|
|
426
465
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/ingress/}
|
|
427
466
|
*/
|
|
428
467
|
V1IngressClass: {
|
|
@@ -434,6 +473,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
434
473
|
/**
|
|
435
474
|
* Represents a K8s Ingress resource.
|
|
436
475
|
* Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
|
|
476
|
+
*
|
|
437
477
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/ingress/}
|
|
438
478
|
*/
|
|
439
479
|
V1Ingress: {
|
|
@@ -446,6 +486,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
446
486
|
/**
|
|
447
487
|
* Represents a K8s NetworkPolicy resource.
|
|
448
488
|
* NetworkPolicy defines a set of rules for how pods communicate with each other.
|
|
489
|
+
*
|
|
449
490
|
* @see {@link https://kubernetes.io/docs/concepts/services-networking/network-policies/}
|
|
450
491
|
*/
|
|
451
492
|
V1NetworkPolicy: {
|
|
@@ -457,6 +498,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
457
498
|
/**
|
|
458
499
|
* Represents a K8s RuntimeClass resource.
|
|
459
500
|
* RuntimeClass is a cluster-scoped resource that surfaces container runtime properties to the control plane.
|
|
501
|
+
*
|
|
460
502
|
* @see {@link https://kubernetes.io/docs/concepts/containers/runtime-class/}
|
|
461
503
|
*/
|
|
462
504
|
V1RuntimeClass: {
|
|
@@ -468,6 +510,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
468
510
|
/**
|
|
469
511
|
* Represents a K8s PodDisruptionBudget resource.
|
|
470
512
|
* PodDisruptionBudget is an API object that limits the number of pods of a replicated application that are down simultaneously.
|
|
513
|
+
*
|
|
471
514
|
* @see {@link https://kubernetes.io/docs/concepts/workloads/pods/disruptions/}
|
|
472
515
|
*/
|
|
473
516
|
V1PodDisruptionBudget: {
|
|
@@ -479,6 +522,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
479
522
|
/**
|
|
480
523
|
* Represents a K8s VolumeAttachment resource.
|
|
481
524
|
* VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.
|
|
525
|
+
*
|
|
482
526
|
* @see {@link https://kubernetes.io/docs/concepts/storage/storage-classes/}
|
|
483
527
|
*/
|
|
484
528
|
V1VolumeAttachment: {
|
|
@@ -490,6 +534,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
490
534
|
/**
|
|
491
535
|
* Represents a K8s CSIDriver resource.
|
|
492
536
|
* CSIDriver captures information about a Container Storage Interface (CSI) volume driver.
|
|
537
|
+
*
|
|
493
538
|
* @see {@link https://kubernetes.io/docs/concepts/storage/volumes/}
|
|
494
539
|
*/
|
|
495
540
|
V1CSIDriver: {
|
|
@@ -501,6 +546,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
501
546
|
/**
|
|
502
547
|
* Represents a K8s CSIStorageCapacity resource.
|
|
503
548
|
* CSIStorageCapacity stores the reported storage capacity of a CSI node or storage class.
|
|
549
|
+
*
|
|
504
550
|
* @see {@link https://kubernetes.io/docs/concepts/storage/csi/}
|
|
505
551
|
*/
|
|
506
552
|
V1CSIStorageCapacity: {
|
|
@@ -512,6 +558,7 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
512
558
|
/**
|
|
513
559
|
* Represents a K8s StorageClass resource.
|
|
514
560
|
* StorageClass is a cluster-scoped resource that provides a way for administrators to describe the classes of storage they offer.
|
|
561
|
+
*
|
|
515
562
|
* @see {@link https://kubernetes.io/docs/concepts/storage/storage-classes/}
|
|
516
563
|
*/
|
|
517
564
|
V1StorageClass: {
|
|
@@ -521,6 +568,12 @@ const gvkMap: Record<string, GroupVersionKind> = {
|
|
|
521
568
|
},
|
|
522
569
|
};
|
|
523
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Converts a model name to a GroupVersionKind
|
|
573
|
+
*
|
|
574
|
+
* @param key The name of the model
|
|
575
|
+
* @returns The GroupVersionKind for the model
|
|
576
|
+
*/
|
|
524
577
|
export function modelToGroupVersionKind(key: string): GroupVersionKind {
|
|
525
578
|
return gvkMap[key];
|
|
526
579
|
}
|
package/src/types.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class GenericKind implements KubernetesObject {
|
|
|
24
24
|
/**
|
|
25
25
|
* GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion
|
|
26
26
|
* to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
|
|
27
|
-
|
|
27
|
+
*/
|
|
28
28
|
export interface GroupVersionKind {
|
|
29
29
|
/** The K8s resource kind, e..g "Pod". */
|
|
30
30
|
readonly kind: string;
|