pepr 0.51.6-nightly.1 → 0.51.6-nightly.10
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.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/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 +254 -166
- 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 +17 -2
- package/src/cli/build.ts +29 -41
- package/src/cli/crd/create.ts +14 -19
- package/src/cli/crd/generate.ts +1 -1
- package/src/cli/crd/index.ts +2 -2
- package/src/cli/deploy.ts +15 -15
- package/src/cli/dev.ts +8 -8
- package/src/cli/format/index.ts +3 -3
- package/src/cli/init/index.ts +12 -9
- package/src/cli/init/walkthrough.ts +2 -4
- package/src/cli/kfc.ts +2 -2
- package/src/cli/monitor.ts +2 -2
- package/src/cli/update/index.ts +3 -4
- 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.51.6-nightly.
|
|
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.51.6-nightly.10", 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,YAAY,EAAE,MAAM,UAAU,CAAC;A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AAO,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.51.6-nightly.
|
|
19
|
+
"version": "0.51.6-nightly.10",
|
|
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;
|
|
@@ -193,7 +199,16 @@ export async function generateYamlAndWriteToDisk(obj: {
|
|
|
193
199
|
const chartPath = `${uuid}-chart`;
|
|
194
200
|
const yamlPath = resolve(outputDir, yamlFile);
|
|
195
201
|
try {
|
|
196
|
-
const yaml = await assets.allYaml(
|
|
202
|
+
const yaml = await assets.allYaml(
|
|
203
|
+
generateAllYaml,
|
|
204
|
+
{
|
|
205
|
+
getDeploymentFunction: getDeployment,
|
|
206
|
+
getWatcherFunction: getWatcher,
|
|
207
|
+
getServiceFunction: service,
|
|
208
|
+
getWatcherServiceFunction: watcherService,
|
|
209
|
+
},
|
|
210
|
+
imagePullSecret,
|
|
211
|
+
);
|
|
197
212
|
const zarfPath = resolve(outputDir, "zarf.yaml");
|
|
198
213
|
|
|
199
214
|
let localZarf = "";
|
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";
|
|
@@ -64,71 +64,59 @@ 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
|
-
"-n, --no-embed",
|
|
74
|
-
"Disables embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM.",
|
|
71
|
+
.addOption(
|
|
72
|
+
new Option("-M, --rbac-mode <admin|scoped>", "Set RBAC mode.").choices(["admin", "scoped"]),
|
|
75
73
|
)
|
|
76
74
|
.addOption(
|
|
77
75
|
new Option(
|
|
78
|
-
"-
|
|
79
|
-
"
|
|
80
|
-
).conflicts(["
|
|
76
|
+
"-I, --registry-info <registry/username>",
|
|
77
|
+
"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>'`.",
|
|
78
|
+
).conflicts(["customImage", "registry"]),
|
|
81
79
|
)
|
|
80
|
+
.option("-P, --with-pull-secret <name>", "Use image pull secret for controller Deployment.", "")
|
|
82
81
|
.addOption(
|
|
83
82
|
new Option(
|
|
84
|
-
"-
|
|
85
|
-
"
|
|
86
|
-
)
|
|
83
|
+
"-c, --custom-name <name>",
|
|
84
|
+
"Set name for zarf component and service monitors in helm charts.",
|
|
85
|
+
),
|
|
87
86
|
)
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
.option("-e, --entry-point <file>", "Specify the entry point file to build with.", peprTS)
|
|
88
|
+
.addOption(
|
|
89
|
+
new Option(
|
|
90
|
+
"-i, --custom-image <image>",
|
|
91
|
+
"Specify a custom image with version for deployments. Conflicts with --registry-info and --registry. Example: 'docker.io/username/custom-pepr-controller:v1.0.0'",
|
|
92
|
+
).conflicts(["registryInfo", "registry"]),
|
|
94
93
|
)
|
|
95
94
|
.option(
|
|
96
|
-
"--
|
|
97
|
-
"
|
|
98
|
-
"",
|
|
95
|
+
"-n, --no-embed",
|
|
96
|
+
"Disable embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM.",
|
|
99
97
|
)
|
|
100
|
-
|
|
98
|
+
.option("-o, --output <directory>", "Set output directory.")
|
|
101
99
|
.addOption(
|
|
102
100
|
new Option(
|
|
103
|
-
"--registry <GitHub|Iron Bank>",
|
|
104
|
-
"Container registry: Choose container registry for deployment manifests.
|
|
101
|
+
"-r, --registry <GitHub|Iron Bank>",
|
|
102
|
+
"Container registry: Choose container registry for deployment manifests. Conflicts with --custom-image and --registry-info.",
|
|
105
103
|
)
|
|
106
104
|
.conflicts(["customImage", "registryInfo"])
|
|
107
105
|
.choices(["GitHub", "Iron Bank"]),
|
|
108
106
|
)
|
|
109
|
-
|
|
107
|
+
.option(
|
|
108
|
+
"-t, --timeout <seconds>",
|
|
109
|
+
"How long the API server should wait for a webhook to respond before treating the call as a failure.",
|
|
110
|
+
parseTimeout,
|
|
111
|
+
)
|
|
110
112
|
.addOption(
|
|
111
|
-
new Option(
|
|
112
|
-
"-z, --zarf [manifest|chart]",
|
|
113
|
-
"Zarf package type: manifest, chart (default: manifest)",
|
|
114
|
-
)
|
|
113
|
+
new Option("-z, --zarf <manifest|chart>", "Set Zarf package type")
|
|
115
114
|
.choices(["manifest", "chart"])
|
|
116
115
|
.default("manifest"),
|
|
117
116
|
)
|
|
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
117
|
.action(async opts => {
|
|
130
118
|
// assign custom output directory if provided
|
|
131
|
-
outputDir = await handleCustomOutputDir(opts.
|
|
119
|
+
outputDir = await handleCustomOutputDir(opts.output);
|
|
132
120
|
|
|
133
121
|
// Build the module
|
|
134
122
|
const buildModuleResult = await buildModule(undefined, opts.entryPoint, opts.embed);
|
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,18 +9,20 @@ 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
|
+
.option("-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
27
|
console.log("This feature is currently in alpha.\n");
|
|
26
28
|
const outputDir = path.resolve(`./api/${version}`);
|
|
@@ -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
|
-
}
|
package/src/cli/crd/generate.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { WarningMessages, ErrorMessages } from "./messages";
|
|
|
21
21
|
|
|
22
22
|
export default new Command("generate")
|
|
23
23
|
.description("Generate CRD manifests from TypeScript definitions")
|
|
24
|
-
.option("--output <
|
|
24
|
+
.option("-o, --output <directory>", "Output directory for generated CRDs", "./crds")
|
|
25
25
|
.action(generateCRDs);
|
|
26
26
|
|
|
27
27
|
export function extractCRDDetails(
|
package/src/cli/crd/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Command } from "commander";
|
|
5
5
|
import createCmd from "./create";
|
|
6
6
|
import generateCmd from "./generate";
|
|
7
7
|
|
|
8
|
-
export default function (program:
|
|
8
|
+
export default function (program: Command): void {
|
|
9
9
|
const crd = program
|
|
10
10
|
.command("crd")
|
|
11
11
|
.description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions");
|
package/src/cli/deploy.ts
CHANGED
|
@@ -5,7 +5,7 @@ import prompt from "prompts";
|
|
|
5
5
|
import { CapabilityExport } from "../lib/types";
|
|
6
6
|
import { Assets } from "../lib/assets/assets";
|
|
7
7
|
import { ImagePullSecret } from "../lib/types";
|
|
8
|
-
import {
|
|
8
|
+
import { Command } from "commander";
|
|
9
9
|
import { buildModule } from "./build";
|
|
10
10
|
import { deployImagePullSecret, deployWebhook } from "../lib/assets/deploy";
|
|
11
11
|
import { namespaceDeploymentsReady } from "../lib/deploymentChecks";
|
|
@@ -79,19 +79,19 @@ function generateImagePullSecret(details: ValidatedImagePullSecretDetails): Imag
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export async function getUserConfirmation(opts: {
|
|
83
|
-
if (opts.
|
|
82
|
+
export async function getUserConfirmation(opts: { yes: boolean }): Promise<boolean> {
|
|
83
|
+
if (opts.yes) {
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// Prompt the user to confirm
|
|
88
|
-
const
|
|
88
|
+
const confirmation = await prompt({
|
|
89
89
|
type: "confirm",
|
|
90
|
-
name: "
|
|
90
|
+
name: "yes",
|
|
91
91
|
message: "This will remove and redeploy the module. Continue?",
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
return
|
|
94
|
+
return confirmation.yes ? true : false;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
async function buildAndDeployModule(image: string, force: boolean): Promise<void> {
|
|
@@ -126,18 +126,18 @@ async function buildAndDeployModule(image: string, force: boolean): Promise<void
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export default function (program:
|
|
129
|
+
export default function (program: Command): void {
|
|
130
130
|
program
|
|
131
131
|
.command("deploy")
|
|
132
132
|
.description("Deploy a Pepr Module")
|
|
133
|
-
.option("-
|
|
134
|
-
.option("--
|
|
135
|
-
.option("--
|
|
136
|
-
.option("--docker-
|
|
137
|
-
.option("
|
|
138
|
-
.option("
|
|
139
|
-
.option("--
|
|
140
|
-
.option("--
|
|
133
|
+
.option("-E, --docker-email <email>", "Email for Docker registry.")
|
|
134
|
+
.option("-P, --docker-password <password>", "Password for Docker registry.")
|
|
135
|
+
.option("-S, --docker-server <server>", "Docker server address.")
|
|
136
|
+
.option("-U, --docker-username <username>", "Docker registry username.")
|
|
137
|
+
.option("-f, --force", "Force deploy the module, override manager field.")
|
|
138
|
+
.option("-i, --image <image>", "Override the image tag.")
|
|
139
|
+
.option("-p, --pull-secret <name>", "Deploy imagePullSecret for Controller private registry.")
|
|
140
|
+
.option("-y, --yes", "Skip confirmation prompts.")
|
|
141
141
|
.action(async opts => {
|
|
142
142
|
const valResp = validateImagePullSecretDetails(opts);
|
|
143
143
|
if (!valResp.valid) {
|