pepr 0.52.2-nightly.6 → 0.52.2-nightly.8
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 +11 -4
- package/dist/controller.js +5 -5
- package/dist/lib/assets/environment.d.ts +1 -0
- package/dist/lib/assets/environment.d.ts.map +1 -1
- package/dist/lib.js +7 -7
- package/dist/lib.js.map +2 -2
- package/package.json +1 -1
- package/src/lib/assets/deploy.ts +1 -1
- package/src/lib/assets/environment.ts +8 -1
- package/src/lib/assets/loader.ts +1 -1
- package/src/lib/controller/index.ts +3 -3
- package/src/lib/controller/store.ts +1 -1
- package/src/lib/core/capability.ts +3 -3
- package/src/runtime/controller.ts +4 -4
package/package.json
CHANGED
package/src/lib/assets/deploy.ts
CHANGED
|
@@ -100,7 +100,7 @@ export async function deployWebhook(
|
|
|
100
100
|
// Create the validating webhook configuration if it is needed
|
|
101
101
|
await handleWebhookConfiguration(assets, WebhookType.VALIDATE, webhookTimeout, force);
|
|
102
102
|
|
|
103
|
-
Log.
|
|
103
|
+
Log.debug("Applying the Pepr Store CRD if it doesn't exist");
|
|
104
104
|
await K8s(kind.CustomResourceDefinition).Apply(peprStoreCRD, { force });
|
|
105
105
|
|
|
106
106
|
if (assets.host) return; // Skip resource deployment if a host is already specified
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { V1EnvVar } from "@kubernetes/client-node";
|
|
2
2
|
import { ModuleConfig } from "../types";
|
|
3
3
|
|
|
4
|
+
export function getLogLevel(config: ModuleConfig): string {
|
|
5
|
+
const fromEnv = process.env.LOG_LEVEL;
|
|
6
|
+
if (fromEnv) {
|
|
7
|
+
return fromEnv;
|
|
8
|
+
}
|
|
9
|
+
return config.logLevel || "info";
|
|
10
|
+
}
|
|
4
11
|
export function genEnv(
|
|
5
12
|
config: ModuleConfig,
|
|
6
13
|
watchMode = false,
|
|
@@ -8,7 +15,7 @@ export function genEnv(
|
|
|
8
15
|
): V1EnvVar[] {
|
|
9
16
|
const noWatchDef = {
|
|
10
17
|
PEPR_PRETTY_LOG: "false",
|
|
11
|
-
LOG_LEVEL: config
|
|
18
|
+
LOG_LEVEL: getLogLevel(config),
|
|
12
19
|
};
|
|
13
20
|
|
|
14
21
|
const def = {
|
package/src/lib/assets/loader.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function loadCapabilities(path: string): Promise<CapabilityExport[]> {
|
|
|
29
29
|
|
|
30
30
|
// Iterate through the capabilities and generate the rules
|
|
31
31
|
for (const capability of capabilities) {
|
|
32
|
-
console.
|
|
32
|
+
console.debug(`Registered Pepr Capability "${capability.name}"`);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
resolve(capabilities);
|
|
@@ -57,10 +57,10 @@ export class Controller {
|
|
|
57
57
|
if (typeof onReady === "function") {
|
|
58
58
|
onReady();
|
|
59
59
|
}
|
|
60
|
-
Log.
|
|
60
|
+
Log.debug("Controller startup complete");
|
|
61
61
|
// Initialize the schedule store for each capability
|
|
62
62
|
new StoreController(capabilities, `pepr-${config.uuid}-schedule`, () => {
|
|
63
|
-
Log.
|
|
63
|
+
Log.debug("Scheduling processed");
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -112,7 +112,7 @@ export class Controller {
|
|
|
112
112
|
|
|
113
113
|
// Handle server listening event
|
|
114
114
|
server.on("listening", () => {
|
|
115
|
-
Log.
|
|
115
|
+
Log.debug(`Server listening on port ${port}`);
|
|
116
116
|
// Track that the server is running
|
|
117
117
|
this.#running = true;
|
|
118
118
|
});
|
|
@@ -133,7 +133,7 @@ export class Capability implements CapabilityExport {
|
|
|
133
133
|
this.#namespaces = cfg.namespaces;
|
|
134
134
|
this.hasSchedule = false;
|
|
135
135
|
|
|
136
|
-
Log.
|
|
136
|
+
Log.debug(`Capability ${this.#name} registered`);
|
|
137
137
|
Log.debug(cfg);
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -141,7 +141,7 @@ export class Capability implements CapabilityExport {
|
|
|
141
141
|
* Register the store with the capability. This is called automatically by the Pepr controller.
|
|
142
142
|
*/
|
|
143
143
|
registerScheduleStore = (): Storage => {
|
|
144
|
-
Log.
|
|
144
|
+
Log.debug(`Registering schedule store for ${this.#name}`);
|
|
145
145
|
|
|
146
146
|
if (this.#scheduleRegistered) {
|
|
147
147
|
throw new Error(`Schedule store already registered for ${this.#name}`);
|
|
@@ -159,7 +159,7 @@ export class Capability implements CapabilityExport {
|
|
|
159
159
|
* @param store
|
|
160
160
|
*/
|
|
161
161
|
registerStore = (): Storage => {
|
|
162
|
-
Log.
|
|
162
|
+
Log.debug(`Registering store for ${this.#name}`);
|
|
163
163
|
|
|
164
164
|
if (this.#registered) {
|
|
165
165
|
throw new Error(`Store already registered for ${this.#name}`);
|
|
@@ -23,7 +23,7 @@ function runModule(expectedHash: string): void {
|
|
|
23
23
|
throw new Error(`File not found: ${gzPath}`);
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
|
-
Log.
|
|
26
|
+
Log.debug(`Loading module ${gzPath}`);
|
|
27
27
|
|
|
28
28
|
// Extract the code from the file
|
|
29
29
|
const codeGZ = fs.readFileSync(gzPath);
|
|
@@ -38,7 +38,7 @@ function runModule(expectedHash: string): void {
|
|
|
38
38
|
if (!crypto.timingSafeEqual(Buffer.from(expectedHash, "hex"), Buffer.from(actualHash, "hex"))) {
|
|
39
39
|
throw new Error(`File hash does not match, expected ${expectedHash} but got ${actualHash}`);
|
|
40
40
|
}
|
|
41
|
-
Log.
|
|
41
|
+
Log.debug(`File hash matches, running module`);
|
|
42
42
|
|
|
43
43
|
// Write the code to a file
|
|
44
44
|
fs.writeFileSync(jsPath, code);
|
|
@@ -52,8 +52,8 @@ function runModule(expectedHash: string): void {
|
|
|
52
52
|
|
|
53
53
|
export const startup = async (hash: string): Promise<void> => {
|
|
54
54
|
try {
|
|
55
|
-
Log.
|
|
56
|
-
Log.
|
|
55
|
+
Log.debug(`Pepr Controller (v${version})`);
|
|
56
|
+
Log.debug("Applying the Pepr Store CRD if it doesn't exist");
|
|
57
57
|
await K8s(kind.CustomResourceDefinition).Apply(peprStoreCRD, { force: true });
|
|
58
58
|
|
|
59
59
|
validateHash(hash);
|