pepr 0.40.1 → 0.42.1
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/README.md +11 -5
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.helpers.d.ts +66 -0
- package/dist/cli/build.helpers.d.ts.map +1 -1
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/init/templates.d.ts +2 -2
- package/dist/cli/monitor.d.ts +23 -0
- package/dist/cli/monitor.d.ts.map +1 -1
- package/dist/cli.js +536 -429
- package/dist/controller.js +52 -27
- package/dist/lib/assets/destroy.d.ts.map +1 -1
- package/dist/lib/assets/helm.d.ts +1 -1
- package/dist/lib/assets/helm.d.ts.map +1 -1
- package/dist/lib/assets/index.d.ts.map +1 -1
- package/dist/lib/assets/pods.d.ts +5 -19
- package/dist/lib/assets/pods.d.ts.map +1 -1
- package/dist/lib/assets/webhooks.d.ts.map +1 -1
- package/dist/lib/assets/yaml.d.ts.map +1 -1
- package/dist/lib/capability.d.ts.map +1 -1
- package/dist/lib/controller/index.d.ts.map +1 -1
- package/dist/lib/controller/index.util.d.ts +10 -0
- package/dist/lib/controller/index.util.d.ts.map +1 -0
- package/dist/lib/controller/store.d.ts +0 -1
- package/dist/lib/controller/store.d.ts.map +1 -1
- package/dist/lib/controller/storeCache.d.ts +1 -0
- package/dist/lib/controller/storeCache.d.ts.map +1 -1
- package/dist/lib/deploymentChecks.d.ts +3 -0
- package/dist/lib/deploymentChecks.d.ts.map +1 -0
- package/dist/lib/enums.d.ts +5 -5
- package/dist/lib/enums.d.ts.map +1 -1
- package/dist/lib/filesystemService.d.ts +2 -0
- package/dist/lib/filesystemService.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/adjudicators.d.ts +73 -0
- package/dist/lib/filter/adjudicators/adjudicators.d.ts.map +1 -0
- package/dist/lib/filter/adjudicators/defaultTestObjects.d.ts +7 -0
- package/dist/lib/filter/adjudicators/defaultTestObjects.d.ts.map +1 -0
- package/dist/lib/helpers.d.ts +1 -4
- package/dist/lib/helpers.d.ts.map +1 -1
- package/dist/lib/mutate-request.d.ts +2 -2
- package/dist/lib/mutate-request.d.ts.map +1 -1
- package/dist/lib/queue.d.ts.map +1 -1
- package/dist/lib/schedule.d.ts.map +1 -1
- package/dist/lib/storage.d.ts +5 -5
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/{logger.d.ts → telemetry/logger.d.ts} +1 -1
- package/dist/lib/telemetry/logger.d.ts.map +1 -0
- package/dist/lib/{metrics.d.ts → telemetry/metrics.d.ts} +3 -1
- package/dist/lib/telemetry/metrics.d.ts.map +1 -0
- package/dist/lib/types.d.ts +10 -9
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/validate-processor.d.ts +4 -1
- package/dist/lib/validate-processor.d.ts.map +1 -1
- package/dist/lib/watch-processor.d.ts.map +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +283 -231
- package/dist/lib.js.map +4 -4
- package/dist/sdk/sdk.d.ts +3 -4
- package/dist/sdk/sdk.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/cli/build.helpers.ts +180 -0
- package/src/cli/build.ts +85 -132
- package/src/cli/deploy.ts +2 -1
- package/src/cli/init/templates.ts +1 -1
- package/src/cli/monitor.ts +108 -65
- package/src/lib/assets/deploy.ts +7 -7
- package/src/lib/assets/destroy.ts +2 -2
- package/src/lib/assets/helm.ts +6 -6
- package/src/lib/assets/index.ts +110 -89
- package/src/lib/assets/pods.ts +10 -5
- package/src/lib/assets/webhooks.ts +3 -3
- package/src/lib/assets/yaml.ts +12 -9
- package/src/lib/capability.ts +29 -19
- package/src/lib/controller/index.ts +41 -69
- package/src/lib/controller/index.util.ts +47 -0
- package/src/lib/controller/store.ts +24 -11
- package/src/lib/controller/storeCache.ts +11 -2
- package/src/lib/deploymentChecks.ts +43 -0
- package/src/lib/enums.ts +5 -5
- package/src/lib/filesystemService.ts +16 -0
- package/src/lib/filter/{adjudicators.ts → adjudicators/adjudicators.ts} +67 -35
- package/src/lib/filter/adjudicators/defaultTestObjects.ts +46 -0
- package/src/lib/filter/filter.ts +1 -1
- package/src/lib/finalizer.ts +1 -1
- package/src/lib/helpers.ts +31 -88
- package/src/lib/mutate-processor.ts +1 -1
- package/src/lib/mutate-request.ts +11 -11
- package/src/lib/queue.ts +13 -5
- package/src/lib/schedule.ts +8 -8
- package/src/lib/storage.ts +48 -39
- package/src/lib/{logger.ts → telemetry/logger.ts} +1 -1
- package/src/lib/{metrics.ts → telemetry/metrics.ts} +18 -17
- package/src/lib/types.ts +12 -9
- package/src/lib/utils.ts +6 -6
- package/src/lib/validate-processor.ts +48 -40
- package/src/lib/watch-processor.ts +19 -15
- package/src/lib.ts +1 -1
- package/src/runtime/controller.ts +1 -1
- package/src/sdk/cosign.ts +4 -4
- package/src/sdk/sdk.ts +6 -9
- package/src/templates/capabilities/hello-pepr.ts +19 -9
- package/dist/lib/filter/adjudicators.d.ts +0 -69
- package/dist/lib/filter/adjudicators.d.ts.map +0 -1
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/metrics.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Pepr is on a mission to save Kubernetes from the tyranny of YAML, intimidating g
|
|
|
33
33
|
|
|
34
34
|
## Example Pepr Action
|
|
35
35
|
|
|
36
|
-
This quick sample shows how to react to a ConfigMap being created or updated in the cluster. It adds a label and annotation to the ConfigMap and adds some data to the ConfigMap. It also creates a Validating Webhook to make sure the "pepr" label still exists. Finally, after the ConfigMap is created, it logs a message to the Pepr controller and creates or updates a separate ConfigMap with the [kubernetes-fluent-client](https://github.com/defenseunicorns/kubernetes-fluent-client) using server-side apply. For more details see [actions](./docs/030_user-guide/030_actions
|
|
36
|
+
This quick sample shows how to react to a ConfigMap being created or updated in the cluster. It adds a label and annotation to the ConfigMap and adds some data to the ConfigMap. It also creates a Validating Webhook to make sure the "pepr" label still exists. Finally, after the ConfigMap is created, it logs a message to the Pepr controller and creates or updates a separate ConfigMap with the [kubernetes-fluent-client](https://github.com/defenseunicorns/kubernetes-fluent-client) using server-side apply. For more details see [actions](./docs/030_user-guide/030_actions/) section.
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
39
|
When(a.ConfigMap)
|
|
@@ -95,17 +95,23 @@ When(a.ConfigMap)
|
|
|
95
95
|
# Create a new Pepr Module
|
|
96
96
|
npx pepr init
|
|
97
97
|
|
|
98
|
-
# If you already have a
|
|
98
|
+
# If you already have a K3d cluster you want to use, skip this step
|
|
99
99
|
npm run k3d-setup
|
|
100
100
|
|
|
101
|
-
# Start playing with Pepr now
|
|
102
|
-
# If using another local
|
|
101
|
+
# Start playing with Pepr now!
|
|
102
|
+
# If using Kind, or another local k8s distro instead,
|
|
103
|
+
# run `npx pepr dev --host <your_hostname>`
|
|
103
104
|
npx pepr dev
|
|
104
105
|
kubectl apply -f capabilities/hello-pepr.samples.yaml
|
|
105
106
|
|
|
106
|
-
# Be amazed and ⭐️ this repo
|
|
107
|
+
# Be amazed and ⭐️ this repo!
|
|
107
108
|
```
|
|
108
109
|
|
|
110
|
+
> [!TIP]
|
|
111
|
+
> Don't use IP as your `--host`, it's not supported. Make sure to check your
|
|
112
|
+
> local k8s distro documentation how to reach your localhost, which is where
|
|
113
|
+
> `pepr dev` is serving the code from.
|
|
114
|
+
|
|
109
115
|
https://user-images.githubusercontent.com/882485/230895880-c5623077-f811-4870-bb9f-9bb8e5edc118.mp4
|
|
110
116
|
|
|
111
117
|
## Concepts
|
package/dist/cli/build.d.ts
CHANGED
package/dist/cli/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAKrE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAmBjC,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjF,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAqH/C;AAWD,wBAAsB,UAAU,CAAC,UAAU,SAAS;;;;;;;GAuCnD;AAED,wBAAsB,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,SAAS,EAAE,KAAK,UAAO;;;;;eAwEvF;AA6CD,wBAAsB,WAAW,kBAShC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { CapabilityExport } from "../lib/types";
|
|
2
|
+
import { BuildOptions, BuildResult, BuildContext } from "esbuild";
|
|
3
|
+
import { Assets } from "../lib/assets";
|
|
4
|
+
export type Reloader = (opts: BuildResult<BuildOptions>) => void | Promise<void>;
|
|
1
5
|
/**
|
|
2
6
|
* Determine the RBAC mode based on the CLI options and the module's config
|
|
3
7
|
* @param opts CLI options
|
|
@@ -16,4 +20,66 @@ export declare function determineRbacMode(opts: {
|
|
|
16
20
|
rbacMode?: string;
|
|
17
21
|
};
|
|
18
22
|
}): string;
|
|
23
|
+
/**
|
|
24
|
+
* Handle the custom output directory
|
|
25
|
+
* @param outputDir the desired output directory
|
|
26
|
+
* @returns The desired output directory or the default one
|
|
27
|
+
*/
|
|
28
|
+
export declare function handleCustomOutputDir(outputDir: string): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if the image is from Iron Bank and return the correct image
|
|
31
|
+
* @param registry The registry of the image
|
|
32
|
+
* @param image The image to check
|
|
33
|
+
* @param peprVersion The version of the PEPR controller
|
|
34
|
+
* @returns The image string
|
|
35
|
+
* @example
|
|
36
|
+
*/
|
|
37
|
+
export declare function checkIronBankImage(registry: string, image: string, peprVersion: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Check if the image pull secret is a valid Kubernetes name
|
|
40
|
+
* @param imagePullSecret
|
|
41
|
+
* @returns boolean
|
|
42
|
+
*/
|
|
43
|
+
export declare function validImagePullSecret(imagePullSecretName: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Constraint to majke sure customImage and registry are not both used
|
|
46
|
+
* @param customImage
|
|
47
|
+
* @param registry
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare function handleCustomImage(customImage: string, registry: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Creates and pushes a custom image for WASM or any other included files
|
|
53
|
+
* @param includedFiles
|
|
54
|
+
* @param peprVersion
|
|
55
|
+
* @param description
|
|
56
|
+
* @param image
|
|
57
|
+
*/
|
|
58
|
+
export declare function handleCustomImageBuild(includedFiles: string[], peprVersion: string, description: string, image: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Disables embedding of deployment files into output module
|
|
61
|
+
* @param embed
|
|
62
|
+
* @param path
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export declare function handleEmbedding(embed: boolean, path: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Check if the capability names are valid
|
|
68
|
+
* @param capabilities The capabilities to check
|
|
69
|
+
*/
|
|
70
|
+
export declare function handleValidCapabilityNames(capabilities: CapabilityExport[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Watch for changes in the module
|
|
73
|
+
* @param ctxCfg The build options
|
|
74
|
+
* @param reloader The reloader function
|
|
75
|
+
* @returns The build context
|
|
76
|
+
*/
|
|
77
|
+
export declare function watchForChanges(ctxCfg: BuildOptions, reloader: Reloader | undefined): Promise<BuildContext<BuildOptions>>;
|
|
78
|
+
export declare function generateYamlAndWriteToDisk(obj: {
|
|
79
|
+
uuid: string;
|
|
80
|
+
imagePullSecret: string;
|
|
81
|
+
outputDir: string;
|
|
82
|
+
assets: Assets;
|
|
83
|
+
zarf: string;
|
|
84
|
+
}): Promise<void>;
|
|
19
85
|
//# sourceMappingURL=build.helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.helpers.d.ts","sourceRoot":"","sources":["../../src/cli/build.helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.helpers.d.ts","sourceRoot":"","sources":["../../src/cli/build.helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAW,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACjF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3B,GAAG,EAAE;IAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnC,MAAM,CAaR;AAED;;;;GAIG;AAEH,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY9E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAI/F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU/E;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EAAE,EACvB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAKlE;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAQjF;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAarC;AAED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhB"}
|
package/dist/cli/deploy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAOjC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,QA8FxC"}
|
|
@@ -28,8 +28,8 @@ export declare const dependencies: {
|
|
|
28
28
|
husky: string;
|
|
29
29
|
jest: string;
|
|
30
30
|
"js-yaml": string;
|
|
31
|
-
nock: string;
|
|
32
31
|
"ts-jest": string;
|
|
32
|
+
undici: string;
|
|
33
33
|
}, peerDependencies: {
|
|
34
34
|
"@types/prompts": string;
|
|
35
35
|
"@typescript-eslint/eslint-plugin": string;
|
|
@@ -92,7 +92,7 @@ export declare function genPkgJSON(opts: InitOptions, pgkVerOverride?: string):
|
|
|
92
92
|
};
|
|
93
93
|
dependencies: {
|
|
94
94
|
pepr: string;
|
|
95
|
-
|
|
95
|
+
undici: string;
|
|
96
96
|
};
|
|
97
97
|
devDependencies: {
|
|
98
98
|
typescript: string;
|
package/dist/cli/monitor.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
import { Log as K8sLog } from "@kubernetes/client-node";
|
|
1
2
|
import { RootCmd } from "./root";
|
|
3
|
+
interface LogPayload {
|
|
4
|
+
namespace: string;
|
|
5
|
+
name: string;
|
|
6
|
+
res: {
|
|
7
|
+
uid: string;
|
|
8
|
+
allowed?: boolean;
|
|
9
|
+
patch?: string;
|
|
10
|
+
patchType?: string;
|
|
11
|
+
warnings?: string;
|
|
12
|
+
status?: {
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
2
17
|
export default function (program: RootCmd): void;
|
|
18
|
+
export declare function getLabelsAndErrorMessage(uuid?: string): {
|
|
19
|
+
labels: string[];
|
|
20
|
+
errorMessage: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function getK8sLogFromKubeConfig(): K8sLog;
|
|
23
|
+
export declare function processMutateLog(payload: LogPayload, name: string, uid: string): void;
|
|
24
|
+
export declare function processValidateLog(payload: LogPayload, name: string, uid: string): void;
|
|
25
|
+
export {};
|
|
3
26
|
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/cli/monitor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/cli/monitor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,IAAI,MAAM,EAAoC,MAAM,yBAAyB,CAAC;AAI1F,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,UAAU,UAAU;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAiC/C;AAED,wBAAgB,wBAAwB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG;IACvD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAaA;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAIhD;AAmCD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAYrF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAWvF"}
|