pepr 0.37.1 → 0.38.0-rc
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/cli.js +5 -4
- package/dist/controller.js +3 -2
- package/dist/lib/adjudicators.d.ts.map +1 -1
- package/dist/lib/filter.d.ts +1 -1
- package/dist/lib/filter.d.ts.map +1 -1
- package/dist/lib/mutate-processor.d.ts.map +1 -1
- package/dist/lib/validate-processor.d.ts.map +1 -1
- package/dist/lib/watch-processor.d.ts.map +1 -1
- package/dist/lib.js +16 -9
- package/dist/lib.js.map +2 -2
- package/package.json +2 -2
- package/src/cli/build.ts +1 -1
- package/src/cli/init/index.ts +1 -1
- package/src/fixtures/data/create-pod.json +2 -1
- package/src/fixtures/data/delete-pod.json +2 -1
- package/src/lib/adjudicators.test.ts +4 -0
- package/src/lib/adjudicators.ts +2 -0
- package/src/lib/filter.test.ts +82 -45
- package/src/lib/filter.ts +103 -18
- package/src/lib/mutate-processor.ts +6 -4
- package/src/lib/utils.ts +1 -1
- package/src/lib/validate-processor.ts +4 -2
- package/src/lib/watch-processor.ts +1 -0
|
@@ -34,7 +34,7 @@ export async function mutateProcessor(
|
|
|
34
34
|
let skipDecode: string[] = [];
|
|
35
35
|
|
|
36
36
|
// If the resource is a secret, decode the data
|
|
37
|
-
const isSecret = req.kind.version
|
|
37
|
+
const isSecret = req.kind.version === "v1" && req.kind.kind === "Secret";
|
|
38
38
|
if (isSecret) {
|
|
39
39
|
skipDecode = convertFromBase64Map(wrapped.Raw as unknown as kind.Secret);
|
|
40
40
|
}
|
|
@@ -50,7 +50,9 @@ export async function mutateProcessor(
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Continue to the next action without doing anything if this one should be skipped
|
|
53
|
-
|
|
53
|
+
const shouldSkip = shouldSkipRequest(action, req, namespaces, config?.alwaysIgnore?.namespaces);
|
|
54
|
+
if (shouldSkip !== "") {
|
|
55
|
+
Log.debug(shouldSkip);
|
|
54
56
|
continue;
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -62,7 +64,7 @@ export async function mutateProcessor(
|
|
|
62
64
|
// this will allow tracking of failed mutations that were permitted to continue
|
|
63
65
|
const updateStatus = (status: string) => {
|
|
64
66
|
// Only update the status if the request is a CREATE or UPDATE (we don't use CONNECT)
|
|
65
|
-
if (req.operation
|
|
67
|
+
if (req.operation === "DELETE") {
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -128,7 +130,7 @@ export async function mutateProcessor(
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
// delete operations can't be mutate, just return before the transformation
|
|
131
|
-
if (req.operation
|
|
133
|
+
if (req.operation === "DELETE") {
|
|
132
134
|
return response;
|
|
133
135
|
}
|
|
134
136
|
|
package/src/lib/utils.ts
CHANGED
|
@@ -30,7 +30,7 @@ export function convertFromBase64Map(obj: { data?: Record<string, string> }) {
|
|
|
30
30
|
|
|
31
31
|
obj.data = obj.data ?? {};
|
|
32
32
|
for (const key in obj.data) {
|
|
33
|
-
if (obj.data[key]
|
|
33
|
+
if (obj.data[key] === undefined) {
|
|
34
34
|
obj.data[key] = "";
|
|
35
35
|
} else {
|
|
36
36
|
const decoded = base64Decode(obj.data[key]);
|
|
@@ -22,7 +22,7 @@ export async function validateProcessor(
|
|
|
22
22
|
const response: ValidateResponse[] = [];
|
|
23
23
|
|
|
24
24
|
// If the resource is a secret, decode the data
|
|
25
|
-
const isSecret = req.kind.version
|
|
25
|
+
const isSecret = req.kind.version === "v1" && req.kind.kind === "Secret";
|
|
26
26
|
if (isSecret) {
|
|
27
27
|
convertFromBase64Map(wrapped.Raw as unknown as kind.Secret);
|
|
28
28
|
}
|
|
@@ -44,7 +44,9 @@ export async function validateProcessor(
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// Continue to the next action without doing anything if this one should be skipped
|
|
47
|
-
|
|
47
|
+
const shouldSkip = shouldSkipRequest(action, req, namespaces, config?.alwaysIgnore?.namespaces);
|
|
48
|
+
if (shouldSkip !== "") {
|
|
49
|
+
Log.debug(shouldSkip);
|
|
48
50
|
continue;
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -49,6 +49,7 @@ export function getOrCreateQueue(obj: KubernetesObject) {
|
|
|
49
49
|
|
|
50
50
|
// Watch configuration
|
|
51
51
|
const watchCfg: WatchCfg = {
|
|
52
|
+
useHTTP2: process.env.PEPR_HTTP2_WATCH === "true",
|
|
52
53
|
resyncFailureMax: process.env.PEPR_RESYNC_FAILURE_MAX ? parseInt(process.env.PEPR_RESYNC_FAILURE_MAX, 10) : 5,
|
|
53
54
|
resyncDelaySec: process.env.PEPR_RESYNC_DELAY_SECONDS ? parseInt(process.env.PEPR_RESYNC_DELAY_SECONDS, 10) : 5,
|
|
54
55
|
lastSeenLimitSeconds: process.env.PEPR_LAST_SEEN_LIMIT_SECONDS
|