pepr 0.52.2-nightly.7 → 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/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "!src/fixtures/**",
17
17
  "!dist/**/*.test.d.ts*"
18
18
  ],
19
- "version": "0.52.2-nightly.7",
19
+ "version": "0.52.2-nightly.8",
20
20
  "main": "dist/lib.js",
21
21
  "types": "dist/lib.d.ts",
22
22
  "scripts": {
@@ -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.info("Applying the Pepr Store CRD if it doesn't exist");
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.logLevel || "info",
18
+ LOG_LEVEL: getLogLevel(config),
12
19
  };
13
20
 
14
21
  const def = {
@@ -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.info(`Registered Pepr Capability "${capability.name}"`);
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.info("Controller startup complete");
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.info("Scheduling processed");
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.info(`Server listening on port ${port}`);
115
+ Log.debug(`Server listening on port ${port}`);
116
116
  // Track that the server is running
117
117
  this.#running = true;
118
118
  });
@@ -138,7 +138,7 @@ export class StoreController {
138
138
  };
139
139
 
140
140
  #createStoreResource = async (e: unknown): Promise<void> => {
141
- Log.info(`Pepr store not found, creating...`);
141
+ Log.debug(`Pepr store not found, creating...`);
142
142
  Log.debug(e);
143
143
 
144
144
  try {
@@ -133,7 +133,7 @@ export class Capability implements CapabilityExport {
133
133
  this.#namespaces = cfg.namespaces;
134
134
  this.hasSchedule = false;
135
135
 
136
- Log.info(`Capability ${this.#name} registered`);
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.info(`Registering schedule store for ${this.#name}`);
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.info(`Registering store for ${this.#name}`);
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.info(`Loading module ${gzPath}`);
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.info(`File hash matches, running module`);
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.info(`Pepr Controller (v${version})`);
56
- Log.info("Applying the Pepr Store CRD if it doesn't exist");
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);