kubernetes-fluent-client 3.0.3 → 4.0.0-rc-http2-watch
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/.prettierignore +4 -0
- package/README.md +24 -0
- package/dist/cli.js +21 -1
- package/dist/fileSystem.d.ts +11 -0
- package/dist/fileSystem.d.ts.map +1 -0
- package/dist/fileSystem.js +42 -0
- package/dist/fileSystem.test.d.ts +2 -0
- package/dist/fileSystem.test.d.ts.map +1 -0
- package/dist/fileSystem.test.js +75 -0
- package/dist/fluent/watch.d.ts +2 -0
- package/dist/fluent/watch.d.ts.map +1 -1
- package/dist/fluent/watch.js +147 -27
- package/dist/generate.d.ts +71 -11
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +130 -117
- package/dist/generate.test.js +293 -346
- package/dist/postProcessing.d.ts +246 -0
- package/dist/postProcessing.d.ts.map +1 -0
- package/dist/postProcessing.js +497 -0
- package/dist/postProcessing.test.d.ts +2 -0
- package/dist/postProcessing.test.d.ts.map +1 -0
- package/dist/postProcessing.test.js +550 -0
- package/e2e/cli.e2e.test.ts +127 -0
- package/e2e/crds/policyreports.default.expected/policyreport-v1alpha1.ts +332 -0
- package/e2e/crds/policyreports.default.expected/policyreport-v1alpha2.ts +360 -0
- package/e2e/crds/policyreports.default.expected/policyreport-v1beta1.ts +360 -0
- package/e2e/crds/policyreports.no.post.expected/policyreport-v1alpha1.ts +331 -0
- package/e2e/crds/policyreports.no.post.expected/policyreport-v1alpha2.ts +360 -0
- package/e2e/crds/policyreports.no.post.expected/policyreport-v1beta1.ts +360 -0
- package/e2e/crds/test.yaml/policyreports.test.yaml +1008 -0
- package/e2e/crds/test.yaml/uds-podmonitors.test.yaml +1245 -0
- package/e2e/crds/uds-podmonitors.default.expected/podmonitor-v1.ts +1333 -0
- package/e2e/crds/uds-podmonitors.no.post.expected/podmonitor-v1.ts +1360 -0
- package/package.json +6 -5
- package/src/cli.ts +25 -1
- package/src/fileSystem.test.ts +67 -0
- package/src/fileSystem.ts +25 -0
- package/src/fluent/watch.ts +174 -35
- package/src/generate.test.ts +368 -358
- package/src/generate.ts +173 -154
- package/src/postProcessing.test.ts +742 -0
- package/src/postProcessing.ts +568 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PolicyReport is the Schema for the policyreports API
|
|
3
|
+
*/
|
|
4
|
+
export interface PolicyReport {
|
|
5
|
+
/**
|
|
6
|
+
* APIVersion defines the versioned schema of this representation of an object. Servers
|
|
7
|
+
* should convert recognized schemas to the latest internal value, and may reject
|
|
8
|
+
* unrecognized values. More info:
|
|
9
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
|
10
|
+
*/
|
|
11
|
+
apiVersion?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Kind is a string value representing the REST resource this object represents. Servers may
|
|
14
|
+
* infer this from the endpoint the client submits requests to. Cannot be updated. In
|
|
15
|
+
* CamelCase. More info:
|
|
16
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
|
17
|
+
*/
|
|
18
|
+
kind?: string;
|
|
19
|
+
metadata?: { [key: string]: any };
|
|
20
|
+
/**
|
|
21
|
+
* PolicyReportResult provides result details
|
|
22
|
+
*/
|
|
23
|
+
results?: ResultElement[];
|
|
24
|
+
/**
|
|
25
|
+
* Scope is an optional reference to the report scope (e.g. a Deployment, Namespace, or Node)
|
|
26
|
+
*/
|
|
27
|
+
scope?: Scope;
|
|
28
|
+
/**
|
|
29
|
+
* ScopeSelector is an optional selector for multiple scopes (e.g. Pods). Either one of, or
|
|
30
|
+
* none of, but not both of, Scope or ScopeSelector should be specified.
|
|
31
|
+
*/
|
|
32
|
+
scopeSelector?: ScopeSelector;
|
|
33
|
+
/**
|
|
34
|
+
* PolicyReportSummary provides a summary of results
|
|
35
|
+
*/
|
|
36
|
+
summary?: Summary;
|
|
37
|
+
[property: string]: any;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* PolicyReportResult provides the result for an individual policy
|
|
42
|
+
*/
|
|
43
|
+
export interface ResultElement {
|
|
44
|
+
/**
|
|
45
|
+
* Category indicates policy category
|
|
46
|
+
*/
|
|
47
|
+
category?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Description is a short user friendly message for the policy rule
|
|
50
|
+
*/
|
|
51
|
+
message?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Policy is the name or identifier of the policy
|
|
54
|
+
*/
|
|
55
|
+
policy: string;
|
|
56
|
+
/**
|
|
57
|
+
* Properties provides additional information for the policy rule
|
|
58
|
+
*/
|
|
59
|
+
properties?: { [key: string]: string };
|
|
60
|
+
/**
|
|
61
|
+
* Subjects is an optional reference to the checked Kubernetes resources
|
|
62
|
+
*/
|
|
63
|
+
resources?: Resource[];
|
|
64
|
+
/**
|
|
65
|
+
* SubjectSelector is an optional label selector for checked Kubernetes resources. For
|
|
66
|
+
* example, a policy result may apply to all pods that match a label. Either a Subject or a
|
|
67
|
+
* SubjectSelector can be specified. If neither are provided, the result is assumed to be
|
|
68
|
+
* for the policy report scope.
|
|
69
|
+
*/
|
|
70
|
+
resourceSelector?: ResourceSelector;
|
|
71
|
+
/**
|
|
72
|
+
* Result indicates the outcome of the policy rule execution
|
|
73
|
+
*/
|
|
74
|
+
result?: ResultEnum;
|
|
75
|
+
/**
|
|
76
|
+
* Rule is the name or identifier of the rule within the policy
|
|
77
|
+
*/
|
|
78
|
+
rule?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Scored indicates if this result is scored
|
|
81
|
+
*/
|
|
82
|
+
scored?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Severity indicates policy check result criticality
|
|
85
|
+
*/
|
|
86
|
+
severity?: Severity;
|
|
87
|
+
/**
|
|
88
|
+
* Source is an identifier for the policy engine that manages this report
|
|
89
|
+
*/
|
|
90
|
+
source?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Timestamp indicates the time the result was found
|
|
93
|
+
*/
|
|
94
|
+
timestamp?: Timestamp;
|
|
95
|
+
[property: string]: any;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* SubjectSelector is an optional label selector for checked Kubernetes resources. For
|
|
100
|
+
* example, a policy result may apply to all pods that match a label. Either a Subject or a
|
|
101
|
+
* SubjectSelector can be specified. If neither are provided, the result is assumed to be
|
|
102
|
+
* for the policy report scope.
|
|
103
|
+
*/
|
|
104
|
+
export interface ResourceSelector {
|
|
105
|
+
/**
|
|
106
|
+
* matchExpressions is a list of label selector requirements. The requirements are ANDed.
|
|
107
|
+
*/
|
|
108
|
+
matchExpressions?: ResourceSelectorMatchExpression[];
|
|
109
|
+
/**
|
|
110
|
+
* matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is
|
|
111
|
+
* equivalent to an element of matchExpressions, whose key field is "key", the operator is
|
|
112
|
+
* "In", and the values array contains only "value". The requirements are ANDed.
|
|
113
|
+
*/
|
|
114
|
+
matchLabels?: { [key: string]: string };
|
|
115
|
+
[property: string]: any;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A label selector requirement is a selector that contains values, a key, and an operator
|
|
120
|
+
* that relates the key and values.
|
|
121
|
+
*/
|
|
122
|
+
export interface ResourceSelectorMatchExpression {
|
|
123
|
+
/**
|
|
124
|
+
* key is the label key that the selector applies to.
|
|
125
|
+
*/
|
|
126
|
+
key: string;
|
|
127
|
+
/**
|
|
128
|
+
* operator represents a key's relationship to a set of values. Valid operators are In,
|
|
129
|
+
* NotIn, Exists and DoesNotExist.
|
|
130
|
+
*/
|
|
131
|
+
operator: string;
|
|
132
|
+
/**
|
|
133
|
+
* values is an array of string values. If the operator is In or NotIn, the values array
|
|
134
|
+
* must be non-empty. If the operator is Exists or DoesNotExist, the values array must be
|
|
135
|
+
* empty. This array is replaced during a strategic merge patch.
|
|
136
|
+
*/
|
|
137
|
+
values?: string[];
|
|
138
|
+
[property: string]: any;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* ObjectReference contains enough information to let you inspect or modify the referred
|
|
143
|
+
* object. --- New uses of this type are discouraged because of difficulty describing its
|
|
144
|
+
* usage when embedded in APIs. 1. Ignored fields. It includes many fields which are not
|
|
145
|
+
* generally honored. For instance, ResourceVersion and FieldPath are both very rarely
|
|
146
|
+
* valid in actual usage. 2. Invalid usage help. It is impossible to add specific help for
|
|
147
|
+
* individual usage. In most embedded usages, there are particular restrictions like, "must
|
|
148
|
+
* refer only to types A and B" or "UID not honored" or "name must be restricted". Those
|
|
149
|
+
* cannot be well described when embedded. 3. Inconsistent validation. Because the usages
|
|
150
|
+
* are different, the validation rules are different by usage, which makes it hard for users
|
|
151
|
+
* to predict what will happen. 4. The fields are both imprecise and overly precise. Kind
|
|
152
|
+
* is not a precise mapping to a URL. This can produce ambiguity during interpretation and
|
|
153
|
+
* require a REST mapping. In most cases, the dependency is on the group,resource tuple and
|
|
154
|
+
* the version of the actual struct is irrelevant. 5. We cannot easily change it. Because
|
|
155
|
+
* this type is embedded in many locations, updates to this type will affect numerous
|
|
156
|
+
* schemas. Don't make new APIs embed an underspecified API type they do not control.
|
|
157
|
+
* Instead of using this type, create a locally provided and used type that is well-focused
|
|
158
|
+
* on your reference. For example, ServiceReferences for admission registration:
|
|
159
|
+
* https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
|
|
160
|
+
* .
|
|
161
|
+
*/
|
|
162
|
+
export interface Resource {
|
|
163
|
+
/**
|
|
164
|
+
* API version of the referent.
|
|
165
|
+
*/
|
|
166
|
+
apiVersion?: string;
|
|
167
|
+
/**
|
|
168
|
+
* If referring to a piece of an object instead of an entire object, this string should
|
|
169
|
+
* contain a valid JSON/Go field access statement, such as
|
|
170
|
+
* desiredState.manifest.containers[2]. For example, if the object reference is to a
|
|
171
|
+
* container within a pod, this would take on a value like: "spec.containers{name}" (where
|
|
172
|
+
* "name" refers to the name of the container that triggered the event) or if no container
|
|
173
|
+
* name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax
|
|
174
|
+
* is chosen only to have some well-defined way of referencing a part of an object. TODO:
|
|
175
|
+
* this design is not final and this field is subject to change in the future.
|
|
176
|
+
*/
|
|
177
|
+
fieldPath?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Kind of the referent. More info:
|
|
180
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
|
181
|
+
*/
|
|
182
|
+
kind?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Name of the referent. More info:
|
|
185
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
|
186
|
+
*/
|
|
187
|
+
name?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Namespace of the referent. More info:
|
|
190
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
|
|
191
|
+
*/
|
|
192
|
+
namespace?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Specific resourceVersion to which this reference is made, if any. More info:
|
|
195
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
|
196
|
+
*/
|
|
197
|
+
resourceVersion?: string;
|
|
198
|
+
/**
|
|
199
|
+
* UID of the referent. More info:
|
|
200
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
|
|
201
|
+
*/
|
|
202
|
+
uid?: string;
|
|
203
|
+
[property: string]: any;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Result indicates the outcome of the policy rule execution
|
|
208
|
+
*/
|
|
209
|
+
export enum ResultEnum {
|
|
210
|
+
Error = "error",
|
|
211
|
+
Fail = "fail",
|
|
212
|
+
Pass = "pass",
|
|
213
|
+
Skip = "skip",
|
|
214
|
+
Warn = "warn",
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Severity indicates policy check result criticality
|
|
219
|
+
*/
|
|
220
|
+
export enum Severity {
|
|
221
|
+
Critical = "critical",
|
|
222
|
+
High = "high",
|
|
223
|
+
Info = "info",
|
|
224
|
+
Low = "low",
|
|
225
|
+
Medium = "medium",
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Timestamp indicates the time the result was found
|
|
230
|
+
*/
|
|
231
|
+
export interface Timestamp {
|
|
232
|
+
/**
|
|
233
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative second values with
|
|
234
|
+
* fractions must still have non-negative nanos values that count forward in time. Must be
|
|
235
|
+
* from 0 to 999,999,999 inclusive. This field may be limited in precision depending on
|
|
236
|
+
* context.
|
|
237
|
+
*/
|
|
238
|
+
nanos: number;
|
|
239
|
+
/**
|
|
240
|
+
* Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from
|
|
241
|
+
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
|
|
242
|
+
*/
|
|
243
|
+
seconds: number;
|
|
244
|
+
[property: string]: any;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Scope is an optional reference to the report scope (e.g. a Deployment, Namespace, or Node)
|
|
249
|
+
*/
|
|
250
|
+
export interface Scope {
|
|
251
|
+
/**
|
|
252
|
+
* API version of the referent.
|
|
253
|
+
*/
|
|
254
|
+
apiVersion?: string;
|
|
255
|
+
/**
|
|
256
|
+
* If referring to a piece of an object instead of an entire object, this string should
|
|
257
|
+
* contain a valid JSON/Go field access statement, such as
|
|
258
|
+
* desiredState.manifest.containers[2]. For example, if the object reference is to a
|
|
259
|
+
* container within a pod, this would take on a value like: "spec.containers{name}" (where
|
|
260
|
+
* "name" refers to the name of the container that triggered the event) or if no container
|
|
261
|
+
* name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax
|
|
262
|
+
* is chosen only to have some well-defined way of referencing a part of an object. TODO:
|
|
263
|
+
* this design is not final and this field is subject to change in the future.
|
|
264
|
+
*/
|
|
265
|
+
fieldPath?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Kind of the referent. More info:
|
|
268
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
|
269
|
+
*/
|
|
270
|
+
kind?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Name of the referent. More info:
|
|
273
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
|
274
|
+
*/
|
|
275
|
+
name?: string;
|
|
276
|
+
/**
|
|
277
|
+
* Namespace of the referent. More info:
|
|
278
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
|
|
279
|
+
*/
|
|
280
|
+
namespace?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Specific resourceVersion to which this reference is made, if any. More info:
|
|
283
|
+
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
|
|
284
|
+
*/
|
|
285
|
+
resourceVersion?: string;
|
|
286
|
+
/**
|
|
287
|
+
* UID of the referent. More info:
|
|
288
|
+
* https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
|
|
289
|
+
*/
|
|
290
|
+
uid?: string;
|
|
291
|
+
[property: string]: any;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* ScopeSelector is an optional selector for multiple scopes (e.g. Pods). Either one of, or
|
|
296
|
+
* none of, but not both of, Scope or ScopeSelector should be specified.
|
|
297
|
+
*/
|
|
298
|
+
export interface ScopeSelector {
|
|
299
|
+
/**
|
|
300
|
+
* matchExpressions is a list of label selector requirements. The requirements are ANDed.
|
|
301
|
+
*/
|
|
302
|
+
matchExpressions?: ScopeSelectorMatchExpression[];
|
|
303
|
+
/**
|
|
304
|
+
* matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is
|
|
305
|
+
* equivalent to an element of matchExpressions, whose key field is "key", the operator is
|
|
306
|
+
* "In", and the values array contains only "value". The requirements are ANDed.
|
|
307
|
+
*/
|
|
308
|
+
matchLabels?: { [key: string]: string };
|
|
309
|
+
[property: string]: any;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* A label selector requirement is a selector that contains values, a key, and an operator
|
|
314
|
+
* that relates the key and values.
|
|
315
|
+
*/
|
|
316
|
+
export interface ScopeSelectorMatchExpression {
|
|
317
|
+
/**
|
|
318
|
+
* key is the label key that the selector applies to.
|
|
319
|
+
*/
|
|
320
|
+
key: string;
|
|
321
|
+
/**
|
|
322
|
+
* operator represents a key's relationship to a set of values. Valid operators are In,
|
|
323
|
+
* NotIn, Exists and DoesNotExist.
|
|
324
|
+
*/
|
|
325
|
+
operator: string;
|
|
326
|
+
/**
|
|
327
|
+
* values is an array of string values. If the operator is In or NotIn, the values array
|
|
328
|
+
* must be non-empty. If the operator is Exists or DoesNotExist, the values array must be
|
|
329
|
+
* empty. This array is replaced during a strategic merge patch.
|
|
330
|
+
*/
|
|
331
|
+
values?: string[];
|
|
332
|
+
[property: string]: any;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* PolicyReportSummary provides a summary of results
|
|
337
|
+
*/
|
|
338
|
+
export interface Summary {
|
|
339
|
+
/**
|
|
340
|
+
* Error provides the count of policies that could not be evaluated
|
|
341
|
+
*/
|
|
342
|
+
error?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Fail provides the count of policies whose requirements were not met
|
|
345
|
+
*/
|
|
346
|
+
fail?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Pass provides the count of policies whose requirements were met
|
|
349
|
+
*/
|
|
350
|
+
pass?: number;
|
|
351
|
+
/**
|
|
352
|
+
* Skip indicates the count of policies that were not selected for evaluation
|
|
353
|
+
*/
|
|
354
|
+
skip?: number;
|
|
355
|
+
/**
|
|
356
|
+
* Warn provides the count of non-scored policies whose requirements were not met
|
|
357
|
+
*/
|
|
358
|
+
warn?: number;
|
|
359
|
+
[property: string]: any;
|
|
360
|
+
}
|