pepr 0.31.0 → 0.32.0

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.
Files changed (56) hide show
  1. package/dist/cli.js +100 -22
  2. package/dist/controller.js +3 -3
  3. package/dist/lib/assets/helm.d.ts.map +1 -1
  4. package/dist/lib/assets/index.d.ts.map +1 -1
  5. package/dist/lib/assets/yaml.d.ts.map +1 -1
  6. package/dist/lib/controller/store.d.ts.map +1 -1
  7. package/dist/lib/mutate-processor.d.ts.map +1 -1
  8. package/dist/lib/watch-processor.d.ts.map +1 -1
  9. package/dist/lib.js +26 -20
  10. package/dist/lib.js.map +3 -3
  11. package/package.json +6 -6
  12. package/src/lib/assets/helm.ts +18 -0
  13. package/src/lib/assets/index.ts +3 -1
  14. package/src/lib/assets/yaml.ts +35 -0
  15. package/src/lib/controller/index.ts +3 -3
  16. package/src/lib/controller/store.ts +7 -3
  17. package/src/lib/mutate-processor.ts +17 -6
  18. package/src/lib/watch-processor.ts +2 -10
  19. package/src/runtime/controller.ts +2 -2
  20. package/dist/cli.d.ts +0 -3
  21. package/dist/lib/assets/deploy.d.ts +0 -3
  22. package/dist/lib/assets/destroy.d.ts +0 -2
  23. package/dist/lib/assets/helm.d.ts +0 -5
  24. package/dist/lib/assets/index.d.ts +0 -24
  25. package/dist/lib/assets/loader.d.ts +0 -8
  26. package/dist/lib/assets/networking.d.ts +0 -7
  27. package/dist/lib/assets/pods.d.ts +0 -126
  28. package/dist/lib/assets/rbac.d.ts +0 -14
  29. package/dist/lib/assets/store.d.ts +0 -7
  30. package/dist/lib/assets/webhooks.d.ts +0 -6
  31. package/dist/lib/assets/yaml.d.ts +0 -5
  32. package/dist/lib/capability.d.ts +0 -66
  33. package/dist/lib/controller/index.d.ts +0 -10
  34. package/dist/lib/controller/store.d.ts +0 -7
  35. package/dist/lib/errors.d.ts +0 -12
  36. package/dist/lib/filter.d.ts +0 -11
  37. package/dist/lib/helpers.d.ts +0 -34
  38. package/dist/lib/included-files.d.ts +0 -2
  39. package/dist/lib/k8s.d.ts +0 -132
  40. package/dist/lib/logger.d.ts +0 -3
  41. package/dist/lib/metrics.d.ts +0 -39
  42. package/dist/lib/module.d.ts +0 -62
  43. package/dist/lib/mutate-processor.d.ts +0 -5
  44. package/dist/lib/mutate-request.d.ts +0 -79
  45. package/dist/lib/queue.d.ts +0 -19
  46. package/dist/lib/schedule.d.ts +0 -76
  47. package/dist/lib/storage.d.ts +0 -83
  48. package/dist/lib/tls.d.ts +0 -18
  49. package/dist/lib/types.d.ts +0 -192
  50. package/dist/lib/utils.d.ts +0 -23
  51. package/dist/lib/validate-processor.d.ts +0 -4
  52. package/dist/lib/validate-request.d.ts +0 -55
  53. package/dist/lib/watch-processor.d.ts +0 -10
  54. package/dist/lib.d.ts +0 -11
  55. package/dist/runtime/controller.d.ts +0 -3
  56. package/dist/sdk/sdk.d.ts +0 -38
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "engines": {
10
10
  "node": ">=18.0.0"
11
11
  },
12
- "version": "0.31.0",
12
+ "version": "0.32.0",
13
13
  "main": "dist/lib.js",
14
14
  "types": "dist/lib.d.ts",
15
15
  "scripts": {
@@ -35,11 +35,11 @@
35
35
  "@types/ramda": "0.30.0",
36
36
  "express": "4.19.2",
37
37
  "fast-json-patch": "3.1.1",
38
- "kubernetes-fluent-client": "2.5.1",
39
- "pino": "9.1.0",
40
- "pino-pretty": "11.0.0",
38
+ "kubernetes-fluent-client": "2.6.1",
39
+ "pino": "9.2.0",
40
+ "pino-pretty": "11.2.0",
41
41
  "prom-client": "15.1.2",
42
- "ramda": "0.30.0"
42
+ "ramda": "0.30.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@commitlint/cli": "19.3.0",
@@ -53,7 +53,7 @@
53
53
  "@types/uuid": "9.0.8",
54
54
  "jest": "29.7.0",
55
55
  "nock": "13.5.4",
56
- "ts-jest": "29.1.2"
56
+ "ts-jest": "29.1.4"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@typescript-eslint/eslint-plugin": "6.15.0",
@@ -70,6 +70,9 @@ export function watcherDeployTemplate(buildTimestamp: string) {
70
70
  metadata:
71
71
  annotations:
72
72
  buildTimestamp: "${buildTimestamp}"
73
+ {{- if .Values.watcher.podAnnotations }}
74
+ {{- toYaml .Values.watcher.podAnnotations | nindent 8 }}
75
+ {{- end }}
73
76
  labels:
74
77
  app: {{ .Values.uuid }}-watcher
75
78
  pepr.dev/controller: watcher
@@ -111,6 +114,9 @@ export function watcherDeployTemplate(buildTimestamp: string) {
111
114
  - name: module
112
115
  mountPath: /app/load
113
116
  readOnly: true
117
+ {{- if .Values.watcher.extraVolumeMounts }}
118
+ {{- toYaml .Values.watcher.extraVolumeMounts | nindent 12 }}
119
+ {{- end }}
114
120
  volumes:
115
121
  - name: tls-certs
116
122
  secret:
@@ -118,6 +124,9 @@ export function watcherDeployTemplate(buildTimestamp: string) {
118
124
  - name: module
119
125
  secret:
120
126
  secretName: {{ .Values.uuid }}-module
127
+ {{- if .Values.watcher.extraVolumes }}
128
+ {{- toYaml .Values.watcher.extraVolumes | nindent 8 }}
129
+ {{- end }}
121
130
  `;
122
131
  }
123
132
 
@@ -142,6 +151,9 @@ export function admissionDeployTemplate(buildTimestamp: string) {
142
151
  metadata:
143
152
  annotations:
144
153
  buildTimestamp: "${buildTimestamp}"
154
+ {{- if .Values.admission.podAnnotations }}
155
+ {{- toYaml .Values.admission.podAnnotations | nindent 8 }}
156
+ {{- end }}
145
157
  labels:
146
158
  app: {{ .Values.uuid }}
147
159
  pepr.dev/controller: admission
@@ -187,6 +199,9 @@ export function admissionDeployTemplate(buildTimestamp: string) {
187
199
  - name: module
188
200
  mountPath: /app/load
189
201
  readOnly: true
202
+ {{- if .Values.admission.extraVolumeMounts }}
203
+ {{- toYaml .Values.admission.extraVolumeMounts | nindent 12 }}
204
+ {{- end }}
190
205
  volumes:
191
206
  - name: tls-certs
192
207
  secret:
@@ -197,5 +212,8 @@ export function admissionDeployTemplate(buildTimestamp: string) {
197
212
  - name: module
198
213
  secret:
199
214
  secretName: {{ .Values.uuid }}-module
215
+ {{- if .Values.admission.extraVolumes }}
216
+ {{- toYaml .Values.admission.extraVolumes | nindent 8 }}
217
+ {{- end }}
200
218
  `;
201
219
  }
@@ -9,7 +9,7 @@ import { CapabilityExport } from "../types";
9
9
  import { WebhookIgnore } from "../k8s";
10
10
  import { deploy } from "./deploy";
11
11
  import { loadCapabilities } from "./loader";
12
- import { allYaml, zarfYaml, overridesFile } from "./yaml";
12
+ import { allYaml, zarfYaml, overridesFile, zarfYamlChart } from "./yaml";
13
13
  import { namespaceComplianceValidator, replaceString } from "../helpers";
14
14
  import { createDirectoryIfNotExists, dedent } from "../helpers";
15
15
  import { resolve } from "path";
@@ -59,6 +59,8 @@ export class Assets {
59
59
 
60
60
  zarfYaml = (path: string) => zarfYaml(this, path);
61
61
 
62
+ zarfYamlChart = (path: string) => zarfYamlChart(this, path);
63
+
62
64
  allYaml = async (rbacMode: string) => {
63
65
  this.capabilities = await loadCapabilities(this.path);
64
66
  // give error if namespaces are not respected
@@ -68,8 +68,11 @@ export async function overridesFile({ hash, name, image, config, apiToken }: Ass
68
68
  drop: ["ALL"],
69
69
  },
70
70
  },
71
+ podAnnotations: {},
71
72
  nodeSelector: {},
72
73
  tolerations: [],
74
+ extraVolumeMounts: [],
75
+ extraVolumes: [],
73
76
  affinity: {},
74
77
  },
75
78
  watcher: {
@@ -115,7 +118,10 @@ export async function overridesFile({ hash, name, image, config, apiToken }: Ass
115
118
  },
116
119
  nodeSelector: {},
117
120
  tolerations: [],
121
+ extraVolumeMounts: [],
122
+ extraVolumes: [],
118
123
  affinity: {},
124
+ podAnnotations: {},
119
125
  },
120
126
  };
121
127
  if (process.env.PEPR_MODE === "dev") {
@@ -155,6 +161,35 @@ export function zarfYaml({ name, image, config }: Assets, path: string) {
155
161
  return dumpYaml(zarfCfg, { noRefs: true });
156
162
  }
157
163
 
164
+ export function zarfYamlChart({ name, image, config }: Assets, path: string) {
165
+ const zarfCfg = {
166
+ kind: "ZarfPackageConfig",
167
+ metadata: {
168
+ name,
169
+ description: `Pepr Module: ${config.description}`,
170
+ url: "https://github.com/defenseunicorns/pepr",
171
+ version: `${config.appVersion || "0.0.1"}`,
172
+ },
173
+ components: [
174
+ {
175
+ name: "module",
176
+ required: true,
177
+ charts: [
178
+ {
179
+ name: "module",
180
+ namespace: "pepr-system",
181
+ version: `${config.appVersion || "0.0.1"}`,
182
+ localPath: path,
183
+ },
184
+ ],
185
+ images: [image],
186
+ },
187
+ ],
188
+ };
189
+
190
+ return dumpYaml(zarfCfg, { noRefs: true });
191
+ }
192
+
158
193
  export async function allYaml(assets: Assets, rbacMode: string) {
159
194
  const { name, tls, apiToken, path } = assets;
160
195
 
@@ -182,7 +182,7 @@ export class Controller {
182
182
  try {
183
183
  res.send(await this.#metricsCollector.getMetrics());
184
184
  } catch (err) {
185
- Log.error(err);
185
+ Log.error(err, `Error getting metrics`);
186
186
  res.status(500).send("Internal Server Error");
187
187
  }
188
188
  };
@@ -277,7 +277,7 @@ export class Controller {
277
277
 
278
278
  this.#metricsCollector.observeEnd(startTime, admissionKind);
279
279
  } catch (err) {
280
- Log.error(err);
280
+ Log.error(err, `Error processing ${admissionKind} request`);
281
281
  res.status(500).send("Internal Server Error");
282
282
  this.#metricsCollector.error();
283
283
  }
@@ -319,7 +319,7 @@ export class Controller {
319
319
  try {
320
320
  res.send("OK");
321
321
  } catch (err) {
322
- Log.error(err);
322
+ Log.error(err, `Error processing health check`);
323
323
  res.status(500).send("Internal Server Error");
324
324
  }
325
325
  }
@@ -167,9 +167,13 @@ export class PeprControllerStore {
167
167
  } catch (err) {
168
168
  Log.error(err, "Pepr store update failure");
169
169
 
170
- // On failure to update, re-add the operations to the cache to be retried
171
- for (const idx of indexes) {
172
- sendCache[idx] = payload[Number(idx)];
170
+ if (err.status === 422) {
171
+ Object.keys(sendCache).forEach(key => delete sendCache[key]);
172
+ } else {
173
+ // On failure to update, re-add the operations to the cache to be retried
174
+ for (const idx of indexes) {
175
+ sendCache[idx] = payload[Number(idx)];
176
+ }
173
177
  }
174
178
  }
175
179
  };
@@ -84,22 +84,33 @@ export async function mutateProcessor(
84
84
  // Add annotations to the request to indicate that the capability succeeded
85
85
  updateStatus("succeeded");
86
86
  } catch (e) {
87
- Log.warn(actionMetadata, `Action failed: ${e}`);
88
87
  updateStatus("warning");
89
-
90
- // Annoying ts false positive
91
88
  response.warnings = response.warnings || [];
92
- response.warnings.push(`Action failed: ${e}`);
89
+
90
+ let errorMessage = "";
91
+
92
+ try {
93
+ if (e.message && e.message !== "[object Object]") {
94
+ errorMessage = e.message;
95
+ } else {
96
+ throw new Error("An error occurred in the mutate action.");
97
+ }
98
+ } catch (e) {
99
+ errorMessage = "An error occurred with the mutate action.";
100
+ }
101
+
102
+ Log.error(actionMetadata, `Action failed: ${errorMessage}`);
103
+ response.warnings.push(`Action failed: ${errorMessage}`);
93
104
 
94
105
  switch (config.onError) {
95
106
  case Errors.reject:
96
- Log.error(actionMetadata, `Action failed: ${e}`);
107
+ Log.error(actionMetadata, `Action failed: ${errorMessage}`);
97
108
  response.result = "Pepr module configured to reject on error";
98
109
  return response;
99
110
 
100
111
  case Errors.audit:
101
112
  response.auditAnnotations = response.auditAnnotations || {};
102
- response.auditAnnotations[Date.now()] = e;
113
+ response.auditAnnotations[Date.now()] = `Action failed: ${errorMessage}`;
103
114
  break;
104
115
  }
105
116
  }
@@ -15,7 +15,6 @@ const watchCfg: WatchCfg = {
15
15
  resyncIntervalSec: process.env.PEPR_RESYNCINTERVALSECONDS
16
16
  ? parseInt(process.env.PEPR_RESYNCINTERVALSECONDS, 10)
17
17
  : 300,
18
- allowWatchBookmarks: process.env.PEPR_ALLOWWATCHBOOKMARKS === "false" ? false : true,
19
18
  };
20
19
 
21
20
  // Map the event to the watch phase
@@ -95,14 +94,7 @@ async function runBinding(binding: Binding, capabilityNamespaces: string[]) {
95
94
 
96
95
  watcher.events.on(WatchEvent.CONNECT, url => logEvent(WatchEvent.CONNECT, url));
97
96
 
98
- watcher.events.on(WatchEvent.BOOKMARK, obj =>
99
- logEvent(WatchEvent.BOOKMARK, "Changes up to the given resourceVersion have been sent", obj),
100
- );
101
-
102
97
  watcher.events.on(WatchEvent.DATA_ERROR, err => logEvent(WatchEvent.DATA_ERROR, err.message));
103
- watcher.events.on(WatchEvent.RESOURCE_VERSION, resourceVersion =>
104
- logEvent(WatchEvent.RESOURCE_VERSION, `${resourceVersion}`),
105
- );
106
98
  watcher.events.on(WatchEvent.RECONNECT, (err, retryCount) =>
107
99
  logEvent(WatchEvent.RECONNECT, err ? `Reconnecting after ${retryCount} attempts` : ""),
108
100
  );
@@ -110,9 +102,9 @@ async function runBinding(binding: Binding, capabilityNamespaces: string[]) {
110
102
  watcher.events.on(WatchEvent.GIVE_UP, err => logEvent(WatchEvent.GIVE_UP, err.message));
111
103
  watcher.events.on(WatchEvent.ABORT, err => logEvent(WatchEvent.ABORT, err.message));
112
104
  watcher.events.on(WatchEvent.OLD_RESOURCE_VERSION, err => logEvent(WatchEvent.OLD_RESOURCE_VERSION, err));
113
- watcher.events.on(WatchEvent.RESYNC, err => logEvent(WatchEvent.RESYNC, err.message));
114
105
  watcher.events.on(WatchEvent.NETWORK_ERROR, err => logEvent(WatchEvent.NETWORK_ERROR, err.message));
115
-
106
+ watcher.events.on(WatchEvent.LIST_ERROR, err => logEvent(WatchEvent.LIST_ERROR, err.message));
107
+ watcher.events.on(WatchEvent.LIST, list => logEvent(WatchEvent.LIST, JSON.stringify(list, undefined, 2)));
116
108
  // Start the watch
117
109
  try {
118
110
  await watcher.start();
@@ -67,9 +67,9 @@ const startup = async () => {
67
67
  validateHash(hash);
68
68
  runModule(hash);
69
69
  } catch (err) {
70
- Log.error(err);
70
+ Log.error(err, `Error starting Pepr Store CRD`);
71
71
  process.exit(1);
72
72
  }
73
73
  };
74
74
 
75
- startup().catch(err => Log.error(err));
75
+ startup().catch(err => Log.error(err, `Error starting Pepr Controller`));
package/dist/cli.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=cli.d.ts.map
@@ -1,3 +0,0 @@
1
- import { Assets } from ".";
2
- export declare function deploy(assets: Assets, force: boolean, webhookTimeout?: number): Promise<void>;
3
- //# sourceMappingURL=deploy.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function destroyModule(name: string): Promise<void>;
2
- //# sourceMappingURL=destroy.d.ts.map
@@ -1,5 +0,0 @@
1
- export declare function nsTemplate(): string;
2
- export declare function chartYaml(name: string, description?: string): string;
3
- export declare function watcherDeployTemplate(buildTimestamp: string): string;
4
- export declare function admissionDeployTemplate(buildTimestamp: string): string;
5
- //# sourceMappingURL=helm.d.ts.map
@@ -1,24 +0,0 @@
1
- import { ModuleConfig } from "../module";
2
- import { TLSOut } from "../tls";
3
- import { CapabilityExport } from "../types";
4
- import { WebhookIgnore } from "../k8s";
5
- export declare class Assets {
6
- readonly config: ModuleConfig;
7
- readonly path: string;
8
- readonly host?: string | undefined;
9
- readonly name: string;
10
- readonly tls: TLSOut;
11
- readonly apiToken: string;
12
- readonly alwaysIgnore: WebhookIgnore;
13
- capabilities: CapabilityExport[];
14
- image: string;
15
- buildTimestamp: string;
16
- hash: string;
17
- constructor(config: ModuleConfig, path: string, host?: string | undefined);
18
- setHash: (hash: string) => void;
19
- deploy: (force: boolean, webhookTimeout?: number) => Promise<void>;
20
- zarfYaml: (path: string) => string;
21
- allYaml: (rbacMode: string) => Promise<string>;
22
- generateHelmChart: (basePath: string) => Promise<void>;
23
- }
24
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +0,0 @@
1
- import { CapabilityExport } from "../types";
2
- /**
3
- * Read the capabilities from the module by running it in build mode
4
- * @param path
5
- * @returns
6
- */
7
- export declare function loadCapabilities(path: string): Promise<CapabilityExport[]>;
8
- //# sourceMappingURL=loader.d.ts.map
@@ -1,7 +0,0 @@
1
- import { kind } from "kubernetes-fluent-client";
2
- import { TLSOut } from "../tls";
3
- export declare function apiTokenSecret(name: string, apiToken: string): kind.Secret;
4
- export declare function tlsSecret(name: string, tls: TLSOut): kind.Secret;
5
- export declare function service(name: string): kind.Service;
6
- export declare function watcherService(name: string): kind.Service;
7
- //# sourceMappingURL=networking.d.ts.map
@@ -1,126 +0,0 @@
1
- /// <reference types="node" />
2
- import { V1EnvVar } from "@kubernetes/client-node";
3
- import { kind } from "kubernetes-fluent-client";
4
- import { Assets } from ".";
5
- /** Generate the pepr-system namespace */
6
- export declare function namespace(namespaceLabels?: Record<string, string>): {
7
- apiVersion: string;
8
- kind: string;
9
- metadata: {
10
- name: string;
11
- labels: Record<string, string>;
12
- };
13
- } | {
14
- apiVersion: string;
15
- kind: string;
16
- metadata: {
17
- name: string;
18
- labels?: undefined;
19
- };
20
- };
21
- export declare function watcher(assets: Assets, hash: string, buildTimestamp: string): {
22
- apiVersion: string;
23
- kind: string;
24
- metadata: {
25
- name: string;
26
- namespace: string;
27
- annotations: {
28
- "pepr.dev/description": string;
29
- };
30
- labels: {
31
- app: string;
32
- "pepr.dev/controller": string;
33
- "pepr.dev/uuid": string;
34
- };
35
- };
36
- spec: {
37
- replicas: number;
38
- strategy: {
39
- type: string;
40
- };
41
- selector: {
42
- matchLabels: {
43
- app: string;
44
- "pepr.dev/controller": string;
45
- };
46
- };
47
- template: {
48
- metadata: {
49
- annotations: {
50
- buildTimestamp: string;
51
- };
52
- labels: {
53
- app: string;
54
- "pepr.dev/controller": string;
55
- };
56
- };
57
- spec: {
58
- terminationGracePeriodSeconds: number;
59
- serviceAccountName: string;
60
- securityContext: {
61
- runAsUser: number;
62
- runAsGroup: number;
63
- runAsNonRoot: boolean;
64
- fsGroup: number;
65
- };
66
- containers: {
67
- name: string;
68
- image: string;
69
- imagePullPolicy: string;
70
- command: string[];
71
- readinessProbe: {
72
- httpGet: {
73
- path: string;
74
- port: number;
75
- scheme: string;
76
- };
77
- };
78
- livenessProbe: {
79
- httpGet: {
80
- path: string;
81
- port: number;
82
- scheme: string;
83
- };
84
- };
85
- ports: {
86
- containerPort: number;
87
- }[];
88
- resources: {
89
- requests: {
90
- memory: string;
91
- cpu: string;
92
- };
93
- limits: {
94
- memory: string;
95
- cpu: string;
96
- };
97
- };
98
- securityContext: {
99
- runAsUser: number;
100
- runAsGroup: number;
101
- runAsNonRoot: boolean;
102
- allowPrivilegeEscalation: boolean;
103
- capabilities: {
104
- drop: string[];
105
- };
106
- };
107
- volumeMounts: {
108
- name: string;
109
- mountPath: string;
110
- readOnly: boolean;
111
- }[];
112
- env: V1EnvVar[];
113
- }[];
114
- volumes: {
115
- name: string;
116
- secret: {
117
- secretName: string;
118
- };
119
- }[];
120
- };
121
- };
122
- };
123
- } | null;
124
- export declare function deployment(assets: Assets, hash: string, buildTimestamp: string): kind.Deployment;
125
- export declare function moduleSecret(name: string, data: Buffer, hash: string): kind.Secret;
126
- //# sourceMappingURL=pods.d.ts.map
@@ -1,14 +0,0 @@
1
- import { kind } from "kubernetes-fluent-client";
2
- import { CapabilityExport } from "../types";
3
- /**
4
- * Grants the controller access to cluster resources beyond the mutating webhook.
5
- *
6
- * @todo: should dynamically generate this based on resources used by the module. will also need to explore how this should work for multiple modules.
7
- * @returns
8
- */
9
- export declare function clusterRole(name: string, capabilities: CapabilityExport[], rbacMode?: string): kind.ClusterRole;
10
- export declare function clusterRoleBinding(name: string): kind.ClusterRoleBinding;
11
- export declare function serviceAccount(name: string): kind.ServiceAccount;
12
- export declare function storeRole(name: string): kind.Role;
13
- export declare function storeRoleBinding(name: string): kind.RoleBinding;
14
- //# sourceMappingURL=rbac.d.ts.map
@@ -1,7 +0,0 @@
1
- import { kind as k } from "kubernetes-fluent-client";
2
- export declare const group: string, version: string, kind: string;
3
- export declare const singular: string;
4
- export declare const plural: string;
5
- export declare const name: string;
6
- export declare const peprStoreCRD: k.CustomResourceDefinition;
7
- //# sourceMappingURL=store.d.ts.map
@@ -1,6 +0,0 @@
1
- import { V1RuleWithOperations } from "@kubernetes/client-node";
2
- import { kind } from "kubernetes-fluent-client";
3
- import { Assets } from ".";
4
- export declare function generateWebhookRules(assets: Assets, isMutateWebhook: boolean): Promise<V1RuleWithOperations[]>;
5
- export declare function webhookConfig(assets: Assets, mutateOrValidate: "mutate" | "validate", timeoutSeconds?: number): Promise<kind.MutatingWebhookConfiguration | kind.ValidatingWebhookConfiguration | null>;
6
- //# sourceMappingURL=webhooks.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Assets } from ".";
2
- export declare function overridesFile({ hash, name, image, config, apiToken }: Assets, path: string): Promise<void>;
3
- export declare function zarfYaml({ name, image, config }: Assets, path: string): string;
4
- export declare function allYaml(assets: Assets, rbacMode: string): Promise<string>;
5
- //# sourceMappingURL=yaml.d.ts.map
@@ -1,66 +0,0 @@
1
- import { GenericClass, GroupVersionKind } from "kubernetes-fluent-client";
2
- import { PeprStore, Storage } from "./storage";
3
- import { Schedule } from "./schedule";
4
- import { Binding, CapabilityCfg, CapabilityExport, WhenSelector } from "./types";
5
- /**
6
- * A capability is a unit of functionality that can be registered with the Pepr runtime.
7
- */
8
- export declare class Capability implements CapabilityExport {
9
- #private;
10
- hasSchedule: boolean;
11
- /**
12
- * Run code on a schedule with the capability.
13
- *
14
- * @param schedule The schedule to run the code on
15
- * @returns
16
- */
17
- OnSchedule: (schedule: Schedule) => void;
18
- /**
19
- * Store is a key-value data store that can be used to persist data that should be shared
20
- * between requests. Each capability has its own store, and the data is persisted in Kubernetes
21
- * in the `pepr-system` namespace.
22
- *
23
- * Note: You should only access the store from within an action.
24
- */
25
- Store: PeprStore;
26
- /**
27
- * ScheduleStore is a key-value data store used to persist schedule data that should be shared
28
- * between intervals. Each Schedule shares store, and the data is persisted in Kubernetes
29
- * in the `pepr-system` namespace.
30
- *
31
- * Note: There is no direct access to schedule store
32
- */
33
- ScheduleStore: PeprStore;
34
- get bindings(): Binding[];
35
- get name(): string;
36
- get description(): string;
37
- get namespaces(): string[];
38
- constructor(cfg: CapabilityCfg);
39
- /**
40
- * Register the store with the capability. This is called automatically by the Pepr controller.
41
- *
42
- * @param store
43
- */
44
- registerScheduleStore: () => {
45
- scheduleStore: Storage;
46
- };
47
- /**
48
- * Register the store with the capability. This is called automatically by the Pepr controller.
49
- *
50
- * @param store
51
- */
52
- registerStore: () => {
53
- store: Storage;
54
- };
55
- /**
56
- * The When method is used to register a action to be executed when a Kubernetes resource is
57
- * processed by Pepr. The action will be executed if the resource matches the specified kind and any
58
- * filters that are applied.
59
- *
60
- * @param model the KubernetesObject model to match
61
- * @param kind if using a custom KubernetesObject not available in `a.*`, specify the GroupVersionKind
62
- * @returns
63
- */
64
- When: <T extends GenericClass>(model: T, kind?: GroupVersionKind) => WhenSelector<T>;
65
- }
66
- //# sourceMappingURL=capability.d.ts.map
@@ -1,10 +0,0 @@
1
- import { Capability } from "../capability";
2
- import { MutateResponse, AdmissionRequest, ValidateResponse } from "../k8s";
3
- import { ModuleConfig } from "../module";
4
- export declare class Controller {
5
- #private;
6
- constructor(config: ModuleConfig, capabilities: Capability[], beforeHook?: (req: AdmissionRequest) => void, afterHook?: (res: MutateResponse | ValidateResponse) => void, onReady?: () => void);
7
- /** Start the webhook server */
8
- startServer: (port: number) => void;
9
- }
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,7 +0,0 @@
1
- import { Capability } from "../capability";
2
- export declare const debounceBackoff = 5000;
3
- export declare class PeprControllerStore {
4
- #private;
5
- constructor(capabilities: Capability[], name: string, onReady?: () => void);
6
- }
7
- //# sourceMappingURL=store.d.ts.map
@@ -1,12 +0,0 @@
1
- export declare const Errors: {
2
- audit: string;
3
- ignore: string;
4
- reject: string;
5
- };
6
- export declare const ErrorList: string[];
7
- /**
8
- * Validate the error or throw an error
9
- * @param error
10
- */
11
- export declare function ValidateError(error?: string): void;
12
- //# sourceMappingURL=errors.d.ts.map
@@ -1,11 +0,0 @@
1
- import { AdmissionRequest } from "./k8s";
2
- import { Binding } from "./types";
3
- /**
4
- * shouldSkipRequest determines if a request should be skipped based on the binding filters.
5
- *
6
- * @param binding the action binding
7
- * @param req the incoming request
8
- * @returns
9
- */
10
- export declare function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capabilityNamespaces: string[]): boolean;
11
- //# sourceMappingURL=filter.d.ts.map