pepr 0.28.2 → 0.28.4
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 +73 -99
- package/dist/controller.js +1 -1
- package/dist/lib/filter.d.ts.map +1 -1
- package/dist/lib/helpers.d.ts.map +1 -1
- package/dist/lib.js +6 -5
- package/dist/lib.js.map +2 -2
- package/package.json +2 -2
- package/src/lib/assets/pods.ts +7 -11
- package/src/lib/filter.ts +6 -5
- package/src/lib/helpers.ts +5 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.28.
|
|
12
|
+
"version": "0.28.4",
|
|
13
13
|
"main": "dist/lib.js",
|
|
14
14
|
"types": "dist/lib.d.ts",
|
|
15
15
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ramda": "0.29.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@commitlint/cli": "19.
|
|
44
|
+
"@commitlint/cli": "19.2.0",
|
|
45
45
|
"@commitlint/config-conventional": "19.1.0",
|
|
46
46
|
"@jest/globals": "29.7.0",
|
|
47
47
|
"@types/eslint": "8.56.5",
|
package/src/lib/assets/pods.ts
CHANGED
|
@@ -341,17 +341,13 @@ export function moduleSecret(name: string, data: Buffer, hash: string): kind.Sec
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
function genEnv(config: ModuleConfig, watchMode = false): V1EnvVar[] {
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
for (const [name, value] of Object.entries(config.env)) {
|
|
352
|
-
env.push({ name, value });
|
|
353
|
-
}
|
|
354
|
-
}
|
|
344
|
+
const def = {
|
|
345
|
+
PEPR_WATCH_MODE: watchMode ? "true" : "false",
|
|
346
|
+
PEPR_PRETTY_LOG: "false",
|
|
347
|
+
LOG_LEVEL: config.logLevel || "debug",
|
|
348
|
+
};
|
|
349
|
+
const cfg = config.env || {};
|
|
350
|
+
const env = Object.entries({ ...def, ...cfg }).map(([name, value]) => ({ name, value }));
|
|
355
351
|
|
|
356
352
|
return env;
|
|
357
353
|
}
|
package/src/lib/filter.ts
CHANGED
|
@@ -16,6 +16,7 @@ export function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capab
|
|
|
16
16
|
const { group, kind, version } = binding.kind || {};
|
|
17
17
|
const { namespaces, labels, annotations, name } = binding.filters || {};
|
|
18
18
|
const operation = req.operation.toUpperCase();
|
|
19
|
+
const uid = req.uid;
|
|
19
20
|
// Use the old object if the request is a DELETE operation
|
|
20
21
|
const srcObject = operation === Operation.DELETE ? req.oldObject : req.object;
|
|
21
22
|
const { metadata } = srcObject || {};
|
|
@@ -65,7 +66,7 @@ export function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capab
|
|
|
65
66
|
label = binding.watchCallback!.name;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
logger.debug(`${type} binding (${label}) does not match request namespace "${req.namespace}"`);
|
|
69
|
+
logger.debug({ uid }, `${type} binding (${label}) does not match request namespace "${req.namespace}"`);
|
|
69
70
|
|
|
70
71
|
return true;
|
|
71
72
|
}
|
|
@@ -76,13 +77,13 @@ export function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capab
|
|
|
76
77
|
|
|
77
78
|
// First check if the label exists
|
|
78
79
|
if (!testKey) {
|
|
79
|
-
logger.debug(`Label ${key} does not exist`);
|
|
80
|
+
logger.debug({ uid }, `Label ${key} does not exist`);
|
|
80
81
|
return true;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// Then check if the value matches, if specified
|
|
84
85
|
if (value && testKey !== value) {
|
|
85
|
-
logger.debug(`${testKey} does not match ${value}`);
|
|
86
|
+
logger.debug({ uid }, `${testKey} does not match ${value}`);
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -93,13 +94,13 @@ export function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capab
|
|
|
93
94
|
|
|
94
95
|
// First check if the annotation exists
|
|
95
96
|
if (!testKey) {
|
|
96
|
-
logger.debug(`Annotation ${key} does not exist`);
|
|
97
|
+
logger.debug({ uid }, `Annotation ${key} does not exist`);
|
|
97
98
|
return true;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
// Then check if the value matches, if specified
|
|
101
102
|
if (value && testKey !== value) {
|
|
102
|
-
logger.debug(`${testKey} does not match ${value}`);
|
|
103
|
+
logger.debug({ uid }, `${testKey} does not match ${value}`);
|
|
103
104
|
return true;
|
|
104
105
|
}
|
|
105
106
|
}
|
package/src/lib/helpers.ts
CHANGED
|
@@ -133,6 +133,11 @@ export const createRBACMap = (capabilities: CapabilityExport[]): RBACMap => {
|
|
|
133
133
|
plural: "peprstores",
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
acc["apiextensions.k8s.io/v1/customresourcedefinition"] = {
|
|
137
|
+
verbs: ["patch", "create"],
|
|
138
|
+
plural: "customresourcedefinitions",
|
|
139
|
+
};
|
|
140
|
+
|
|
136
141
|
if (!acc[key] && binding.isWatch) {
|
|
137
142
|
acc[key] = {
|
|
138
143
|
verbs: ["watch"],
|