pepr 0.51.6-nightly.9 → 0.52.0-nightly.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.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/generate.d.ts.map +1 -1
- package/dist/cli/format/index.d.ts.map +1 -1
- package/dist/cli/kfc.d.ts.map +1 -1
- package/dist/cli/update/index.d.ts.map +1 -1
- package/dist/cli.js +56 -44
- package/dist/controller.js +1 -1
- package/dist/lib/assets/helm.d.ts.map +1 -1
- package/dist/lib/assets/yaml/overridesFile.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cli/build.helpers.ts +9 -12
- package/src/cli/build.ts +11 -9
- package/src/cli/crd/create.ts +2 -2
- package/src/cli/crd/generate.ts +8 -5
- package/src/cli/deploy.ts +1 -1
- package/src/cli/format/index.ts +2 -1
- package/src/cli/kfc.ts +15 -11
- package/src/cli/update/index.ts +8 -7
- package/src/lib/assets/helm.ts +6 -0
- package/src/lib/assets/yaml/overridesFile.ts +2 -0
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,YAAY,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAKnF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAc5C,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACjF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,EACV,MAAM,GACN,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,KAAK,GACL,MAAM,GACN,UAAU,CACb,GAAG;IACF,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,gBAAgB,CAAC,GAAG;IACpE,IAAI,EAAE,gBAAgB,GAAG;QACvB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAKnF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAc5C,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACjF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,EACV,MAAM,GACN,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,KAAK,GACL,MAAM,GACN,UAAU,CACb,GAAG;IACF,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,gBAAgB,CAAC,GAAG;IACpE,IAAI,EAAE,gBAAgB,GAAG;QACvB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CA8H/C;AAWD,wBAAsB,UAAU,CAAC,UAAU,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuC/E;AAED,wBAAsB,WAAW,CAC/B,QAAQ,CAAC,EAAE,QAAQ,EACnB,UAAU,SAAS,EACnB,KAAK,UAAO,GACX,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAwEnC;AA6CD,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CASjD"}
|
|
@@ -37,7 +37,7 @@ export declare function determineRbacMode(opts: {
|
|
|
37
37
|
* @param outputDir the desired output directory
|
|
38
38
|
* @returns The desired output directory or the default one
|
|
39
39
|
*/
|
|
40
|
-
export declare function
|
|
40
|
+
export declare function createOutputDirectory(outputDir: string): Promise<string>;
|
|
41
41
|
/**
|
|
42
42
|
* Check if the image is from Iron Bank and return the correct image
|
|
43
43
|
* @param registry The registry of the image
|
|
@@ -1 +1 @@
|
|
|
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,sBAAsB,CAAC;AAc9C,UAAU,YAAY;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAe9D;AAED,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,
|
|
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,sBAAsB,CAAC;AAc9C,UAAU,YAAY;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAe9D;AAED,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,CAS9E;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;;;;;;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;;;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,CAiChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EAEpB,IAAI,EACJ,UAAU,EACV,IAAI,EACL,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;;AAG5D,wBAKwB;AAExB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GACrB;IACD,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAYA;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAInF;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,IAAI,CAiCN;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3F;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,CA2BA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAQtD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB,GAAG;IACpF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAuBA;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CAc7D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CA0B/D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,IAAI;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAEA;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACjD,eAAe,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACvD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,CAAC,CAAC,wBAAwB,CA0DtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/format/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/format/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAc/C;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAoCxE"}
|
package/dist/cli/kfc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kfc.d.ts","sourceRoot":"","sources":["../../src/cli/kfc.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"kfc.d.ts","sourceRoot":"","sources":["../../src/cli/kfc.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAwC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/update/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/update/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CA2E/C"}
|
package/dist/cli.js
CHANGED
|
@@ -7530,6 +7530,9 @@ function watcherDeployTemplate(buildTimestamp, type) {
|
|
|
7530
7530
|
labels:
|
|
7531
7531
|
app: {{ .Values.uuid }}-watcher
|
|
7532
7532
|
pepr.dev/controller: watcher
|
|
7533
|
+
{{- if .Values.watcher.podLabels }}
|
|
7534
|
+
{{- toYaml .Values.watcher.podLabels | nindent 8 }}
|
|
7535
|
+
{{- end }}
|
|
7533
7536
|
spec:
|
|
7534
7537
|
terminationGracePeriodSeconds: {{ .Values.watcher.terminationGracePeriodSeconds }}
|
|
7535
7538
|
serviceAccountName: {{ .Values.uuid }}
|
|
@@ -7625,6 +7628,9 @@ function admissionDeployTemplate(buildTimestamp, type) {
|
|
|
7625
7628
|
labels:
|
|
7626
7629
|
app: {{ .Values.uuid }}
|
|
7627
7630
|
pepr.dev/controller: admission
|
|
7631
|
+
{{- if .Values.admission.podLabels }}
|
|
7632
|
+
{{- toYaml .Values.admission.podLabels | nindent 8 }}
|
|
7633
|
+
{{- end }}
|
|
7628
7634
|
spec:
|
|
7629
7635
|
{{- if or .Values.admission.antiAffinity .Values.admission.affinity }}
|
|
7630
7636
|
affinity:
|
|
@@ -8193,6 +8199,7 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
|
|
|
8193
8199
|
}
|
|
8194
8200
|
},
|
|
8195
8201
|
podAnnotations: {},
|
|
8202
|
+
podLabels: {},
|
|
8196
8203
|
nodeSelector: {},
|
|
8197
8204
|
tolerations: [],
|
|
8198
8205
|
extraVolumeMounts: [],
|
|
@@ -8265,6 +8272,7 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
|
|
|
8265
8272
|
extraVolumes: [],
|
|
8266
8273
|
affinity: {},
|
|
8267
8274
|
podAnnotations: {},
|
|
8275
|
+
podLabels: {},
|
|
8268
8276
|
serviceMonitor: {
|
|
8269
8277
|
enabled: false,
|
|
8270
8278
|
labels: {},
|
|
@@ -8867,7 +8875,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
|
|
|
8867
8875
|
var readmeMd = '# Pepr Module\n\nThis is a Pepr Module. [Pepr](https://github.com/defenseunicorns/pepr) is a type-safe Kubernetes middleware system.\n\nThe `capabilities` directory contains all the capabilities for this module. By default,\na capability is a single typescript file in the format of `capability-name.ts` that is\nimported in the root `pepr.ts` file as `import { HelloPepr } from "./capabilities/hello-pepr";`.\nBecause this is typescript, you can organize this however you choose, e.g. creating a sub-folder\nper-capability or common logic in shared files or folders.\n\nExample Structure:\n\n```text\nModule Root\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pepr.ts\n\u2514\u2500\u2500 capabilities\n \u251C\u2500\u2500 example-one.ts\n \u251C\u2500\u2500 example-three.ts\n \u2514\u2500\u2500 example-two.ts\n```\n';
|
|
8868
8876
|
var peprTS = 'import { PeprModule } from "pepr";\n// cfg loads your pepr configuration from package.json\nimport cfg from "./package.json";\n\n// HelloPepr is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\nimport { HelloPepr } from "./capabilities/hello-pepr";\n\n/**\n * This is the main entrypoint for this Pepr module. It is run when the module is started.\n * This is where you register your Pepr configurations and capabilities.\n */\nnew PeprModule(cfg, [\n // "HelloPepr" is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\n HelloPepr,\n\n // Your additional capabilities go here\n]);\n';
|
|
8869
8877
|
var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\nimport { MockAgent, setGlobalDispatcher } from "undici";\n\n/**\n * The HelloPepr Capability is an example capability to demonstrate some general concepts of Pepr.\n * To test this capability you run `pepr dev`and then run the following command:\n * `kubectl apply -f capabilities/hello-pepr.samples.yaml`\n */\nexport const HelloPepr = new Capability({\n name: "hello-pepr",\n description: "A simple example capability to show how things work.",\n namespaces: ["pepr-demo", "pepr-demo-2"],\n});\n\n// Use the \'When\' function to create a new action, use \'Store\' to persist data\nconst { When, Store } = HelloPepr;\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action removes the label `remove-me` when a Namespace is created.\n * Note we don\'t need to specify the namespace here, because we\'ve already specified\n * it in the Capability definition above.\n */\nWhen(a.Namespace)\n .IsCreated()\n .Mutate(ns => ns.RemoveLabel("remove-me"));\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Watch Action with K8s SSA (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action watches for the `pepr-demo-2` namespace to be created, then creates a ConfigMap with\n * the name `pepr-ssa-demo` and adds the namespace UID to the ConfigMap data. Because Pepr uses\n * server-side apply for this operation, the ConfigMap will be created or updated if it already exists.\n */\nWhen(a.Namespace)\n .IsCreated()\n .WithName("pepr-demo-2")\n .Watch(async ns => {\n Log.info("Namespace pepr-demo-2 was created.");\n\n try {\n // Apply the ConfigMap using K8s server-side apply\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: "pepr-ssa-demo",\n namespace: "pepr-demo-2",\n },\n data: {\n "ns-uid": ns.metadata.uid,\n },\n });\n } catch (error) {\n // You can use the Log object to log messages to the Pepr controller pod\n Log.error(error, "Failed to apply ConfigMap using server-side apply.");\n }\n\n // You can share data between actions using the Store, including between different types of actions\n Store.setItem("watch-data", "This data was stored by a Watch Action.");\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 1) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is a single action. They can be in the same file or put imported from other files.\n * In this example, when a ConfigMap is created with the name `example-1`, then add a label and annotation.\n *\n * Equivalent to manually running:\n * `kubectl label configmap example-1 pepr=was-here`\n * `kubectl annotate configmap example-1 pepr.dev=annotations-work-too`\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.SetLabel("pepr", "was-here").SetAnnotation("pepr.dev", "annotations-work-too");\n\n // Use the Store to persist data between requests and Pepr controller pods\n Store.setItem("example-1", "was-here");\n\n // This data is written asynchronously and can be read back via `Store.getItem()` or `Store.subscribe()`\n Store.setItem("example-1-data", JSON.stringify(request.Raw.data));\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate & Validate Actions (CM Example 2) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This combines 3 different types of actions: \'Mutate\', \'Validate\', and \'Watch\'. The order\n * of the actions is required, but each action is optional. In this example, when a ConfigMap is created\n * with the name `example-2`, then add a label and annotation, validate that the ConfigMap has the label\n * `pepr`, and log the request.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n // This Mutate Action will mutate the request before it is persisted to the cluster\n\n // Use `request.Merge()` to merge the new data with the existing data\n request.Merge({\n metadata: {\n labels: {\n pepr: "was-here",\n },\n annotations: {\n "pepr.dev": "annotations-work-too",\n },\n },\n });\n })\n .Validate(request => {\n // This Validate Action will validate the request before it is persisted to the cluster\n\n // Approve the request if the ConfigMap has the label \'pepr\'\n if (request.HasLabel("pepr")) {\n return request.Approve();\n }\n\n // Otherwise, deny the request with an error message (optional)\n return request.Deny("ConfigMap must have label \'pepr\'");\n })\n .Watch((cm, phase) => {\n // This Watch Action will watch the ConfigMap after it has been persisted to the cluster\n Log.info(cm, `ConfigMap was ${phase} with the name example-2`);\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 2a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action shows a simple validation that will deny any ConfigMap that has the\n * annotation `evil`. Note that the `Deny()` function takes an optional second parameter that is a\n * user-defined status code to return.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .Validate(request => {\n if (request.HasAnnotation("evil")) {\n return request.Deny("No evil CM annotations allowed.", 400);\n }\n\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 3) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action combines different styles. Unlike the previous actions, this one will look\n * for any ConfigMap in the `pepr-demo` namespace that has the label `change=by-label` during either\n * CREATE or UPDATE. Note that all conditions added such as `WithName()`, `WithLabel()`, `InNamespace()`,\n * are ANDs so all conditions must be true for the request to be processed.\n */\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("change", "by-label")\n .Mutate(request => {\n // The K8s object e are going to mutate\n const cm = request.Raw;\n\n // Get the username and uid of the K8s request\n const { username, uid } = request.Request.userInfo;\n\n // Store some data about the request in the configmap\n cm.data["username"] = username;\n cm.data["uid"] = uid;\n\n // You can still mix other ways of making changes too\n request.SetAnnotation("pepr.dev", "making-waves");\n });\n\n// This action validates the label `change=by-label` is deleted\nWhen(a.ConfigMap)\n .IsDeleted()\n .WithLabel("change", "by-label")\n .Validate(request => {\n // Log and then always approve the request\n Log.info("CM with label \'change=by-label\' was deleted.");\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action show how you can use the `Mutate()` function without an inline function.\n * This is useful if you want to keep your actions small and focused on a single task,\n * or if you want to reuse the same function in multiple actions.\n */\nWhen(a.ConfigMap).IsCreated().WithName("example-4").Mutate(example4Cb);\n\n// This function uses the complete type definition, but is not required.\nfunction example4Cb(cm: PeprMutateRequest<a.ConfigMap>): void {\n cm.SetLabel("pepr.dev/first", "true");\n cm.SetLabel("pepr.dev/second", "true");\n cm.SetLabel("pepr.dev/third", "true");\n}\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is the same as Example 4, except this only operates on a CM in the `pepr-demo-2` namespace.\n * Note because the Capability defines namespaces, the namespace specified here must be one of those.\n * Alternatively, you can remove the namespace from the Capability definition and specify it here.\n */\nWhen(a.ConfigMap).IsCreated().InNamespace("pepr-demo-2").WithName("example-4a").Mutate(example4Cb);\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 5) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action is a bit more complex. It will look for any ConfigMap in the `pepr-demo`\n * namespace that has the label `chuck-norris` during CREATE. When it finds one, it will fetch a\n * random Chuck Norris joke from the API and add it to the ConfigMap. This is a great example of how\n * you can use Pepr to make changes to your K8s objects based on external data.\n *\n * Note the use of the `async` keyword. This is required for any action that uses `await` or `fetch()`.\n *\n * Also note we are passing a type to the `fetch()` function. This is optional, but it will help you\n * avoid mistakes when working with the data returned from the API. You can also use the `as` keyword to\n * cast the data returned from the API.\n *\n * These are equivalent:\n * ```ts\n * const joke = await fetch<TheChuckNorrisJoke>("https://icanhazdadjoke.com/");\n * const joke = await fetch("https://icanhazdadjoke.com/") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://icanhazdadjoke.com")\n * ```\n */\ninterface TheChuckNorrisJoke {\n id: string;\n joke: string;\n status: number;\n}\n\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("chuck-norris")\n .Mutate(cm => cm.SetLabel("got-jokes", "true"))\n .Watch(async cm => {\n const jokeURL = "https://icanhazdadjoke.com";\n\n const mockAgent: MockAgent = new MockAgent();\n setGlobalDispatcher(mockAgent);\n const mockClient = mockAgent.get(jokeURL);\n mockClient.intercept({ path: "/", method: "GET" }).reply(\n 200,\n {\n id: "R7UfaahVfFd",\n joke: "Funny joke goes here.",\n status: 200,\n },\n {\n headers: {\n "Content-Type": "application/json; charset=utf-8",\n },\n },\n );\n\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(jokeURL, {\n headers: {\n Accept: "application/json",\n },\n });\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n const { joke } = response.data;\n // Add Joke to the Store\n await Store.setItemAndWait(jokeURL, joke);\n // Add the Chuck Norris joke to the configmap\n try {\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: cm.metadata.name,\n namespace: cm.metadata.namespace,\n },\n data: {\n "chuck-says": Store.getItem(jokeURL),\n },\n });\n } catch (error) {\n Log.error(error, "Failed to apply ConfigMap using server-side apply.", {\n cm,\n });\n }\n }\n\n // You can also assert on different HTTP response codes\n if (response.status === fetchStatus.NOT_FOUND) {\n // Do something else\n return;\n }\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Secret Base64 Handling) *\n * ---------------------------------------------------------------------------------------------------\n *\n * The K8s JS client provides incomplete support for base64 encoding/decoding handling for secrets,\n * unlike the GO client. To make this less painful, Pepr automatically handles base64 encoding/decoding\n * secret data before and after the action is executed.\n */\nWhen(a.Secret)\n .IsCreated()\n .WithName("secret-1")\n .Mutate(request => {\n const secret = request.Raw;\n\n // This will be encoded at the end of all processing back to base64: "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="\n secret.data.magic = "change-without-encoding";\n\n // You can modify the data directly, and it will be encoded at the end of all processing\n secret.data.example += " - modified by Pepr";\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Untyped Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * Out of the box, Pepr supports all the standard Kubernetes objects. However, you can also create\n * your own types. This is useful if you are working with an Operator that creates custom resources.\n * There are two ways to do this, the first is to use the `When()` function with a `GenericKind`,\n * the second is to create a new class that extends `GenericKind` and use the `RegisterKind()` function.\n *\n * This example shows how to use the `When()` function with a `GenericKind`. Note that you\n * must specify the `group`, `version`, and `kind` of the object (if applicable). This is how Pepr knows\n * if the action should be triggered or not. Since we are using a `GenericKind`,\n * Pepr will not be able to provide any intellisense for the object, so you will need to refer to the\n * Kubernetes API documentation for the object you are working with.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-1\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```\n */\nWhen(a.GenericKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n})\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr without type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Typed Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This example shows how to use the `RegisterKind()` function to create a new type. This is useful\n * if you are working with an Operator that creates custom resources and you want to have intellisense\n * for the object. Note that you must specify the `group`, `version`, and `kind` of the object (if applicable)\n * as this is how Pepr knows if the action should be triggered or not.\n *\n * Once you register a new Kind with Pepr, you can use the `When()` function with the new Kind. Ideally,\n * you should register custom Kinds at the top of your Capability file or Pepr Module so they are available\n * to all actions, but we are putting it here for demonstration purposes.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-2\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```*\n */\nclass UnicornKind extends a.GenericKind {\n spec: {\n /**\n * JSDoc comments can be added to explain more details about the field.\n *\n * @example\n * ```ts\n * request.Raw.spec.message = "Hello Pepr!";\n * ```\n * */\n message: string;\n counter: number;\n };\n}\n\nRegisterKind(UnicornKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n});\n\nWhen(UnicornKind)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr with type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * A callback function that is called once the Pepr Store is fully loaded.\n */\nStore.onReady(data => {\n Log.info(data, "Pepr Store Ready");\n});\n';
|
|
8870
|
-
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.
|
|
8878
|
+
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-nightly.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" } };
|
|
8871
8879
|
|
|
8872
8880
|
// src/cli/init/utils.ts
|
|
8873
8881
|
var import_fs4 = require("fs");
|
|
@@ -9066,7 +9074,7 @@ async function peprFormat(validateOnly) {
|
|
|
9066
9074
|
const formatter = await eslint2.loadFormatter("stylish");
|
|
9067
9075
|
const resultText = await formatter.format(results, {});
|
|
9068
9076
|
if (resultText) {
|
|
9069
|
-
|
|
9077
|
+
logger_default.info(resultText);
|
|
9070
9078
|
}
|
|
9071
9079
|
if (!validateOnly) {
|
|
9072
9080
|
await import_eslint.ESLint.outputFixes(results);
|
|
@@ -9676,18 +9684,15 @@ function determineRbacMode(opts, cfg) {
|
|
|
9676
9684
|
}
|
|
9677
9685
|
return cfg.pepr.rbacMode || "admin";
|
|
9678
9686
|
}
|
|
9679
|
-
async function
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
process.exit(1);
|
|
9688
|
-
}
|
|
9687
|
+
async function createOutputDirectory(outputDir2) {
|
|
9688
|
+
try {
|
|
9689
|
+
const dir = outputDir2 === "" ? "dist" : outputDir2;
|
|
9690
|
+
await createDirectoryIfNotExists(dir);
|
|
9691
|
+
return dir;
|
|
9692
|
+
} catch (error) {
|
|
9693
|
+
console.error(`Error creating output directory: ${error.message}`);
|
|
9694
|
+
process.exit(1);
|
|
9689
9695
|
}
|
|
9690
|
-
return defaultOutputDir;
|
|
9691
9696
|
}
|
|
9692
9697
|
function checkIronBankImage(registry, image, peprVersion) {
|
|
9693
9698
|
return registry === "Iron Bank" ? `registry1.dso.mil/ironbank/opensource/defenseunicorns/pepr/controller:v${peprVersion}` : image;
|
|
@@ -9754,7 +9759,7 @@ async function generateYamlAndWriteToDisk(obj) {
|
|
|
9754
9759
|
await import_fs9.promises.writeFile(yamlPath, yaml);
|
|
9755
9760
|
await import_fs9.promises.writeFile(zarfPath, localZarf);
|
|
9756
9761
|
await assets.generateHelmChart(webhookConfigGenerator, getWatcher, getModuleSecret, outputDir2);
|
|
9757
|
-
console.info(
|
|
9762
|
+
console.info(`K8s resource for the module saved to ${yamlPath}`);
|
|
9758
9763
|
} catch (error) {
|
|
9759
9764
|
console.error(`Error generating YAML: ${error}`);
|
|
9760
9765
|
process.exit(1);
|
|
@@ -9766,7 +9771,10 @@ var peprTS2 = "pepr.ts";
|
|
|
9766
9771
|
var outputDir = "dist";
|
|
9767
9772
|
function build_default(program2) {
|
|
9768
9773
|
program2.command("build").description("Build a Pepr Module for deployment").addOption(
|
|
9769
|
-
new import_commander.Option("-M, --rbac-mode <
|
|
9774
|
+
new import_commander.Option("-M, --rbac-mode <mode>", "Override module config and set RBAC mode.").choices([
|
|
9775
|
+
"admin",
|
|
9776
|
+
"scoped"
|
|
9777
|
+
])
|
|
9770
9778
|
).addOption(
|
|
9771
9779
|
new import_commander.Option(
|
|
9772
9780
|
"-I, --registry-info <registry/username>",
|
|
@@ -9785,7 +9793,7 @@ function build_default(program2) {
|
|
|
9785
9793
|
).option(
|
|
9786
9794
|
"-n, --no-embed",
|
|
9787
9795
|
"Disable embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM."
|
|
9788
|
-
).option("-o, --output <directory>", "Set output directory.").addOption(
|
|
9796
|
+
).option("-o, --output <directory>", "Set output directory.", "dist").addOption(
|
|
9789
9797
|
new import_commander.Option(
|
|
9790
9798
|
"-r, --registry <GitHub|Iron Bank>",
|
|
9791
9799
|
"Container registry: Choose container registry for deployment manifests. Conflicts with --custom-image and --registry-info."
|
|
@@ -9797,7 +9805,7 @@ function build_default(program2) {
|
|
|
9797
9805
|
).addOption(
|
|
9798
9806
|
new import_commander.Option("-z, --zarf <manifest|chart>", "Set Zarf package type").choices(["manifest", "chart"]).default("manifest")
|
|
9799
9807
|
).action(async (opts) => {
|
|
9800
|
-
outputDir = await
|
|
9808
|
+
outputDir = await createOutputDirectory(opts.output);
|
|
9801
9809
|
const buildModuleResult = await buildModule(void 0, opts.entryPoint, opts.embed);
|
|
9802
9810
|
const { cfg, path: path4 } = buildModuleResult;
|
|
9803
9811
|
if (opts.customName) {
|
|
@@ -9822,7 +9830,7 @@ function build_default(program2) {
|
|
|
9822
9830
|
);
|
|
9823
9831
|
}
|
|
9824
9832
|
if (!opts.embed) {
|
|
9825
|
-
console.info(
|
|
9833
|
+
console.info(`Module built successfully at ${path4}`);
|
|
9826
9834
|
return;
|
|
9827
9835
|
}
|
|
9828
9836
|
const assets = new Assets(
|
|
@@ -9907,7 +9915,7 @@ async function buildModule(reloader, entryPoint = peprTS2, embed = true) {
|
|
|
9907
9915
|
setup(build) {
|
|
9908
9916
|
build.onEnd(async (r) => {
|
|
9909
9917
|
if (r?.metafile) {
|
|
9910
|
-
console.
|
|
9918
|
+
console.info(await (0, import_esbuild2.analyzeMetafile)(r.metafile));
|
|
9911
9919
|
}
|
|
9912
9920
|
if (reloader) {
|
|
9913
9921
|
await reloader(r);
|
|
@@ -9940,7 +9948,7 @@ function handleModuleBuildError(e) {
|
|
|
9940
9948
|
if (!e.stdout) process.exit(1);
|
|
9941
9949
|
const out = e.stdout.toString();
|
|
9942
9950
|
const err = e.stderr.toString();
|
|
9943
|
-
console.
|
|
9951
|
+
console.info(out);
|
|
9944
9952
|
console.error(err);
|
|
9945
9953
|
if (out.includes("Types have separate declarations of a private property '_name'.")) {
|
|
9946
9954
|
const pgkErrMatch = /error TS2322: .*? 'import\("\/.*?\/node_modules\/(.*?)\/node_modules/g;
|
|
@@ -9967,7 +9975,7 @@ function handleModuleBuildError(e) {
|
|
|
9967
9975
|
async function checkFormat() {
|
|
9968
9976
|
const validFormat = await peprFormat(true);
|
|
9969
9977
|
if (!validFormat) {
|
|
9970
|
-
console.
|
|
9978
|
+
console.info(
|
|
9971
9979
|
"\x1B[33m%s\x1B[0m",
|
|
9972
9980
|
"Formatting errors were found. The build will continue, but you may want to run `npx pepr format` to address any issues."
|
|
9973
9981
|
);
|
|
@@ -10212,7 +10220,7 @@ function validateImagePullSecretDetails(details) {
|
|
|
10212
10220
|
if (missing.length > 0) {
|
|
10213
10221
|
return {
|
|
10214
10222
|
valid: false,
|
|
10215
|
-
error: `Error: Must provide ${missing.join(", ")} when providing --
|
|
10223
|
+
error: `Error: Must provide ${missing.join(", ")} when providing --pull-secret`
|
|
10216
10224
|
};
|
|
10217
10225
|
}
|
|
10218
10226
|
return { valid: true };
|
|
@@ -10764,7 +10772,7 @@ function update_default(program2) {
|
|
|
10764
10772
|
return;
|
|
10765
10773
|
}
|
|
10766
10774
|
}
|
|
10767
|
-
|
|
10775
|
+
logger_default.info("Updating the Pepr module...");
|
|
10768
10776
|
try {
|
|
10769
10777
|
(0, import_child_process6.execSync)("npm install pepr@latest", {
|
|
10770
10778
|
stdio: "inherit"
|
|
@@ -10774,14 +10782,14 @@ function update_default(program2) {
|
|
|
10774
10782
|
stdio: "inherit"
|
|
10775
10783
|
});
|
|
10776
10784
|
}
|
|
10777
|
-
|
|
10778
|
-
} catch (
|
|
10779
|
-
|
|
10785
|
+
logger_default.info(`\u2705 Module updated successfully`);
|
|
10786
|
+
} catch (error) {
|
|
10787
|
+
logger_default.error(error, `Error updating Pepr module:`);
|
|
10780
10788
|
process.exitCode = 1;
|
|
10781
10789
|
}
|
|
10782
10790
|
});
|
|
10783
10791
|
program2.command("update-templates", { hidden: true }).description("Perform template updates").action(async (opts) => {
|
|
10784
|
-
|
|
10792
|
+
logger_default.info("Updating Pepr config and template files...");
|
|
10785
10793
|
try {
|
|
10786
10794
|
if (!opts.skipTemplateUpdate) {
|
|
10787
10795
|
await write((0, import_path6.resolve)(prettier.path), prettier.data);
|
|
@@ -10798,8 +10806,8 @@ function update_default(program2) {
|
|
|
10798
10806
|
await write(tsPath, helloPepr.data);
|
|
10799
10807
|
}
|
|
10800
10808
|
}
|
|
10801
|
-
} catch (
|
|
10802
|
-
|
|
10809
|
+
} catch (error) {
|
|
10810
|
+
logger_default.error(error, `Error updating template files:`);
|
|
10803
10811
|
process.exitCode = 1;
|
|
10804
10812
|
}
|
|
10805
10813
|
});
|
|
@@ -10809,14 +10817,16 @@ function update_default(program2) {
|
|
|
10809
10817
|
var import_child_process7 = require("child_process");
|
|
10810
10818
|
var import_prompts6 = __toESM(require("prompts"));
|
|
10811
10819
|
function kfc_default(program2) {
|
|
10812
|
-
program2.command("kfc [args...]").description("Execute Kubernetes Fluent Client commands").action(async (args) => {
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
+
program2.command("kfc [args...]").description("Execute Kubernetes Fluent Client commands").option("-y, --yes", "Skip confirmation prompt.").action(async (args, options) => {
|
|
10821
|
+
if (!options.yes) {
|
|
10822
|
+
const { confirm: confirm2 } = await (0, import_prompts6.default)({
|
|
10823
|
+
type: "confirm",
|
|
10824
|
+
name: "confirm",
|
|
10825
|
+
message: "For commands that generate files, this may overwrite any previously generated files.\nAre you sure you want to continue?"
|
|
10826
|
+
});
|
|
10827
|
+
if (!confirm2) {
|
|
10828
|
+
return;
|
|
10829
|
+
}
|
|
10820
10830
|
}
|
|
10821
10831
|
try {
|
|
10822
10832
|
if (args.length === 0) {
|
|
@@ -10842,8 +10852,8 @@ var create = new import_commander3.Command("create").description("Create a new C
|
|
|
10842
10852
|
"-S, --scope <scope>",
|
|
10843
10853
|
"Whether the resulting custom resource is cluster- or namespace-scoped"
|
|
10844
10854
|
).choices(["Namespaced", "Cluster"]).default("Namespaced")
|
|
10845
|
-
).option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev").requiredOption("-g, --group <group>", "API group (e.g. cache)").requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)").option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)").
|
|
10846
|
-
console.log("This feature is currently in alpha
|
|
10855
|
+
).option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev").requiredOption("-g, --group <group>", "API group (e.g. cache)").requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)").option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)").requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)", "").requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)").action(async ({ group: group2, version: version3, kind: kind8, domain, scope, plural: plural2, shortName }) => {
|
|
10856
|
+
console.log("This feature is currently in alpha.");
|
|
10847
10857
|
const outputDir2 = import_path7.default.resolve(`./api/${version3}`);
|
|
10848
10858
|
await createDirectoryIfNotExists(outputDir2);
|
|
10849
10859
|
await import_fs15.promises.writeFile(
|
|
@@ -10953,7 +10963,9 @@ var WarningMessages = {
|
|
|
10953
10963
|
};
|
|
10954
10964
|
|
|
10955
10965
|
// src/cli/crd/generate.ts
|
|
10956
|
-
var generate_default = new import_commander4.Command("generate").description(
|
|
10966
|
+
var generate_default = new import_commander4.Command("generate").description(
|
|
10967
|
+
"Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory."
|
|
10968
|
+
).option("-o, --output <directory>", "Output directory for generated CRDs", "./crds").action(generateCRDs);
|
|
10957
10969
|
function extractCRDDetails(content, sourceFile) {
|
|
10958
10970
|
const kind8 = extractSingleLineComment(content, "Kind");
|
|
10959
10971
|
const group2 = extractSingleLineComment(content, "Group") ?? "example";
|
|
@@ -10965,7 +10977,7 @@ function extractCRDDetails(content, sourceFile) {
|
|
|
10965
10977
|
return { kind: kind8, plural: plural2, scope, shortNames, fqdn };
|
|
10966
10978
|
}
|
|
10967
10979
|
async function generateCRDs(options) {
|
|
10968
|
-
|
|
10980
|
+
logger_default.warn("This feature is currently in alpha.\n");
|
|
10969
10981
|
const outputDir2 = import_path8.default.resolve(options.output);
|
|
10970
10982
|
await createDirectoryIfNotExists(outputDir2);
|
|
10971
10983
|
const project = new import_ts_morph.Project();
|
|
@@ -10990,12 +11002,12 @@ function processSourceFile(sourceFile, version3, outputDir2) {
|
|
|
10990
11002
|
const content = sourceFile.getFullText();
|
|
10991
11003
|
const { kind: kind8, fqdn, scope, plural: plural2, shortNames } = extractCRDDetails(content, sourceFile);
|
|
10992
11004
|
if (!kind8) {
|
|
10993
|
-
|
|
11005
|
+
logger_default.warn(WarningMessages.MISSING_KIND_COMMENT(sourceFile.getBaseName()));
|
|
10994
11006
|
return;
|
|
10995
11007
|
}
|
|
10996
11008
|
const spec = sourceFile.getInterface(`${kind8}Spec`);
|
|
10997
11009
|
if (!spec) {
|
|
10998
|
-
|
|
11010
|
+
logger_default.warn(WarningMessages.MISSING_INTERFACE(sourceFile.getBaseName(), kind8));
|
|
10999
11011
|
return;
|
|
11000
11012
|
}
|
|
11001
11013
|
const condition = sourceFile.getTypeAlias(`${kind8}StatusCondition`);
|
|
@@ -11013,7 +11025,7 @@ function processSourceFile(sourceFile, version3, outputDir2) {
|
|
|
11013
11025
|
});
|
|
11014
11026
|
const outPath = import_path8.default.join(outputDir2, `${kind8.toLowerCase()}.yaml`);
|
|
11015
11027
|
import_fs16.default.writeFileSync(outPath, (0, import_yaml.stringify)(crd), "utf8");
|
|
11016
|
-
|
|
11028
|
+
logger_default.info(`\u2714 Created ${outPath}`);
|
|
11017
11029
|
}
|
|
11018
11030
|
function extractSingleLineComment(content, label) {
|
|
11019
11031
|
const match = content.match(new RegExp(`//\\s+${label}:\\s+(.*)`));
|
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-nightly.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");
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAmG1F;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAuH5F;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"}
|
|
@@ -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,EAC1B,cAAc,GAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAuC,GAC5F,OAAO,CAAC,IAAI,CAAC,
|
|
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,CAoKf"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"!src/fixtures/**",
|
|
17
17
|
"!dist/**/*.test.d.ts*"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.52.0-nightly.0",
|
|
20
20
|
"main": "dist/lib.js",
|
|
21
21
|
"types": "dist/lib.d.ts",
|
|
22
22
|
"scripts": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"heredoc": "^1.3.1",
|
|
63
63
|
"http-status-codes": "^2.3.0",
|
|
64
64
|
"json-pointer": "^0.6.2",
|
|
65
|
-
"kubernetes-fluent-client": "3.8.
|
|
65
|
+
"kubernetes-fluent-client": "3.8.1",
|
|
66
66
|
"pino": "9.7.0",
|
|
67
67
|
"pino-pretty": "13.0.0",
|
|
68
68
|
"prom-client": "15.1.3",
|
package/src/cli/build.helpers.ts
CHANGED
|
@@ -83,18 +83,15 @@ export function determineRbacMode(
|
|
|
83
83
|
* @returns The desired output directory or the default one
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
|
-
export async function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
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);
|
|
96
94
|
}
|
|
97
|
-
return defaultOutputDir;
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
/**
|
|
@@ -221,7 +218,7 @@ export async function generateYamlAndWriteToDisk(obj: {
|
|
|
221
218
|
await fs.writeFile(zarfPath, localZarf);
|
|
222
219
|
|
|
223
220
|
await assets.generateHelmChart(webhookConfigGenerator, getWatcher, getModuleSecret, outputDir);
|
|
224
|
-
console.info(
|
|
221
|
+
console.info(`K8s resource for the module saved to ${yamlPath}`);
|
|
225
222
|
} catch (error) {
|
|
226
223
|
console.error(`Error generating YAML: ${error}`);
|
|
227
224
|
process.exit(1);
|
package/src/cli/build.ts
CHANGED
|
@@ -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,
|
|
@@ -69,7 +69,10 @@ export default function (program: Command): void {
|
|
|
69
69
|
.command("build")
|
|
70
70
|
.description("Build a Pepr Module for deployment")
|
|
71
71
|
.addOption(
|
|
72
|
-
new Option("-M, --rbac-mode <
|
|
72
|
+
new Option("-M, --rbac-mode <mode>", "Override module config and set RBAC mode.").choices([
|
|
73
|
+
"admin",
|
|
74
|
+
"scoped",
|
|
75
|
+
]),
|
|
73
76
|
)
|
|
74
77
|
.addOption(
|
|
75
78
|
new Option(
|
|
@@ -95,7 +98,7 @@ export default function (program: Command): void {
|
|
|
95
98
|
"-n, --no-embed",
|
|
96
99
|
"Disable embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM.",
|
|
97
100
|
)
|
|
98
|
-
.option("-o, --output <directory>", "Set output directory.")
|
|
101
|
+
.option("-o, --output <directory>", "Set output directory.", "dist")
|
|
99
102
|
.addOption(
|
|
100
103
|
new Option(
|
|
101
104
|
"-r, --registry <GitHub|Iron Bank>",
|
|
@@ -115,8 +118,7 @@ export default function (program: Command): void {
|
|
|
115
118
|
.default("manifest"),
|
|
116
119
|
)
|
|
117
120
|
.action(async opts => {
|
|
118
|
-
|
|
119
|
-
outputDir = await handleCustomOutputDir(opts.output);
|
|
121
|
+
outputDir = await createOutputDirectory(opts.output);
|
|
120
122
|
|
|
121
123
|
// Build the module
|
|
122
124
|
const buildModuleResult = await buildModule(undefined, opts.entryPoint, opts.embed);
|
|
@@ -154,7 +156,7 @@ export default function (program: Command): void {
|
|
|
154
156
|
|
|
155
157
|
// If building without embedding, exit after building
|
|
156
158
|
if (!opts.embed) {
|
|
157
|
-
console.info(
|
|
159
|
+
console.info(`Module built successfully at ${path}`);
|
|
158
160
|
return;
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -274,7 +276,7 @@ export async function buildModule(
|
|
|
274
276
|
build.onEnd(async r => {
|
|
275
277
|
// Print the build size analysis
|
|
276
278
|
if (r?.metafile) {
|
|
277
|
-
console.
|
|
279
|
+
console.info(await analyzeMetafile(r.metafile));
|
|
278
280
|
}
|
|
279
281
|
|
|
280
282
|
// If we're in dev mode, call the reloader function
|
|
@@ -331,7 +333,7 @@ function handleModuleBuildError(e: BuildModuleResult): void {
|
|
|
331
333
|
const out = e.stdout.toString() as string;
|
|
332
334
|
const err = e.stderr.toString();
|
|
333
335
|
|
|
334
|
-
console.
|
|
336
|
+
console.info(out);
|
|
335
337
|
console.error(err);
|
|
336
338
|
|
|
337
339
|
// Check for version conflicts
|
|
@@ -365,7 +367,7 @@ export async function checkFormat(): Promise<void> {
|
|
|
365
367
|
const validFormat = await peprFormat(true);
|
|
366
368
|
|
|
367
369
|
if (!validFormat) {
|
|
368
|
-
console.
|
|
370
|
+
console.info(
|
|
369
371
|
"\x1b[33m%s\x1b[0m",
|
|
370
372
|
"Formatting errors were found. The build will continue, but you may want to run `npx pepr format` to address any issues.",
|
|
371
373
|
);
|
package/src/cli/crd/create.ts
CHANGED
|
@@ -21,10 +21,10 @@ const create = new Command("create")
|
|
|
21
21
|
.requiredOption("-g, --group <group>", "API group (e.g. cache)")
|
|
22
22
|
.requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)")
|
|
23
23
|
.option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)")
|
|
24
|
-
.
|
|
24
|
+
.requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)", "")
|
|
25
25
|
.requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)")
|
|
26
26
|
.action(async ({ group, version, kind, domain, scope, plural, shortName }) => {
|
|
27
|
-
console.log("This feature is currently in alpha
|
|
27
|
+
console.log("This feature is currently in alpha.");
|
|
28
28
|
const outputDir = path.resolve(`./api/${version}`);
|
|
29
29
|
await createDirectoryIfNotExists(outputDir);
|
|
30
30
|
|
package/src/cli/crd/generate.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import path from "path";
|
|
7
|
+
import Log from "../../lib/telemetry/logger";
|
|
7
8
|
import { stringify } from "yaml";
|
|
8
9
|
import {
|
|
9
10
|
Project,
|
|
@@ -20,7 +21,9 @@ import { V1JSONSchemaProps } from "@kubernetes/client-node";
|
|
|
20
21
|
import { WarningMessages, ErrorMessages } from "./messages";
|
|
21
22
|
|
|
22
23
|
export default new Command("generate")
|
|
23
|
-
.description(
|
|
24
|
+
.description(
|
|
25
|
+
"Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory.",
|
|
26
|
+
)
|
|
24
27
|
.option("-o, --output <directory>", "Output directory for generated CRDs", "./crds")
|
|
25
28
|
.action(generateCRDs);
|
|
26
29
|
|
|
@@ -48,7 +51,7 @@ export function extractCRDDetails(
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export async function generateCRDs(options: { output: string }): Promise<void> {
|
|
51
|
-
|
|
54
|
+
Log.warn("This feature is currently in alpha.\n");
|
|
52
55
|
const outputDir = path.resolve(options.output);
|
|
53
56
|
await createDirectoryIfNotExists(outputDir);
|
|
54
57
|
|
|
@@ -83,13 +86,13 @@ export function processSourceFile(
|
|
|
83
86
|
const { kind, fqdn, scope, plural, shortNames } = extractCRDDetails(content, sourceFile);
|
|
84
87
|
|
|
85
88
|
if (!kind) {
|
|
86
|
-
|
|
89
|
+
Log.warn(WarningMessages.MISSING_KIND_COMMENT(sourceFile.getBaseName()));
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
const spec = sourceFile.getInterface(`${kind}Spec`);
|
|
91
94
|
if (!spec) {
|
|
92
|
-
|
|
95
|
+
Log.warn(WarningMessages.MISSING_INTERFACE(sourceFile.getBaseName(), kind));
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
95
98
|
|
|
@@ -110,7 +113,7 @@ export function processSourceFile(
|
|
|
110
113
|
|
|
111
114
|
const outPath = path.join(outputDir, `${kind.toLowerCase()}.yaml`);
|
|
112
115
|
fs.writeFileSync(outPath, stringify(crd), "utf8");
|
|
113
|
-
|
|
116
|
+
Log.info(`✔ Created ${outPath}`);
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
// Extracts a comment from the content of a file based on a label.
|
package/src/cli/deploy.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function validateImagePullSecretDetails(details: ImagePullSecretDetails):
|
|
|
54
54
|
if (missing.length > 0) {
|
|
55
55
|
return {
|
|
56
56
|
valid: false,
|
|
57
|
-
error: `Error: Must provide ${missing.join(", ")} when providing --
|
|
57
|
+
error: `Error: Must provide ${missing.join(", ")} when providing --pull-secret`,
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
package/src/cli/format/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ESLint } from "eslint";
|
|
|
5
5
|
import { formatWithPrettier } from "./format.helpers";
|
|
6
6
|
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
+
import Log from "../../lib/telemetry/logger";
|
|
8
9
|
|
|
9
10
|
export default function (program: Command): void {
|
|
10
11
|
program
|
|
@@ -47,7 +48,7 @@ export async function peprFormat(validateOnly: boolean): Promise<boolean> {
|
|
|
47
48
|
const resultText = await formatter.format(results, {} as ESLint.LintResultData);
|
|
48
49
|
|
|
49
50
|
if (resultText) {
|
|
50
|
-
|
|
51
|
+
Log.info(resultText);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
// Write the fixes if not in validate-only mode
|
package/src/cli/kfc.ts
CHANGED
|
@@ -10,18 +10,22 @@ export default function (program: Command): void {
|
|
|
10
10
|
program
|
|
11
11
|
.command("kfc [args...]")
|
|
12
12
|
.description("Execute Kubernetes Fluent Client commands")
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
.option("-y, --yes", "Skip confirmation prompt.")
|
|
14
|
+
.action(async (args: string[], options) => {
|
|
15
|
+
// Skip confirmation if yes flag is provided
|
|
16
|
+
if (!options.yes) {
|
|
17
|
+
const { confirm } = await prompt({
|
|
18
|
+
type: "confirm",
|
|
19
|
+
name: "confirm",
|
|
20
|
+
message:
|
|
21
|
+
"For commands that generate files, this may overwrite any previously generated files.\n" +
|
|
22
|
+
"Are you sure you want to continue?",
|
|
23
|
+
});
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
// If the user doesn't confirm, exit
|
|
26
|
+
if (!confirm) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
try {
|
package/src/cli/update/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "../init/templates";
|
|
17
17
|
import { write } from "../init/utils";
|
|
18
18
|
import { Command } from "commander";
|
|
19
|
+
import Log from "../../lib/telemetry/logger";
|
|
19
20
|
|
|
20
21
|
export default function (program: Command): void {
|
|
21
22
|
program
|
|
@@ -38,7 +39,7 @@ export default function (program: Command): void {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
Log.info("Updating the Pepr module...");
|
|
42
43
|
|
|
43
44
|
try {
|
|
44
45
|
// Update Pepr for the module
|
|
@@ -53,9 +54,9 @@ export default function (program: Command): void {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
} catch (
|
|
58
|
-
|
|
57
|
+
Log.info(`✅ Module updated successfully`);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
Log.error(error, `Error updating Pepr module:`);
|
|
59
60
|
process.exitCode = 1;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
@@ -64,7 +65,7 @@ export default function (program: Command): void {
|
|
|
64
65
|
.command("update-templates", { hidden: true })
|
|
65
66
|
.description("Perform template updates")
|
|
66
67
|
.action(async opts => {
|
|
67
|
-
|
|
68
|
+
Log.info("Updating Pepr config and template files...");
|
|
68
69
|
|
|
69
70
|
try {
|
|
70
71
|
// Don't update the template files if the user specified the --skip-template-update flag
|
|
@@ -87,8 +88,8 @@ export default function (program: Command): void {
|
|
|
87
88
|
await write(tsPath, helloPepr.data);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
} catch (
|
|
91
|
-
|
|
91
|
+
} catch (error) {
|
|
92
|
+
Log.error(error, `Error updating template files:`);
|
|
92
93
|
process.exitCode = 1;
|
|
93
94
|
}
|
|
94
95
|
});
|
package/src/lib/assets/helm.ts
CHANGED
|
@@ -93,6 +93,9 @@ export function watcherDeployTemplate(buildTimestamp: string, type: ControllerTy
|
|
|
93
93
|
labels:
|
|
94
94
|
app: {{ .Values.uuid }}-watcher
|
|
95
95
|
pepr.dev/controller: watcher
|
|
96
|
+
{{- if .Values.watcher.podLabels }}
|
|
97
|
+
{{- toYaml .Values.watcher.podLabels | nindent 8 }}
|
|
98
|
+
{{- end }}
|
|
96
99
|
spec:
|
|
97
100
|
terminationGracePeriodSeconds: {{ .Values.watcher.terminationGracePeriodSeconds }}
|
|
98
101
|
serviceAccountName: {{ .Values.uuid }}
|
|
@@ -189,6 +192,9 @@ export function admissionDeployTemplate(buildTimestamp: string, type: Controller
|
|
|
189
192
|
labels:
|
|
190
193
|
app: {{ .Values.uuid }}
|
|
191
194
|
pepr.dev/controller: admission
|
|
195
|
+
{{- if .Values.admission.podLabels }}
|
|
196
|
+
{{- toYaml .Values.admission.podLabels | nindent 8 }}
|
|
197
|
+
{{- end }}
|
|
192
198
|
spec:
|
|
193
199
|
{{- if or .Values.admission.antiAffinity .Values.admission.affinity }}
|
|
194
200
|
affinity:
|
|
@@ -100,6 +100,7 @@ export async function overridesFile(
|
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
102
|
podAnnotations: {},
|
|
103
|
+
podLabels: {},
|
|
103
104
|
nodeSelector: {},
|
|
104
105
|
tolerations: [],
|
|
105
106
|
extraVolumeMounts: [],
|
|
@@ -172,6 +173,7 @@ export async function overridesFile(
|
|
|
172
173
|
extraVolumes: [],
|
|
173
174
|
affinity: {},
|
|
174
175
|
podAnnotations: {},
|
|
176
|
+
podLabels: {},
|
|
175
177
|
serviceMonitor: {
|
|
176
178
|
enabled: false,
|
|
177
179
|
labels: {},
|