pepr 0.3.0-rc0 → 0.3.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/README.md +3 -46
- package/dist/package.json +8 -6
- package/dist/src/cli/build.js +1 -1
- package/dist/src/cli/dev.js +4 -1
- package/dist/src/cli/init/index.js +1 -1
- package/dist/src/lib/capability.d.ts +29 -0
- package/dist/src/lib/capability.d.ts.map +1 -0
- package/dist/src/lib/controller.d.ts +18 -0
- package/dist/src/lib/controller.d.ts.map +1 -0
- package/dist/src/lib/fetch.d.ts +24 -0
- package/dist/src/lib/fetch.d.ts.map +1 -0
- package/dist/src/lib/filter.d.ts +11 -0
- package/dist/src/lib/filter.d.ts.map +1 -0
- package/dist/src/lib/index.d.ts +15 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/{index.js → src/lib/index.js} +6 -6
- package/dist/src/lib/k8s/index.d.ts +6 -0
- package/dist/src/lib/k8s/index.d.ts.map +1 -0
- package/dist/src/lib/k8s/kinds.d.ts +12 -0
- package/dist/src/lib/k8s/kinds.d.ts.map +1 -0
- package/dist/src/lib/k8s/tls.d.ts +18 -0
- package/dist/src/lib/k8s/tls.d.ts.map +1 -0
- package/dist/src/lib/k8s/types.d.ts +148 -0
- package/dist/src/lib/k8s/types.d.ts.map +1 -0
- package/dist/src/lib/k8s/upstream.d.ts +4 -0
- package/dist/src/lib/k8s/upstream.d.ts.map +1 -0
- package/dist/src/lib/k8s/webhook.d.ts +35 -0
- package/dist/src/lib/k8s/webhook.d.ts.map +1 -0
- package/dist/src/lib/logger.d.ts +56 -0
- package/dist/src/lib/logger.d.ts.map +1 -0
- package/dist/src/lib/module.d.ts +33 -0
- package/dist/src/lib/module.d.ts.map +1 -0
- package/dist/src/lib/processor.d.ts +5 -0
- package/dist/src/lib/processor.d.ts.map +1 -0
- package/dist/src/lib/request.d.ts +78 -0
- package/dist/src/lib/request.d.ts.map +1 -0
- package/dist/src/lib/types.d.ts +188 -0
- package/dist/src/lib/types.d.ts.map +1 -0
- package/package.json +8 -6
- package/{index.ts → src/lib/index.ts} +6 -6
- package/dist/fixtures/data/cm1.json +0 -75
- package/dist/fixtures/data/deployment1.json +0 -170
- package/dist/fixtures/data/ns1.json +0 -72
- package/dist/fixtures/data/pod1.json +0 -271
- package/dist/fixtures/data/pod2.json +0 -257
- package/dist/fixtures/data/svc1.json +0 -100
- package/dist/fixtures/loader.js +0 -60
- package/dist/src/cli/init/utils.test.js +0 -29
- package/dist/src/cli/init/walkthrough.test.js +0 -21
- package/dist/src/lib/fetch.test.js +0 -98
- package/dist/src/lib/filter.test.js +0 -208
- package/dist/src/lib/k8s/kinds.test.js +0 -296
- package/dist/src/lib/logger.test.js +0 -64
- package/docs/.prettierrc.json +0 -13
- package/docs/actions.md +0 -58
- package/docs/capabilities.md +0 -17
- package/docs/cli.md +0 -58
- package/docs/module.md +0 -90
- package/osv-scanner.toml +0 -4
- package/src/lib/fetch.test.ts +0 -115
- package/src/lib/filter.test.ts +0 -231
- package/src/lib/k8s/kinds.test.ts +0 -333
- package/src/lib/logger.test.ts +0 -80
package/src/lib/fetch.test.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
|
-
// fetch.test.ts
|
|
4
|
-
|
|
5
|
-
import test from "ava";
|
|
6
|
-
import { StatusCodes } from "http-status-codes";
|
|
7
|
-
import nock from "nock";
|
|
8
|
-
import { RequestInit } from "node-fetch";
|
|
9
|
-
import { fetch } from "./fetch";
|
|
10
|
-
|
|
11
|
-
test.beforeEach(() => {
|
|
12
|
-
nock("https://jsonplaceholder.typicode.com")
|
|
13
|
-
.get("/todos/1")
|
|
14
|
-
.reply(200, {
|
|
15
|
-
userId: 1,
|
|
16
|
-
id: 1,
|
|
17
|
-
title: "Example title",
|
|
18
|
-
completed: false,
|
|
19
|
-
})
|
|
20
|
-
.post("/todos", {
|
|
21
|
-
title: "test todo",
|
|
22
|
-
userId: 1,
|
|
23
|
-
completed: false,
|
|
24
|
-
})
|
|
25
|
-
.reply(200, (uri, requestBody) => requestBody)
|
|
26
|
-
.get("/todos/empty-null")
|
|
27
|
-
.reply(200, undefined)
|
|
28
|
-
.get("/todos/empty-string")
|
|
29
|
-
.reply(200, "")
|
|
30
|
-
.get("/todos/empty-object")
|
|
31
|
-
.reply(200, {})
|
|
32
|
-
.get("/todos/invalid")
|
|
33
|
-
.replyWithError("Something bad happened");
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("fetch: should return without type data", async t => {
|
|
37
|
-
const url = "https://jsonplaceholder.typicode.com/todos/1";
|
|
38
|
-
const { data, ok } = await fetch<{ title: string }>(url);
|
|
39
|
-
t.is(ok, true);
|
|
40
|
-
t.is(data["title"], "Example title");
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("fetch: should return parsed JSON response as a specific type", async t => {
|
|
44
|
-
interface Todo {
|
|
45
|
-
userId: number;
|
|
46
|
-
id: number;
|
|
47
|
-
title: string;
|
|
48
|
-
completed: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const url = "https://jsonplaceholder.typicode.com/todos/1";
|
|
52
|
-
const { data, ok } = await fetch<Todo>(url);
|
|
53
|
-
t.is(ok, true);
|
|
54
|
-
t.is(data.id, 1);
|
|
55
|
-
t.is(typeof data.title, "string");
|
|
56
|
-
t.is(typeof data.completed, "boolean");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test("fetch: should handle additional request options", async t => {
|
|
60
|
-
const url = "https://jsonplaceholder.typicode.com/todos";
|
|
61
|
-
const requestOptions: RequestInit = {
|
|
62
|
-
method: "POST",
|
|
63
|
-
body: JSON.stringify({
|
|
64
|
-
title: "test todo",
|
|
65
|
-
userId: 1,
|
|
66
|
-
completed: false,
|
|
67
|
-
}),
|
|
68
|
-
headers: {
|
|
69
|
-
"Content-type": "application/json; charset=UTF-8",
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
-
const { data, ok } = await fetch<any>(url, requestOptions);
|
|
75
|
-
t.is(ok, true);
|
|
76
|
-
t.is(data["title"], "test todo");
|
|
77
|
-
t.is(data["userId"], 1);
|
|
78
|
-
t.is(data["completed"], false);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test("fetch: should handle empty (null) responses", async t => {
|
|
82
|
-
const url = "https://jsonplaceholder.typicode.com/todos/empty-null";
|
|
83
|
-
const resp = await fetch(url);
|
|
84
|
-
|
|
85
|
-
t.is(resp.data, "");
|
|
86
|
-
t.is(resp.ok, true);
|
|
87
|
-
t.is(resp.status, StatusCodes.OK);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("fetch: should handle empty (string) responses", async t => {
|
|
91
|
-
const url = "https://jsonplaceholder.typicode.com/todos/empty-string";
|
|
92
|
-
const resp = await fetch(url);
|
|
93
|
-
|
|
94
|
-
t.is(resp.data, "");
|
|
95
|
-
t.is(resp.ok, true);
|
|
96
|
-
t.is(resp.status, StatusCodes.OK);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
test("fetch: should handle empty (object) responses", async t => {
|
|
100
|
-
const url = "https://jsonplaceholder.typicode.com/todos/empty-object";
|
|
101
|
-
const resp = await fetch(url);
|
|
102
|
-
|
|
103
|
-
t.deepEqual(resp.data, {});
|
|
104
|
-
t.is(resp.ok, true);
|
|
105
|
-
t.is(resp.status, StatusCodes.OK);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test("fetch: should handle failed requests without throwing an error", async t => {
|
|
109
|
-
const url = "https://jsonplaceholder.typicode.com/todos/invalid";
|
|
110
|
-
const resp = await fetch(url);
|
|
111
|
-
|
|
112
|
-
t.is(resp.data, undefined);
|
|
113
|
-
t.is(resp.ok, false);
|
|
114
|
-
t.is(resp.status, StatusCodes.BAD_REQUEST);
|
|
115
|
-
});
|
package/src/lib/filter.test.ts
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import test from "ava";
|
|
2
|
-
import { POD1 } from "../../fixtures/loader";
|
|
3
|
-
import { shouldSkipRequest } from "./filter";
|
|
4
|
-
import { gvkMap } from "./k8s";
|
|
5
|
-
|
|
6
|
-
const callback = () => undefined;
|
|
7
|
-
|
|
8
|
-
test("should reject when name does not match", t => {
|
|
9
|
-
const binding = {
|
|
10
|
-
kind: gvkMap.V1Pod,
|
|
11
|
-
filters: {
|
|
12
|
-
name: "bleh",
|
|
13
|
-
namespaces: [],
|
|
14
|
-
labels: {},
|
|
15
|
-
annotations: {},
|
|
16
|
-
},
|
|
17
|
-
callback,
|
|
18
|
-
};
|
|
19
|
-
const pod = POD1();
|
|
20
|
-
|
|
21
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("should reject when kind does not match", t => {
|
|
25
|
-
const binding = {
|
|
26
|
-
kind: gvkMap.V1ConfigMap,
|
|
27
|
-
filters: {
|
|
28
|
-
name: "",
|
|
29
|
-
namespaces: [],
|
|
30
|
-
labels: {},
|
|
31
|
-
annotations: {},
|
|
32
|
-
},
|
|
33
|
-
callback,
|
|
34
|
-
};
|
|
35
|
-
const pod = POD1();
|
|
36
|
-
|
|
37
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test("should reject when group does not match", t => {
|
|
41
|
-
const binding = {
|
|
42
|
-
kind: gvkMap.V1CronJob,
|
|
43
|
-
filters: {
|
|
44
|
-
name: "",
|
|
45
|
-
namespaces: [],
|
|
46
|
-
labels: {},
|
|
47
|
-
annotations: {},
|
|
48
|
-
},
|
|
49
|
-
callback,
|
|
50
|
-
};
|
|
51
|
-
const pod = POD1();
|
|
52
|
-
|
|
53
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("should reject when version does not match", t => {
|
|
57
|
-
const binding = {
|
|
58
|
-
kind: {
|
|
59
|
-
group: "",
|
|
60
|
-
version: "v2",
|
|
61
|
-
kind: "Pod",
|
|
62
|
-
},
|
|
63
|
-
filters: {
|
|
64
|
-
name: "",
|
|
65
|
-
namespaces: [],
|
|
66
|
-
labels: {},
|
|
67
|
-
annotations: {},
|
|
68
|
-
},
|
|
69
|
-
callback,
|
|
70
|
-
};
|
|
71
|
-
const pod = POD1();
|
|
72
|
-
|
|
73
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test("should allow when group, version, and kind match", t => {
|
|
77
|
-
const binding = {
|
|
78
|
-
kind: gvkMap.V1Pod,
|
|
79
|
-
filters: {
|
|
80
|
-
name: "",
|
|
81
|
-
namespaces: [],
|
|
82
|
-
labels: {},
|
|
83
|
-
annotations: {},
|
|
84
|
-
},
|
|
85
|
-
callback,
|
|
86
|
-
};
|
|
87
|
-
const pod = POD1();
|
|
88
|
-
|
|
89
|
-
t.false(shouldSkipRequest(binding, pod));
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test("should allow when kind match and others are empty", t => {
|
|
93
|
-
const binding = {
|
|
94
|
-
kind: {
|
|
95
|
-
group: "",
|
|
96
|
-
version: "",
|
|
97
|
-
kind: "Pod",
|
|
98
|
-
},
|
|
99
|
-
filters: {
|
|
100
|
-
name: "",
|
|
101
|
-
namespaces: [],
|
|
102
|
-
labels: {},
|
|
103
|
-
annotations: {},
|
|
104
|
-
},
|
|
105
|
-
callback,
|
|
106
|
-
};
|
|
107
|
-
const pod = POD1();
|
|
108
|
-
|
|
109
|
-
t.false(shouldSkipRequest(binding, pod));
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test("should reject when namespace does not match", t => {
|
|
113
|
-
const binding = {
|
|
114
|
-
kind: gvkMap.V1Pod,
|
|
115
|
-
filters: {
|
|
116
|
-
name: "",
|
|
117
|
-
namespaces: ["bleh"],
|
|
118
|
-
labels: {},
|
|
119
|
-
annotations: {},
|
|
120
|
-
},
|
|
121
|
-
callback,
|
|
122
|
-
};
|
|
123
|
-
const pod = POD1();
|
|
124
|
-
|
|
125
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test("should allow when namespace is match", t => {
|
|
129
|
-
const binding = {
|
|
130
|
-
kind: gvkMap.V1Pod,
|
|
131
|
-
filters: {
|
|
132
|
-
name: "",
|
|
133
|
-
namespaces: ["default", "unicorn", "things"],
|
|
134
|
-
labels: {},
|
|
135
|
-
annotations: {},
|
|
136
|
-
},
|
|
137
|
-
callback,
|
|
138
|
-
};
|
|
139
|
-
const pod = POD1();
|
|
140
|
-
|
|
141
|
-
t.false(shouldSkipRequest(binding, pod));
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
test("should reject when label does not match", t => {
|
|
145
|
-
const binding = {
|
|
146
|
-
kind: gvkMap.V1Pod,
|
|
147
|
-
filters: {
|
|
148
|
-
name: "",
|
|
149
|
-
namespaces: [],
|
|
150
|
-
labels: {
|
|
151
|
-
foo: "bar",
|
|
152
|
-
},
|
|
153
|
-
annotations: {},
|
|
154
|
-
},
|
|
155
|
-
callback,
|
|
156
|
-
};
|
|
157
|
-
const pod = POD1();
|
|
158
|
-
|
|
159
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test("should allow when label is match", t => {
|
|
163
|
-
const binding = {
|
|
164
|
-
kind: gvkMap.V1Pod,
|
|
165
|
-
filters: {
|
|
166
|
-
name: "",
|
|
167
|
-
|
|
168
|
-
namespaces: [],
|
|
169
|
-
labels: {
|
|
170
|
-
foo: "bar",
|
|
171
|
-
test: "test1",
|
|
172
|
-
},
|
|
173
|
-
annotations: {},
|
|
174
|
-
},
|
|
175
|
-
callback,
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const pod = POD1();
|
|
179
|
-
pod.object.metadata = pod.object.metadata || {};
|
|
180
|
-
pod.object.metadata.labels = {
|
|
181
|
-
foo: "bar",
|
|
182
|
-
test: "test1",
|
|
183
|
-
test2: "test2",
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
t.false(shouldSkipRequest(binding, pod));
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
test("should reject when annotation does not match", t => {
|
|
190
|
-
const binding = {
|
|
191
|
-
kind: gvkMap.V1Pod,
|
|
192
|
-
filters: {
|
|
193
|
-
name: "",
|
|
194
|
-
namespaces: [],
|
|
195
|
-
labels: {},
|
|
196
|
-
annotations: {
|
|
197
|
-
foo: "bar",
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
callback,
|
|
201
|
-
};
|
|
202
|
-
const pod = POD1();
|
|
203
|
-
|
|
204
|
-
t.true(shouldSkipRequest(binding, pod));
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
test("should allow when annotation is match", t => {
|
|
208
|
-
const binding = {
|
|
209
|
-
kind: gvkMap.V1Pod,
|
|
210
|
-
filters: {
|
|
211
|
-
name: "",
|
|
212
|
-
namespaces: [],
|
|
213
|
-
labels: {},
|
|
214
|
-
annotations: {
|
|
215
|
-
foo: "bar",
|
|
216
|
-
test: "test1",
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
callback,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const pod = POD1();
|
|
223
|
-
pod.object.metadata = pod.object.metadata || {};
|
|
224
|
-
pod.object.metadata.annotations = {
|
|
225
|
-
foo: "bar",
|
|
226
|
-
test: "test1",
|
|
227
|
-
test2: "test2",
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
t.false(shouldSkipRequest(binding, pod));
|
|
231
|
-
});
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
|
-
|
|
4
|
-
import test from "ava";
|
|
5
|
-
import { a, modelToGroupVersionKind } from ".";
|
|
6
|
-
|
|
7
|
-
test("should return the correct GroupVersionKind for 'a.V1APIService'", t => {
|
|
8
|
-
const { name } = a.APIService;
|
|
9
|
-
const gvk = modelToGroupVersionKind(name);
|
|
10
|
-
t.is(gvk.group, "apiregistration.k8s.io");
|
|
11
|
-
t.is(gvk.version, "v1");
|
|
12
|
-
t.is(gvk.kind, "APIService");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("should return the correct GroupVersionKind for 'a.V1CertificateSigningRequest'", t => {
|
|
16
|
-
const { name } = a.CertificateSigningRequest;
|
|
17
|
-
const gvk = modelToGroupVersionKind(name);
|
|
18
|
-
t.is(gvk.group, "certificates.k8s.io");
|
|
19
|
-
t.is(gvk.version, "v1");
|
|
20
|
-
t.is(gvk.kind, "CertificateSigningRequest");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("should return the correct GroupVersionKind for 'a.V1ConfigMap'", t => {
|
|
24
|
-
const { name } = a.ConfigMap;
|
|
25
|
-
const gvk = modelToGroupVersionKind(name);
|
|
26
|
-
t.is(gvk.group, "");
|
|
27
|
-
t.is(gvk.version, "v1");
|
|
28
|
-
t.is(gvk.kind, "ConfigMap");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test("should return the correct GroupVersionKind for 'a.V1ControllerRevision'", t => {
|
|
32
|
-
const { name } = a.ControllerRevision;
|
|
33
|
-
const gvk = modelToGroupVersionKind(name);
|
|
34
|
-
t.is(gvk.group, "apps");
|
|
35
|
-
t.is(gvk.version, "v1");
|
|
36
|
-
t.is(gvk.kind, "ControllerRevision");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("should return the correct GroupVersionKind for 'a.V1CronJob'", t => {
|
|
40
|
-
const { name } = a.CronJob;
|
|
41
|
-
const gvk = modelToGroupVersionKind(name);
|
|
42
|
-
t.is(gvk.group, "batch");
|
|
43
|
-
t.is(gvk.version, "v1");
|
|
44
|
-
t.is(gvk.kind, "CronJob");
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("should return the correct GroupVersionKind for 'a.V1CSIDriver'", t => {
|
|
48
|
-
const { name } = a.CSIDriver;
|
|
49
|
-
const gvk = modelToGroupVersionKind(name);
|
|
50
|
-
t.is(gvk.group, "storage.k8s.io");
|
|
51
|
-
t.is(gvk.version, "v1");
|
|
52
|
-
t.is(gvk.kind, "CSIDriver");
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test("should return the correct GroupVersionKind for 'a.V1CSIStorageCapacity'", t => {
|
|
56
|
-
const { name } = a.CSIStorageCapacity;
|
|
57
|
-
const gvk = modelToGroupVersionKind(name);
|
|
58
|
-
t.is(gvk.group, "storage.k8s.io");
|
|
59
|
-
t.is(gvk.version, "v1");
|
|
60
|
-
t.is(gvk.kind, "CSIStorageCapacity");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("should return the correct GroupVersionKind for 'a.V1CustomResourceDefinition'", t => {
|
|
64
|
-
const { name } = a.CustomResourceDefinition;
|
|
65
|
-
const gvk = modelToGroupVersionKind(name);
|
|
66
|
-
t.is(gvk.group, "apiextensions.k8s.io");
|
|
67
|
-
t.is(gvk.version, "v1");
|
|
68
|
-
t.is(gvk.kind, "CustomResourceDefinition");
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("should return the correct GroupVersionKind for 'a.V1DaemonSet'", t => {
|
|
72
|
-
const { name } = a.DaemonSet;
|
|
73
|
-
const gvk = modelToGroupVersionKind(name);
|
|
74
|
-
t.is(gvk.group, "apps");
|
|
75
|
-
t.is(gvk.version, "v1");
|
|
76
|
-
t.is(gvk.kind, "DaemonSet");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test("should return the correct GroupVersionKind for 'a.V1Deployment'", t => {
|
|
80
|
-
const { name } = a.Deployment;
|
|
81
|
-
const gvk = modelToGroupVersionKind(name);
|
|
82
|
-
t.is(gvk.group, "apps");
|
|
83
|
-
t.is(gvk.version, "v1");
|
|
84
|
-
t.is(gvk.kind, "Deployment");
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("should return the correct GroupVersionKind for 'a.V1EndpointSlice'", t => {
|
|
88
|
-
const { name } = a.EndpointSlice;
|
|
89
|
-
const gvk = modelToGroupVersionKind(name);
|
|
90
|
-
t.is(gvk.group, "discovery.k8s.io");
|
|
91
|
-
t.is(gvk.version, "v1");
|
|
92
|
-
t.is(gvk.kind, "EndpointSlice");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test("should return the correct GroupVersionKind for 'a.V1HorizontalPodAutoscaler'", t => {
|
|
96
|
-
const { name } = a.HorizontalPodAutoscaler;
|
|
97
|
-
const gvk = modelToGroupVersionKind(name);
|
|
98
|
-
t.is(gvk.group, "autoscaling");
|
|
99
|
-
t.is(gvk.version, "v2");
|
|
100
|
-
t.is(gvk.kind, "HorizontalPodAutoscaler");
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test("should return the correct GroupVersionKind for 'a.V1Ingress'", t => {
|
|
104
|
-
const { name } = a.Ingress;
|
|
105
|
-
const gvk = modelToGroupVersionKind(name);
|
|
106
|
-
t.is(gvk.group, "networking.k8s.io");
|
|
107
|
-
t.is(gvk.version, "v1");
|
|
108
|
-
t.is(gvk.kind, "Ingress");
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
test("should return the correct GroupVersionKind for 'a.V1IngressClass'", t => {
|
|
112
|
-
const { name } = a.IngressClass;
|
|
113
|
-
const gvk = modelToGroupVersionKind(name);
|
|
114
|
-
t.is(gvk.group, "networking.k8s.io");
|
|
115
|
-
t.is(gvk.version, "v1");
|
|
116
|
-
t.is(gvk.kind, "IngressClass");
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test("should return the correct GroupVersionKind for 'a.V1Job'", t => {
|
|
120
|
-
const { name } = a.Job;
|
|
121
|
-
const gvk = modelToGroupVersionKind(name);
|
|
122
|
-
t.is(gvk.group, "batch");
|
|
123
|
-
t.is(gvk.version, "v1");
|
|
124
|
-
t.is(gvk.kind, "Job");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test("should return the correct GroupVersionKind for 'a.V1LimitRange'", t => {
|
|
128
|
-
const { name } = a.LimitRange;
|
|
129
|
-
const gvk = modelToGroupVersionKind(name);
|
|
130
|
-
t.is(gvk.group, "");
|
|
131
|
-
t.is(gvk.version, "v1");
|
|
132
|
-
t.is(gvk.kind, "LimitRange");
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test("should return the correct GroupVersionKind for 'a.V1LocalSubjectAccessReview'", t => {
|
|
136
|
-
const { name } = a.LocalSubjectAccessReview;
|
|
137
|
-
const gvk = modelToGroupVersionKind(name);
|
|
138
|
-
t.is(gvk.group, "authorization.k8s.io");
|
|
139
|
-
t.is(gvk.version, "v1");
|
|
140
|
-
t.is(gvk.kind, "LocalSubjectAccessReview");
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test("should return the correct GroupVersionKind for 'a.V1MutatingWebhookConfiguration'", t => {
|
|
144
|
-
const { name } = a.MutatingWebhookConfiguration;
|
|
145
|
-
const gvk = modelToGroupVersionKind(name);
|
|
146
|
-
t.is(gvk.group, "admissionregistration.k8s.io");
|
|
147
|
-
t.is(gvk.version, "v1");
|
|
148
|
-
t.is(gvk.kind, "MutatingWebhookConfiguration");
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test("should return the correct GroupVersionKind for 'a.V1Namespace'", t => {
|
|
152
|
-
const { name } = a.Namespace;
|
|
153
|
-
const gvk = modelToGroupVersionKind(name);
|
|
154
|
-
t.is(gvk.group, "");
|
|
155
|
-
t.is(gvk.version, "v1");
|
|
156
|
-
t.is(gvk.kind, "Namespace");
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test("should return the correct GroupVersionKind for 'a.V1NetworkPolicy'", t => {
|
|
160
|
-
const { name } = a.NetworkPolicy;
|
|
161
|
-
const gvk = modelToGroupVersionKind(name);
|
|
162
|
-
t.is(gvk.group, "networking.k8s.io");
|
|
163
|
-
t.is(gvk.version, "v1");
|
|
164
|
-
t.is(gvk.kind, "NetworkPolicy");
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test("should return the correct GroupVersionKind for 'a.V1Node'", t => {
|
|
168
|
-
const { name } = a.Node;
|
|
169
|
-
const gvk = modelToGroupVersionKind(name);
|
|
170
|
-
t.is(gvk.group, "");
|
|
171
|
-
t.is(gvk.version, "v1");
|
|
172
|
-
t.is(gvk.kind, "Node");
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test("should return the correct GroupVersionKind for 'a.V1PersistentVolume'", t => {
|
|
176
|
-
const { name } = a.PersistentVolume;
|
|
177
|
-
const gvk = modelToGroupVersionKind(name);
|
|
178
|
-
t.is(gvk.group, "");
|
|
179
|
-
t.is(gvk.version, "v1");
|
|
180
|
-
t.is(gvk.kind, "PersistentVolume");
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test("should return the correct GroupVersionKind for 'a.V1PersistentVolumeClaim'", t => {
|
|
184
|
-
const { name } = a.PersistentVolumeClaim;
|
|
185
|
-
const gvk = modelToGroupVersionKind(name);
|
|
186
|
-
t.is(gvk.group, "");
|
|
187
|
-
t.is(gvk.version, "v1");
|
|
188
|
-
t.is(gvk.kind, "PersistentVolumeClaim");
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
test("should return the correct GroupVersionKind for 'a.V1Pod'", t => {
|
|
192
|
-
const { name } = a.Pod;
|
|
193
|
-
const gvk = modelToGroupVersionKind(name);
|
|
194
|
-
t.is(gvk.group, "");
|
|
195
|
-
t.is(gvk.version, "v1");
|
|
196
|
-
t.is(gvk.kind, "Pod");
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
test("should return the correct GroupVersionKind for 'a.V1PodDisruptionBudget'", t => {
|
|
200
|
-
const { name } = a.PodDisruptionBudget;
|
|
201
|
-
const gvk = modelToGroupVersionKind(name);
|
|
202
|
-
t.is(gvk.group, "policy");
|
|
203
|
-
t.is(gvk.version, "v1");
|
|
204
|
-
t.is(gvk.kind, "PodDisruptionBudget");
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
test("should return the correct GroupVersionKind for 'a.V1PodTemplate'", t => {
|
|
208
|
-
const { name } = a.PodTemplate;
|
|
209
|
-
const gvk = modelToGroupVersionKind(name);
|
|
210
|
-
t.is(gvk.group, "");
|
|
211
|
-
t.is(gvk.version, "v1");
|
|
212
|
-
t.is(gvk.kind, "PodTemplate");
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test("should return the correct GroupVersionKind for 'a.V1ReplicaSet'", t => {
|
|
216
|
-
const { name } = a.ReplicaSet;
|
|
217
|
-
const gvk = modelToGroupVersionKind(name);
|
|
218
|
-
t.is(gvk.group, "apps");
|
|
219
|
-
t.is(gvk.version, "v1");
|
|
220
|
-
t.is(gvk.kind, "ReplicaSet");
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
test("should return the correct GroupVersionKind for 'a.V1ReplicationController'", t => {
|
|
224
|
-
const { name } = a.ReplicationController;
|
|
225
|
-
const gvk = modelToGroupVersionKind(name);
|
|
226
|
-
t.is(gvk.group, "");
|
|
227
|
-
t.is(gvk.version, "v1");
|
|
228
|
-
t.is(gvk.kind, "ReplicationController");
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
test("should return the correct GroupVersionKind for 'a.V1ResourceQuota'", t => {
|
|
232
|
-
const { name } = a.ResourceQuota;
|
|
233
|
-
const gvk = modelToGroupVersionKind(name);
|
|
234
|
-
t.is(gvk.group, "");
|
|
235
|
-
t.is(gvk.version, "v1");
|
|
236
|
-
t.is(gvk.kind, "ResourceQuota");
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
test("should return the correct GroupVersionKind for 'a.V1RuntimeClass'", t => {
|
|
240
|
-
const { name } = a.RuntimeClass;
|
|
241
|
-
const gvk = modelToGroupVersionKind(name);
|
|
242
|
-
t.is(gvk.group, "node.k8s.io");
|
|
243
|
-
t.is(gvk.version, "v1");
|
|
244
|
-
t.is(gvk.kind, "RuntimeClass");
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
test("should return the correct GroupVersionKind for 'a.V1Secret'", t => {
|
|
248
|
-
const { name } = a.Secret;
|
|
249
|
-
const gvk = modelToGroupVersionKind(name);
|
|
250
|
-
t.is(gvk.group, "");
|
|
251
|
-
t.is(gvk.version, "v1");
|
|
252
|
-
t.is(gvk.kind, "Secret");
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
test("should return the correct GroupVersionKind for 'a.V1SelfSubjectAccessReview'", t => {
|
|
256
|
-
const { name } = a.SelfSubjectAccessReview;
|
|
257
|
-
const gvk = modelToGroupVersionKind(name);
|
|
258
|
-
t.is(gvk.group, "authorization.k8s.io");
|
|
259
|
-
t.is(gvk.version, "v1");
|
|
260
|
-
t.is(gvk.kind, "SelfSubjectAccessReview");
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
test("should return the correct GroupVersionKind for 'a.V1SelfSubjectRulesReview'", t => {
|
|
264
|
-
const { name } = a.SelfSubjectRulesReview;
|
|
265
|
-
const gvk = modelToGroupVersionKind(name);
|
|
266
|
-
t.is(gvk.group, "authorization.k8s.io");
|
|
267
|
-
t.is(gvk.version, "v1");
|
|
268
|
-
t.is(gvk.kind, "SelfSubjectRulesReview");
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
test("should return the correct GroupVersionKind for 'a.V1Service'", t => {
|
|
272
|
-
const { name } = a.Service;
|
|
273
|
-
const gvk = modelToGroupVersionKind(name);
|
|
274
|
-
t.is(gvk.group, "");
|
|
275
|
-
t.is(gvk.version, "v1");
|
|
276
|
-
t.is(gvk.kind, "Service");
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
test("should return the correct GroupVersionKind for 'a.V1ServiceAccount'", t => {
|
|
280
|
-
const { name } = a.ServiceAccount;
|
|
281
|
-
const gvk = modelToGroupVersionKind(name);
|
|
282
|
-
t.is(gvk.group, "");
|
|
283
|
-
t.is(gvk.version, "v1");
|
|
284
|
-
t.is(gvk.kind, "ServiceAccount");
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
test("should return the correct GroupVersionKind for 'a.V1StatefulSet'", t => {
|
|
288
|
-
const { name } = a.StatefulSet;
|
|
289
|
-
const gvk = modelToGroupVersionKind(name);
|
|
290
|
-
t.is(gvk.group, "apps");
|
|
291
|
-
t.is(gvk.version, "v1");
|
|
292
|
-
t.is(gvk.kind, "StatefulSet");
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
test("should return the correct GroupVersionKind for 'a.V1StorageClass'", t => {
|
|
296
|
-
const { name } = a.StorageClass;
|
|
297
|
-
const gvk = modelToGroupVersionKind(name);
|
|
298
|
-
t.is(gvk.group, "storage.k8s.io");
|
|
299
|
-
t.is(gvk.version, "v1");
|
|
300
|
-
t.is(gvk.kind, "StorageClass");
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
test("should return the correct GroupVersionKind for 'a.V1SubjectAccessReview'", t => {
|
|
304
|
-
const { name } = a.SubjectAccessReview;
|
|
305
|
-
const gvk = modelToGroupVersionKind(name);
|
|
306
|
-
t.is(gvk.group, "authorization.k8s.io");
|
|
307
|
-
t.is(gvk.version, "v1");
|
|
308
|
-
t.is(gvk.kind, "SubjectAccessReview");
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
test("should return the correct GroupVersionKind for 'a.V1TokenReview'", t => {
|
|
312
|
-
const { name } = a.TokenReview;
|
|
313
|
-
const gvk = modelToGroupVersionKind(name);
|
|
314
|
-
t.is(gvk.group, "authentication.k8s.io");
|
|
315
|
-
t.is(gvk.version, "v1");
|
|
316
|
-
t.is(gvk.kind, "TokenReview");
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
test("should return the correct GroupVersionKind for 'a.V1ValidatingWebhookConfiguration'", t => {
|
|
320
|
-
const { name } = a.ValidatingWebhookConfiguration;
|
|
321
|
-
const gvk = modelToGroupVersionKind(name);
|
|
322
|
-
t.is(gvk.group, "admissionregistration.k8s.io");
|
|
323
|
-
t.is(gvk.version, "v1");
|
|
324
|
-
t.is(gvk.kind, "ValidatingWebhookConfiguration");
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
test("should return the correct GroupVersionKind for 'a.V1VolumeAttachment'", t => {
|
|
328
|
-
const { name } = a.VolumeAttachment;
|
|
329
|
-
const gvk = modelToGroupVersionKind(name);
|
|
330
|
-
t.is(gvk.group, "storage.k8s.io");
|
|
331
|
-
t.is(gvk.version, "v1");
|
|
332
|
-
t.is(gvk.kind, "VolumeAttachment");
|
|
333
|
-
});
|