pepr 0.51.6 → 0.52.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.
- package/dist/cli/build.d.ts +2 -2
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.helpers.d.ts +1 -1
- package/dist/cli/build.helpers.d.ts.map +1 -1
- package/dist/cli/crd/create.d.ts +0 -1
- package/dist/cli/crd/create.d.ts.map +1 -1
- package/dist/cli/crd/generate.d.ts.map +1 -1
- package/dist/cli/crd/index.d.ts +2 -2
- package/dist/cli/crd/index.d.ts.map +1 -1
- package/dist/cli/deploy.d.ts +3 -3
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/dev.d.ts +2 -2
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/format/index.d.ts +2 -2
- package/dist/cli/format/index.d.ts.map +1 -1
- package/dist/cli/init/index.d.ts +2 -2
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/templates.d.ts +13 -12
- package/dist/cli/init/templates.d.ts.map +1 -1
- package/dist/cli/init/walkthrough.d.ts.map +1 -1
- package/dist/cli/kfc.d.ts +2 -2
- package/dist/cli/kfc.d.ts.map +1 -1
- package/dist/cli/monitor.d.ts +2 -2
- package/dist/cli/monitor.d.ts.map +1 -1
- package/dist/cli/update/index.d.ts +2 -2
- package/dist/cli/update/index.d.ts.map +1 -1
- package/dist/cli/uuid.d.ts +2 -2
- package/dist/cli/uuid.d.ts.map +1 -1
- package/dist/cli.js +296 -204
- package/dist/controller.js +1 -1
- package/dist/lib/assets/assets.d.ts +13 -2
- package/dist/lib/assets/assets.d.ts.map +1 -1
- package/dist/lib/assets/deploy.d.ts.map +1 -1
- package/dist/lib/assets/{envrionment.d.ts → environment.d.ts} +1 -1
- package/dist/lib/assets/environment.d.ts.map +1 -0
- package/dist/lib/assets/helm.d.ts +4 -3
- package/dist/lib/assets/helm.d.ts.map +1 -1
- package/dist/lib/assets/{pods.d.ts → k8sObjects.d.ts} +4 -2
- package/dist/lib/assets/k8sObjects.d.ts.map +1 -0
- package/dist/lib/assets/networking.d.ts +0 -2
- package/dist/lib/assets/networking.d.ts.map +1 -1
- package/dist/lib/assets/yaml/generateAllYaml.d.ts +8 -3
- package/dist/lib/assets/yaml/generateAllYaml.d.ts.map +1 -1
- package/dist/lib/assets/yaml/overridesFile.d.ts +4 -1
- package/dist/lib/assets/yaml/overridesFile.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/cli/build.helpers.ts +26 -14
- package/src/cli/build.ts +37 -47
- package/src/cli/crd/create.ts +15 -20
- package/src/cli/crd/generate.ts +9 -6
- package/src/cli/crd/index.ts +2 -2
- package/src/cli/deploy.ts +16 -16
- package/src/cli/dev.ts +8 -8
- package/src/cli/format/index.ts +5 -4
- package/src/cli/init/index.ts +12 -9
- package/src/cli/init/walkthrough.ts +2 -4
- package/src/cli/kfc.ts +17 -13
- package/src/cli/monitor.ts +2 -2
- package/src/cli/update/index.ts +11 -11
- package/src/cli/uuid.ts +2 -2
- package/src/cli.ts +2 -2
- package/src/lib/assets/assets.ts +81 -22
- package/src/lib/assets/deploy.ts +26 -12
- package/src/lib/assets/helm.ts +31 -3
- package/src/lib/assets/{pods.ts → k8sObjects.ts} +69 -22
- package/src/lib/assets/networking.ts +0 -52
- package/src/lib/assets/yaml/generateAllYaml.ts +38 -11
- package/src/lib/assets/yaml/overridesFile.ts +4 -1
- package/src/templates/tsconfig.module.json +2 -2
- package/dist/cli/root.d.ts +0 -5
- package/dist/cli/root.d.ts.map +0 -1
- package/dist/lib/assets/envrionment.d.ts.map +0 -1
- package/dist/lib/assets/pods.d.ts.map +0 -1
- package/src/cli/root.ts +0 -12
- /package/src/lib/assets/{envrionment.ts → environment.ts} +0 -0
package/dist/controller.js
CHANGED
|
@@ -50,7 +50,7 @@ if (process.env.LOG_LEVEL) {
|
|
|
50
50
|
var logger_default = Log;
|
|
51
51
|
|
|
52
52
|
// src/templates/data.json
|
|
53
|
-
var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.
|
|
53
|
+
var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.52.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:journey && npm run test:journey-wasm", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm", "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts", "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts", "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.30.2", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.8.1", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
|
|
54
54
|
|
|
55
55
|
// src/lib/k8s.ts
|
|
56
56
|
var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
|
|
@@ -5,6 +5,9 @@ import { WebhookIgnore } from "../k8s";
|
|
|
5
5
|
import { V1Deployment, V1MutatingWebhookConfiguration, V1ValidatingWebhookConfiguration } from "@kubernetes/client-node/dist/gen";
|
|
6
6
|
import { WebhookType } from "../enums";
|
|
7
7
|
import { kind } from "kubernetes-fluent-client";
|
|
8
|
+
export declare function norWatchOrAdmission(capabilities: CapabilityExport[]): boolean;
|
|
9
|
+
export declare function isAdmission(capabilities: CapabilityExport[]): boolean;
|
|
10
|
+
export declare function isWatcher(capabilities: CapabilityExport[]): boolean;
|
|
8
11
|
export declare class Assets {
|
|
9
12
|
readonly name: string;
|
|
10
13
|
readonly tls: TLSOut;
|
|
@@ -22,9 +25,17 @@ export declare class Assets {
|
|
|
22
25
|
zarfYaml: (zarfYamlGenerator: (assets: Assets, path: string, type: "manifests" | "charts") => string, path: string) => string;
|
|
23
26
|
zarfYamlChart: (zarfYamlGenerator: (assets: Assets, path: string, type: "manifests" | "charts") => string, path: string) => string;
|
|
24
27
|
allYaml: (yamlGenerationFunction: (assets: Assets, deployments: {
|
|
25
|
-
|
|
28
|
+
admission: V1Deployment | null;
|
|
26
29
|
watch: V1Deployment | null;
|
|
27
|
-
}
|
|
30
|
+
}, services: {
|
|
31
|
+
admission: kind.Service | null;
|
|
32
|
+
watch: kind.Service | null;
|
|
33
|
+
}) => Promise<string>, getControllerManifests: {
|
|
34
|
+
getDeploymentFunction: (assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string) => kind.Deployment | null;
|
|
35
|
+
getWatcherFunction: (assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string) => kind.Deployment | null;
|
|
36
|
+
getServiceFunction: (name: string, assets: Assets) => kind.Service | null;
|
|
37
|
+
getWatcherServiceFunction: (name: string, assets: Assets) => kind.Service | null;
|
|
38
|
+
}, imagePullSecret?: string) => Promise<string>;
|
|
28
39
|
writeWebhookFiles: (validateWebhook: V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null, mutateWebhook: V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null, helm: Record<string, Record<string, string>>) => Promise<void>;
|
|
29
40
|
generateHelmChart: (webhookGeneratorFunction: (assets: Assets, mutateOrValidate: WebhookType, timeoutSeconds: number | undefined) => Promise<V1MutatingWebhookConfiguration | V1ValidatingWebhookConfiguration | null>, getWatcherFunction: (assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string) => kind.Deployment | null, getModuleSecretFunction: (name: string, data: Buffer, hash: string) => kind.Secret, basePath: string) => Promise<void>;
|
|
30
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,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/deploy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAoC,MAAM,UAAU,CAAC;AAoBpE,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;AAG7D,wBAAsB,qBAAqB,CACzC,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA0Bf;AA0BD,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { V1EnvVar } from "@kubernetes/client-node";
|
|
2
2
|
import { ModuleConfig } from "../types";
|
|
3
3
|
export declare function genEnv(config: ModuleConfig, watchMode?: boolean, ignoreWatchMode?: boolean): V1EnvVar[];
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,MAAM,CACpB,MAAM,EAAE,YAAY,EACpB,SAAS,UAAQ,EACjB,eAAe,UAAQ,GACtB,QAAQ,EAAE,CAkBZ"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
type ControllerType = "admission" | "watcher";
|
|
1
2
|
export declare function clusterRoleTemplate(): string;
|
|
2
3
|
export declare function namespaceTemplate(): string;
|
|
3
4
|
export declare function chartYaml(name: string, description?: string): string;
|
|
4
|
-
export declare function watcherDeployTemplate(buildTimestamp: string): string;
|
|
5
|
-
export declare function admissionDeployTemplate(buildTimestamp: string): string;
|
|
6
|
-
type ControllerType = "admission" | "watcher";
|
|
5
|
+
export declare function watcherDeployTemplate(buildTimestamp: string, type: ControllerType): string;
|
|
6
|
+
export declare function admissionDeployTemplate(buildTimestamp: string, type: ControllerType): string;
|
|
7
7
|
export declare function serviceMonitorTemplate(name: string, type: ControllerType): string;
|
|
8
|
+
export declare function serviceTemplate(name: string, type: ControllerType): string;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=helm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/helm.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,IAAI,MAAM,CAY5C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BpE;AAED,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/helm.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9C,wBAAgB,mBAAmB,IAAI,MAAM,CAY5C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BpE;AAED,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAgG1F;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAoH5F;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CA0BjF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAoB1E"}
|
|
@@ -4,6 +4,8 @@ import { Assets } from "./assets";
|
|
|
4
4
|
/** Generate the pepr-system namespace */
|
|
5
5
|
export declare function getNamespace(namespaceLabels?: Record<string, string>): KubernetesObject;
|
|
6
6
|
export declare function getWatcher(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string): kind.Deployment | null;
|
|
7
|
-
export declare function getDeployment(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string): kind.Deployment;
|
|
7
|
+
export declare function getDeployment(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string): kind.Deployment | null;
|
|
8
8
|
export declare function getModuleSecret(name: string, data: Buffer, hash: string): kind.Secret;
|
|
9
|
-
|
|
9
|
+
export declare function service(name: string, assets: Assets): kind.Service | null;
|
|
10
|
+
export declare function watcherService(name: string, assets: Assets): kind.Service | null;
|
|
11
|
+
//# sourceMappingURL=k8sObjects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k8sObjects.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/k8sObjects.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,MAAM,EAA+C,MAAM,UAAU,CAAC;AAG/E,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAmBvF;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,GACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CA2IxB;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,GACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAmJxB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAsBrF;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CA2BzE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CA2BhF"}
|
|
@@ -2,6 +2,4 @@ import { kind } from "kubernetes-fluent-client";
|
|
|
2
2
|
import { TLSOut } from "../tls";
|
|
3
3
|
export declare function apiPathSecret(name: string, apiPath: string): kind.Secret;
|
|
4
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
5
|
//# sourceMappingURL=networking.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/networking.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAaxE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAchE
|
|
1
|
+
{"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/networking.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAaxE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAchE"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { Assets } from "../assets";
|
|
2
|
-
import { V1Deployment } from "@kubernetes/client-node";
|
|
2
|
+
import { V1Deployment, V1Service, KubernetesObject } from "@kubernetes/client-node";
|
|
3
3
|
type deployments = {
|
|
4
|
-
|
|
4
|
+
admission: V1Deployment | null;
|
|
5
5
|
watch: V1Deployment | null;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type services = {
|
|
8
|
+
admission: V1Service | null;
|
|
9
|
+
watch: V1Service | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function pushControllerManifests(resources: KubernetesObject[], deployments: deployments, services: services): KubernetesObject[];
|
|
12
|
+
export declare function generateAllYaml(assets: Assets, deployments: deployments, services: services): Promise<string>;
|
|
8
13
|
export {};
|
|
9
14
|
//# sourceMappingURL=generateAllYaml.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateAllYaml.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/generateAllYaml.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUnC,OAAO,EAAY,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"generateAllYaml.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/generateAllYaml.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUnC,OAAO,EAAY,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK9F,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAAC;AAClF,KAAK,QAAQ,GAAG;IACd,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,EAAE,CAcpB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,CAAC,CAqCjB"}
|
|
@@ -7,5 +7,8 @@ export type ChartOverrides = {
|
|
|
7
7
|
name: string;
|
|
8
8
|
image: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function overridesFile({ hash, name, image, config, apiPath, capabilities }: ChartOverrides, path: string, imagePullSecrets: string[]
|
|
10
|
+
export declare function overridesFile({ hash, name, image, config, apiPath, capabilities }: ChartOverrides, path: string, imagePullSecrets: string[], controllerType?: {
|
|
11
|
+
admission: boolean;
|
|
12
|
+
watcher: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
11
14
|
//# sourceMappingURL=overridesFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overridesFile.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/overridesFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK7D,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,wBAAsB,aAAa,CACjC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,cAAc,EACpE,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"overridesFile.d.ts","sourceRoot":"","sources":["../../../../src/lib/assets/yaml/overridesFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK7D,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,wBAAsB,aAAa,CACjC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,cAAc,EACpE,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EAAE,EAC1B,cAAc,GAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAuC,GAC5F,OAAO,CAAC,IAAI,CAAC,CAkKf"}
|
package/package.json
CHANGED
|
@@ -16,16 +16,24 @@
|
|
|
16
16
|
"!src/fixtures/**",
|
|
17
17
|
"!dist/**/*.test.d.ts*"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.52.0",
|
|
20
20
|
"main": "dist/lib.js",
|
|
21
21
|
"types": "dist/lib.d.ts",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"ci": "npm ci",
|
|
24
|
-
"gen-data-json": "node hack/build-template-data.js",
|
|
25
|
-
"prebuild": "rm -fr dist/* && npm run gen-data-json",
|
|
26
23
|
"build": "tsc -p config/tsconfig.root.json && node build.mjs && npm pack",
|
|
27
24
|
"build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .",
|
|
28
25
|
"build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .",
|
|
26
|
+
"ci": "npm ci",
|
|
27
|
+
"format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check",
|
|
28
|
+
"format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write",
|
|
29
|
+
"format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers",
|
|
30
|
+
"format:markdown": "npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules \"**/*.md\"",
|
|
31
|
+
"format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts",
|
|
32
|
+
"format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'",
|
|
33
|
+
"format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'",
|
|
34
|
+
"gen-data-json": "node hack/build-template-data.js",
|
|
35
|
+
"prebuild": "rm -fr dist/* && npm run gen-data-json",
|
|
36
|
+
"prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi",
|
|
29
37
|
"set:version": "node scripts/set-version.js",
|
|
30
38
|
"test": "npm run test:unit && npm run test:journey && npm run test:journey-wasm",
|
|
31
39
|
"test:artifacts": "npm run build && vitest run src/build-artifact.test.ts",
|
|
@@ -36,22 +44,15 @@
|
|
|
36
44
|
"test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run",
|
|
37
45
|
"test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm",
|
|
38
46
|
"test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm",
|
|
39
|
-
"test:journey:image": "docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
|
|
47
|
+
"test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
|
|
40
48
|
"test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev",
|
|
41
49
|
"test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
|
|
42
|
-
"test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts
|
|
50
|
+
"test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts",
|
|
43
51
|
"test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts",
|
|
44
52
|
"test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run",
|
|
45
|
-
"format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check",
|
|
46
|
-
"format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write",
|
|
47
|
-
"format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers",
|
|
48
|
-
"format:markdown": "npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore pepr-upgrade-test --ignore node_modules \"**/*.md\"",
|
|
49
|
-
"format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts",
|
|
50
|
-
"format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'",
|
|
51
|
-
"format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'",
|
|
52
|
-
"test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && vitest run --config=config/vitest.journey.config.ts journey/pepr-upgrade.test.ts",
|
|
53
53
|
"test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage",
|
|
54
|
-
"
|
|
54
|
+
"test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts",
|
|
55
|
+
"test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"@types/ramda": "0.30.2",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"heredoc": "^1.3.1",
|
|
62
63
|
"http-status-codes": "^2.3.0",
|
|
63
64
|
"json-pointer": "^0.6.2",
|
|
64
|
-
"kubernetes-fluent-client": "3.8.
|
|
65
|
+
"kubernetes-fluent-client": "3.8.1",
|
|
65
66
|
"pino": "9.7.0",
|
|
66
67
|
"pino-pretty": "13.0.0",
|
|
67
68
|
"prom-client": "15.1.3",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"@types/express": "5.0.3",
|
|
78
79
|
"@types/json-pointer": "^1.0.34",
|
|
79
80
|
"@types/node": "24.x.x",
|
|
80
|
-
"@types/node-forge": "1.3.
|
|
81
|
+
"@types/node-forge": "1.3.13",
|
|
81
82
|
"@types/uuid": "10.0.0",
|
|
82
83
|
"@types/ws": "^8.18.1",
|
|
83
84
|
"@vitest/coverage-v8": "^3.2.3",
|
|
@@ -91,8 +92,7 @@
|
|
|
91
92
|
"vitest": "^3.2.3"
|
|
92
93
|
},
|
|
93
94
|
"overrides": {
|
|
94
|
-
"glob": "^9.0.0"
|
|
95
|
-
"brace-expansion": "1.1.11"
|
|
95
|
+
"glob": "^9.0.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@types/prompts": "2.4.9",
|
package/src/cli/build.helpers.ts
CHANGED
|
@@ -11,7 +11,13 @@ import { promises as fs } from "fs";
|
|
|
11
11
|
import { generateAllYaml } from "../lib/assets/yaml/generateAllYaml";
|
|
12
12
|
import { webhookConfigGenerator } from "../lib/assets/webhooks";
|
|
13
13
|
import { generateZarfYamlGeneric } from "../lib/assets/yaml/generateZarfYaml";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
getDeployment,
|
|
16
|
+
getModuleSecret,
|
|
17
|
+
getWatcher,
|
|
18
|
+
service,
|
|
19
|
+
watcherService,
|
|
20
|
+
} from "../lib/assets/k8sObjects";
|
|
15
21
|
|
|
16
22
|
interface ImageOptions {
|
|
17
23
|
customImage?: string;
|
|
@@ -77,18 +83,15 @@ export function determineRbacMode(
|
|
|
77
83
|
* @returns The desired output directory or the default one
|
|
78
84
|
*/
|
|
79
85
|
|
|
80
|
-
export async function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
86
|
+
export async function createOutputDirectory(outputDir: string): Promise<string> {
|
|
87
|
+
try {
|
|
88
|
+
const dir = outputDir === "" ? "dist" : outputDir;
|
|
89
|
+
await createDirectoryIfNotExists(dir);
|
|
90
|
+
return dir;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error(`Error creating output directory: ${error.message}`);
|
|
93
|
+
process.exit(1);
|
|
90
94
|
}
|
|
91
|
-
return defaultOutputDir;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
/**
|
|
@@ -193,7 +196,16 @@ export async function generateYamlAndWriteToDisk(obj: {
|
|
|
193
196
|
const chartPath = `${uuid}-chart`;
|
|
194
197
|
const yamlPath = resolve(outputDir, yamlFile);
|
|
195
198
|
try {
|
|
196
|
-
const yaml = await assets.allYaml(
|
|
199
|
+
const yaml = await assets.allYaml(
|
|
200
|
+
generateAllYaml,
|
|
201
|
+
{
|
|
202
|
+
getDeploymentFunction: getDeployment,
|
|
203
|
+
getWatcherFunction: getWatcher,
|
|
204
|
+
getServiceFunction: service,
|
|
205
|
+
getWatcherServiceFunction: watcherService,
|
|
206
|
+
},
|
|
207
|
+
imagePullSecret,
|
|
208
|
+
);
|
|
197
209
|
const zarfPath = resolve(outputDir, "zarf.yaml");
|
|
198
210
|
|
|
199
211
|
let localZarf = "";
|
|
@@ -206,7 +218,7 @@ export async function generateYamlAndWriteToDisk(obj: {
|
|
|
206
218
|
await fs.writeFile(zarfPath, localZarf);
|
|
207
219
|
|
|
208
220
|
await assets.generateHelmChart(webhookConfigGenerator, getWatcher, getModuleSecret, outputDir);
|
|
209
|
-
console.info(
|
|
221
|
+
console.info(`K8s resource for the module saved to ${yamlPath}`);
|
|
210
222
|
} catch (error) {
|
|
211
223
|
console.error(`Error generating YAML: ${error}`);
|
|
212
224
|
process.exit(1);
|
package/src/cli/build.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { promises as fs } from "fs";
|
|
|
7
7
|
import { basename, dirname, extname, resolve } from "path";
|
|
8
8
|
import { Assets } from "../lib/assets/assets";
|
|
9
9
|
import { dependencies, version } from "./init/templates";
|
|
10
|
-
import {
|
|
10
|
+
import { Command } from "commander";
|
|
11
11
|
import { Option } from "commander";
|
|
12
12
|
import { parseTimeout } from "../lib/helpers";
|
|
13
13
|
import { peprFormat } from "./format";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
watchForChanges,
|
|
17
17
|
determineRbacMode,
|
|
18
18
|
assignImage,
|
|
19
|
-
|
|
19
|
+
createOutputDirectory,
|
|
20
20
|
handleValidCapabilityNames,
|
|
21
21
|
handleCustomImageBuild,
|
|
22
22
|
validImagePullSecret,
|
|
@@ -64,71 +64,61 @@ type BuildModuleReturn = {
|
|
|
64
64
|
uuid: string;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export default function (program:
|
|
67
|
+
export default function (program: Command): void {
|
|
68
68
|
program
|
|
69
69
|
.command("build")
|
|
70
70
|
.description("Build a Pepr Module for deployment")
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
.addOption(
|
|
72
|
+
new Option("-M, --rbac-mode <mode>", "Override module config and set RBAC mode.").choices([
|
|
73
|
+
"admin",
|
|
74
|
+
"scoped",
|
|
75
|
+
]),
|
|
75
76
|
)
|
|
76
77
|
.addOption(
|
|
77
78
|
new Option(
|
|
78
|
-
"-
|
|
79
|
-
"
|
|
80
|
-
).conflicts(["
|
|
79
|
+
"-I, --registry-info <registry/username>",
|
|
80
|
+
"Provide the image registry and username for building and pushing a custom WASM container. Requires authentication. Conflicts with --custom-image and --registry. Builds and pushes `'<registry/username>/custom-pepr-controller:<current-version>'`.",
|
|
81
|
+
).conflicts(["customImage", "registry"]),
|
|
81
82
|
)
|
|
83
|
+
.option("-P, --with-pull-secret <name>", "Use image pull secret for controller Deployment.", "")
|
|
82
84
|
.addOption(
|
|
83
85
|
new Option(
|
|
84
|
-
"-
|
|
85
|
-
"
|
|
86
|
-
)
|
|
86
|
+
"-c, --custom-name <name>",
|
|
87
|
+
"Set name for zarf component and service monitors in helm charts.",
|
|
88
|
+
),
|
|
87
89
|
)
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
.option("-e, --entry-point <file>", "Specify the entry point file to build with.", peprTS)
|
|
91
|
+
.addOption(
|
|
92
|
+
new Option(
|
|
93
|
+
"-i, --custom-image <image>",
|
|
94
|
+
"Specify a custom image with version for deployments. Conflicts with --registry-info and --registry. Example: 'docker.io/username/custom-pepr-controller:v1.0.0'",
|
|
95
|
+
).conflicts(["registryInfo", "registry"]),
|
|
94
96
|
)
|
|
95
97
|
.option(
|
|
96
|
-
"--
|
|
97
|
-
"
|
|
98
|
-
"",
|
|
98
|
+
"-n, --no-embed",
|
|
99
|
+
"Disable embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM.",
|
|
99
100
|
)
|
|
100
|
-
|
|
101
|
+
.option("-o, --output <directory>", "Set output directory.", "dist")
|
|
101
102
|
.addOption(
|
|
102
103
|
new Option(
|
|
103
|
-
"--registry <GitHub|Iron Bank>",
|
|
104
|
-
"Container registry: Choose container registry for deployment manifests.
|
|
104
|
+
"-r, --registry <GitHub|Iron Bank>",
|
|
105
|
+
"Container registry: Choose container registry for deployment manifests. Conflicts with --custom-image and --registry-info.",
|
|
105
106
|
)
|
|
106
107
|
.conflicts(["customImage", "registryInfo"])
|
|
107
108
|
.choices(["GitHub", "Iron Bank"]),
|
|
108
109
|
)
|
|
109
|
-
|
|
110
|
+
.option(
|
|
111
|
+
"-t, --timeout <seconds>",
|
|
112
|
+
"How long the API server should wait for a webhook to respond before treating the call as a failure.",
|
|
113
|
+
parseTimeout,
|
|
114
|
+
)
|
|
110
115
|
.addOption(
|
|
111
|
-
new Option(
|
|
112
|
-
"-z, --zarf [manifest|chart]",
|
|
113
|
-
"Zarf package type: manifest, chart (default: manifest)",
|
|
114
|
-
)
|
|
116
|
+
new Option("-z, --zarf <manifest|chart>", "Set Zarf package type")
|
|
115
117
|
.choices(["manifest", "chart"])
|
|
116
118
|
.default("manifest"),
|
|
117
119
|
)
|
|
118
|
-
.addOption(
|
|
119
|
-
new Option("--rbac-mode [admin|scoped]", "Rbac Mode: admin, scoped (default: admin)").choices(
|
|
120
|
-
["admin", "scoped"],
|
|
121
|
-
),
|
|
122
|
-
)
|
|
123
|
-
.addOption(
|
|
124
|
-
new Option(
|
|
125
|
-
"--custom-name [name]",
|
|
126
|
-
"Specify a custom name for zarf component and service monitors in helm charts.",
|
|
127
|
-
),
|
|
128
|
-
)
|
|
129
120
|
.action(async opts => {
|
|
130
|
-
|
|
131
|
-
outputDir = await handleCustomOutputDir(opts.outputDir);
|
|
121
|
+
outputDir = await createOutputDirectory(opts.output);
|
|
132
122
|
|
|
133
123
|
// Build the module
|
|
134
124
|
const buildModuleResult = await buildModule(undefined, opts.entryPoint, opts.embed);
|
|
@@ -166,7 +156,7 @@ export default function (program: RootCmd): void {
|
|
|
166
156
|
|
|
167
157
|
// If building without embedding, exit after building
|
|
168
158
|
if (!opts.embed) {
|
|
169
|
-
console.info(
|
|
159
|
+
console.info(`Module built successfully at ${path}`);
|
|
170
160
|
return;
|
|
171
161
|
}
|
|
172
162
|
|
|
@@ -286,7 +276,7 @@ export async function buildModule(
|
|
|
286
276
|
build.onEnd(async r => {
|
|
287
277
|
// Print the build size analysis
|
|
288
278
|
if (r?.metafile) {
|
|
289
|
-
console.
|
|
279
|
+
console.info(await analyzeMetafile(r.metafile));
|
|
290
280
|
}
|
|
291
281
|
|
|
292
282
|
// If we're in dev mode, call the reloader function
|
|
@@ -343,7 +333,7 @@ function handleModuleBuildError(e: BuildModuleResult): void {
|
|
|
343
333
|
const out = e.stdout.toString() as string;
|
|
344
334
|
const err = e.stderr.toString();
|
|
345
335
|
|
|
346
|
-
console.
|
|
336
|
+
console.info(out);
|
|
347
337
|
console.error(err);
|
|
348
338
|
|
|
349
339
|
// Check for version conflicts
|
|
@@ -377,7 +367,7 @@ export async function checkFormat(): Promise<void> {
|
|
|
377
367
|
const validFormat = await peprFormat(true);
|
|
378
368
|
|
|
379
369
|
if (!validFormat) {
|
|
380
|
-
console.
|
|
370
|
+
console.info(
|
|
381
371
|
"\x1b[33m%s\x1b[0m",
|
|
382
372
|
"Formatting errors were found. The build will continue, but you may want to run `npx pepr format` to address any issues.",
|
|
383
373
|
);
|
package/src/cli/crd/create.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
|
|
4
|
-
import { Command } from "commander";
|
|
4
|
+
import { Command, Option } from "commander";
|
|
5
5
|
import { createDirectoryIfNotExists } from "../../lib/filesystemService";
|
|
6
6
|
import { promises as fs } from "fs";
|
|
7
7
|
import path from "path";
|
|
@@ -9,20 +9,22 @@ import path from "path";
|
|
|
9
9
|
// Scaffolds a new CRD TypeScript definition
|
|
10
10
|
const create = new Command("create")
|
|
11
11
|
.description("Create a new CRD TypeScript definition")
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
validateScope,
|
|
20
|
-
"Namespaced",
|
|
12
|
+
.addOption(
|
|
13
|
+
new Option(
|
|
14
|
+
"-S, --scope <scope>",
|
|
15
|
+
"Whether the resulting custom resource is cluster- or namespace-scoped",
|
|
16
|
+
)
|
|
17
|
+
.choices(["Namespaced", "Cluster"])
|
|
18
|
+
.default("Namespaced"),
|
|
21
19
|
)
|
|
22
|
-
.option("--
|
|
23
|
-
.
|
|
20
|
+
.option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev")
|
|
21
|
+
.requiredOption("-g, --group <group>", "API group (e.g. cache)")
|
|
22
|
+
.requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)")
|
|
23
|
+
.option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)")
|
|
24
|
+
.requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)", "")
|
|
25
|
+
.requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)")
|
|
24
26
|
.action(async ({ group, version, kind, domain, scope, plural, shortName }) => {
|
|
25
|
-
console.log("This feature is currently in alpha
|
|
27
|
+
console.log("This feature is currently in alpha.");
|
|
26
28
|
const outputDir = path.resolve(`./api/${version}`);
|
|
27
29
|
await createDirectoryIfNotExists(outputDir);
|
|
28
30
|
|
|
@@ -125,10 +127,3 @@ type ${kind}StatusCondition = {
|
|
|
125
127
|
|
|
126
128
|
`;
|
|
127
129
|
};
|
|
128
|
-
|
|
129
|
-
export function validateScope(value: string): "Cluster" | "Namespaced" {
|
|
130
|
-
if (value !== "Cluster" && value !== "Namespaced") {
|
|
131
|
-
throw new Error("Scope must be either 'Cluster' or 'Namespaced'");
|
|
132
|
-
}
|
|
133
|
-
return value;
|
|
134
|
-
}
|