pepr 0.52.0 → 0.52.1-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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAoE/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAsD/C"}
@@ -129,7 +129,7 @@ export type peprPackageJSON = {
129
129
  path: string;
130
130
  print: string;
131
131
  };
132
- export declare function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPackageJSON;
132
+ export declare function genPkgJSON(opts: InitOptions): peprPackageJSON;
133
133
  export declare const peprTSTemplate: {
134
134
  path: string;
135
135
  data: string;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrE,eAAO,MAAQ,YAAY;;;;;;;;;;;;;;;GAAE,eAAe;;;;;;;;;;;;;;;;;;;;GAAE,gBAAgB;;;;;;;;;;;GAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,OAAO,QAAgB,CAAC;AAEjG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,OAAO,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,YAAY,CAAC;YAC3B,YAAY,EAAE;gBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC;YACvC,SAAS,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YACtD,KAAK,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YAClD,aAAa,EAAE,MAAM,EAAE,CAAC;YACxB,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;YACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACrB,CAAC;QACF,OAAO,EAAE;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QACjC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/C,eAAe,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;KACzC,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,eAAe,CAkEtF;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;CAGnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;CAGxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAgBlB,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrE,eAAO,MAAQ,YAAY;;;;;;;;;;;;;;;GAAE,eAAe;;;;;;;;;;;;;;;;;;;;GAAE,gBAAgB;;;;;;;;;;;GAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,OAAO,QAAgB,CAAC;AAEjG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,OAAO,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,YAAY,CAAC;YAC3B,YAAY,EAAE;gBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC;YACvC,SAAS,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YACtD,KAAK,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YAClD,aAAa,EAAE,MAAM,EAAE,CAAC;YACxB,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;YACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACrB,CAAC;QACF,OAAO,EAAE;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QACjC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/C,eAAe,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;KACzC,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CA6D7D;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;CAGnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;CAGxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAgBlB,CAAC"}
@@ -1,3 +1,7 @@
1
+ import { KubernetesListObject } from "@kubernetes/client-node";
2
+ import { kind } from "kubernetes-fluent-client";
1
3
  import { Command } from "commander";
2
4
  export default function (program: Command): void;
5
+ export declare function getPeprDeploymentsByUUID(uuid?: string): Promise<KubernetesListObject<kind.Deployment>>;
6
+ export declare function buildUUIDTable(deployments: KubernetesListObject<kind.Deployment>): Record<string, string>;
3
7
  //# sourceMappingURL=uuid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/cli/uuid.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAoC/C"}
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/cli/uuid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAO,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAe/C;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAiBhD;AAED,wBAAgB,cAAc,CAC5B,WAAW,EAAE,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,GACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB"}
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.52.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:journey && npm run test:journey-wasm", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm", "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts", "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts", "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.30.2", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.8.1", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
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.1-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.2", 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");
@@ -8902,14 +8910,10 @@ function write(path4, data) {
8902
8910
 
8903
8911
  // src/cli/init/templates.ts
8904
8912
  var { dependencies, devDependencies, peerDependencies, scripts, version } = packageJSON;
8905
- function genPkgJSON(opts, pgkVerOverride) {
8913
+ function genPkgJSON(opts) {
8906
8914
  const uuid = !opts.uuid ? (0, import_uuid.v4)() : opts.uuid;
8907
8915
  const name2 = sanitizeName(opts.name);
8908
8916
  const { typescript } = peerDependencies;
8909
- const testEnv = {
8910
- MY_CUSTOM_VAR: "example-value",
8911
- ZARF_VAR: "###ZARF_VAR_THING###"
8912
- };
8913
8917
  const data = {
8914
8918
  name: name2,
8915
8919
  version: "0.0.1",
@@ -8919,7 +8923,7 @@ function genPkgJSON(opts, pgkVerOverride) {
8919
8923
  node: ">=20.0.0"
8920
8924
  },
8921
8925
  pepr: {
8922
- uuid: pgkVerOverride ? "static-test" : uuid,
8926
+ uuid,
8923
8927
  onError: opts.errorBehavior,
8924
8928
  webhookTimeout: 10,
8925
8929
  customLabels: {
@@ -8941,13 +8945,13 @@ function genPkgJSON(opts, pgkVerOverride) {
8941
8945
  }
8942
8946
  },
8943
8947
  includedFiles: [],
8944
- env: pgkVerOverride ? testEnv : {}
8948
+ env: {}
8945
8949
  },
8946
8950
  scripts: {
8947
8951
  "k3d-setup": scripts["test:journey:k3d"]
8948
8952
  },
8949
8953
  dependencies: {
8950
- pepr: pgkVerOverride || version,
8954
+ pepr: version,
8951
8955
  undici: "^7.0.1"
8952
8956
  },
8953
8957
  devDependencies: {
@@ -9045,7 +9049,7 @@ function format_default(program2) {
9045
9049
  program2.command("format").description("Lint and format this Pepr module").option("-v, --validate-only", "Do not modify files, only validate formatting.").action(async (opts) => {
9046
9050
  const success = await peprFormat(opts.validateOnly);
9047
9051
  if (success) {
9048
- console.info("\u2705 Module formatted");
9052
+ logger_default.info("Module formatted");
9049
9053
  } else {
9050
9054
  process.exit(1);
9051
9055
  }
@@ -9073,8 +9077,8 @@ async function peprFormat(validateOnly) {
9073
9077
  }
9074
9078
  hasFailure = hasFailure || await formatWithPrettier(results, validateOnly);
9075
9079
  return !hasFailure;
9076
- } catch (e) {
9077
- console.error(`Error formatting module:`, e);
9080
+ } catch (error) {
9081
+ logger_default.error(error, `Error formatting module:`);
9078
9082
  return false;
9079
9083
  }
9080
9084
  }
@@ -10477,7 +10481,6 @@ ${filteredFailures.length > 0 ? "\u274C" : "\u2705"} VALIDATE ${name2} (${uid
10477
10481
  // src/cli/init/index.ts
10478
10482
  var import_child_process5 = require("child_process");
10479
10483
  var import_path5 = require("path");
10480
- var import_prompts4 = __toESM(require("prompts"));
10481
10484
 
10482
10485
  // src/cli/init/walkthrough.ts
10483
10486
  var import_fs13 = require("fs");
@@ -10623,7 +10626,6 @@ ${packageJSON2.print.replace(/^/gm, " \u2502 ")}
10623
10626
  var import_commander2 = require("commander");
10624
10627
  function init_default(program2) {
10625
10628
  let response = {};
10626
- let pkgOverride = "";
10627
10629
  program2.command("init").description("Initialize a new Pepr Module").option("-d, --description <string>", "Explain the purpose of the new module.").addOption(
10628
10630
  new import_commander2.Option("-e, --error-behavior <behavior>", "Set an error behavior.").choices(ErrorList)
10629
10631
  ).option("-n, --name <string>", "Set the name of the new module.").option("-s, --skip-post-init", "Skip npm install, git init, and VSCode launch.").option(
@@ -10636,23 +10638,11 @@ function init_default(program2) {
10636
10638
  return uuid.toLocaleLowerCase();
10637
10639
  }
10638
10640
  ).option("-y, --yes", "Skip verification prompt when creating a new module.").hook("preAction", async (thisCommand) => {
10639
- if (process.env.TEST_MODE === "true") {
10640
- import_prompts4.default.inject([
10641
- "pepr-test-module",
10642
- "A test module for Pepr",
10643
- "ignore",
10644
- "static-test",
10645
- "y"
10646
- ]);
10647
- pkgOverride = "file:../pepr-0.0.0-development.tgz";
10648
- response = await walkthrough();
10649
- } else {
10650
- response = await walkthrough(thisCommand.opts());
10651
- Object.entries(response).map(([key, value]) => thisCommand.setOptionValue(key, value));
10652
- }
10641
+ response = await walkthrough(thisCommand.opts());
10642
+ Object.entries(response).map(([key, value]) => thisCommand.setOptionValue(key, value));
10653
10643
  }).action(async (opts) => {
10654
10644
  const dirName = sanitizeName(response.name);
10655
- const packageJSON2 = genPkgJSON(response, pkgOverride);
10645
+ const packageJSON2 = genPkgJSON(response);
10656
10646
  const confirmed = await confirm(dirName, packageJSON2, peprTSTemplate.path, opts.yes);
10657
10647
  if (confirmed) {
10658
10648
  console.log("Creating new Pepr module...");
@@ -10722,20 +10712,8 @@ var doPostInitActions = (dirName) => {
10722
10712
  var import_kubernetes_fluent_client7 = require("kubernetes-fluent-client");
10723
10713
  function uuid_default(program2) {
10724
10714
  program2.command("uuid [uuid]").description("Module UUID(s) currently deployed in the cluster").action(async (uuid) => {
10725
- const uuidTable = {};
10726
- let deployments;
10727
- if (!uuid) {
10728
- deployments = await (0, import_kubernetes_fluent_client7.K8s)(import_kubernetes_fluent_client7.kind.Deployment).InNamespace("pepr-system").WithLabel("pepr.dev/uuid").Get();
10729
- } else {
10730
- deployments = await (0, import_kubernetes_fluent_client7.K8s)(import_kubernetes_fluent_client7.kind.Deployment).InNamespace("pepr-system").WithLabel("pepr.dev/uuid", uuid).Get();
10731
- }
10732
- deployments.items.map((deploy) => {
10733
- const uuid2 = deploy.metadata?.labels?.["pepr.dev/uuid"] || "";
10734
- const description = deploy.metadata?.annotations?.["pepr.dev/description"] || "";
10735
- if (uuid2 !== "") {
10736
- uuidTable[uuid2] = description;
10737
- }
10738
- });
10715
+ const deployments = await getPeprDeploymentsByUUID(uuid);
10716
+ const uuidTable = buildUUIDTable(deployments);
10739
10717
  console.log("UUID Description");
10740
10718
  console.log("--------------------------------------------");
10741
10719
  Object.entries(uuidTable).forEach(([uuid2, description]) => {
@@ -10743,6 +10721,30 @@ function uuid_default(program2) {
10743
10721
  });
10744
10722
  });
10745
10723
  }
10724
+ async function getPeprDeploymentsByUUID(uuid) {
10725
+ const k8sQuery = (0, import_kubernetes_fluent_client7.K8s)(import_kubernetes_fluent_client7.kind.Deployment).InNamespace("pepr-system");
10726
+ let deployments = uuid ? await k8sQuery.WithLabel("pepr.dev/uuid", uuid).Get() : await k8sQuery.WithLabel("pepr.dev/uuid").Get();
10727
+ if (uuid) {
10728
+ deployments = {
10729
+ ...deployments,
10730
+ items: deployments.items.filter(
10731
+ (deploy) => deploy.metadata?.labels?.["pepr.dev/uuid"] === uuid
10732
+ )
10733
+ };
10734
+ }
10735
+ return deployments;
10736
+ }
10737
+ function buildUUIDTable(deployments) {
10738
+ const uuidTable = {};
10739
+ deployments.items.forEach((deploy) => {
10740
+ const uuid = deploy.metadata?.labels?.["pepr.dev/uuid"] || "";
10741
+ const description = deploy.metadata?.annotations?.["pepr.dev/description"] || "";
10742
+ if (uuid !== "") {
10743
+ uuidTable[uuid] = description;
10744
+ }
10745
+ });
10746
+ return uuidTable;
10747
+ }
10746
10748
 
10747
10749
  // src/cli.ts
10748
10750
  var import_commander5 = require("commander");
@@ -10751,11 +10753,11 @@ var import_commander5 = require("commander");
10751
10753
  var import_child_process6 = require("child_process");
10752
10754
  var import_fs14 = __toESM(require("fs"));
10753
10755
  var import_path6 = require("path");
10754
- var import_prompts5 = __toESM(require("prompts"));
10756
+ var import_prompts4 = __toESM(require("prompts"));
10755
10757
  function update_default(program2) {
10756
10758
  program2.command("update").description("Update this Pepr module. Not recommended for prod as it may change files.").option("-s, --skip-template-update", "Do not update template files").action(async (opts) => {
10757
10759
  if (!opts.skipTemplateUpdate) {
10758
- const { confirm: confirm2 } = await (0, import_prompts5.default)({
10760
+ const { confirm: confirm2 } = await (0, import_prompts4.default)({
10759
10761
  type: "confirm",
10760
10762
  name: "confirm",
10761
10763
  message: "This will overwrite previously auto-generated files including the capabilities/HelloPepr.ts file.\nAre you sure you want to continue?"
@@ -10807,11 +10809,11 @@ function update_default(program2) {
10807
10809
 
10808
10810
  // src/cli/kfc.ts
10809
10811
  var import_child_process7 = require("child_process");
10810
- var import_prompts6 = __toESM(require("prompts"));
10812
+ var import_prompts5 = __toESM(require("prompts"));
10811
10813
  function kfc_default(program2) {
10812
10814
  program2.command("kfc [args...]").description("Execute Kubernetes Fluent Client commands").option("-y, --yes", "Skip confirmation prompt.").action(async (args, options) => {
10813
10815
  if (!options.yes) {
10814
- const { confirm: confirm2 } = await (0, import_prompts6.default)({
10816
+ const { confirm: confirm2 } = await (0, import_prompts5.default)({
10815
10817
  type: "confirm",
10816
10818
  name: "confirm",
10817
10819
  message: "For commands that generate files, this may overwrite any previously generated files.\nAre you sure you want to continue?"
@@ -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.52.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:journey && npm run test:journey-wasm", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm", "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts", "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts", "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.30.2", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.8.1", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
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.1-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.2", 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,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"}
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,CAkKf"}
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.52.0",
19
+ "version": "0.52.1-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.1",
65
+ "kubernetes-fluent-client": "3.8.2",
66
66
  "pino": "9.7.0",
67
67
  "pino-pretty": "13.0.0",
68
68
  "prom-client": "15.1.3",
@@ -106,4 +106,4 @@
106
106
  "typescript": "5.8.3",
107
107
  "uuid": "11.1.0"
108
108
  }
109
- }
109
+ }
@@ -16,7 +16,7 @@ export default function (program: Command): void {
16
16
  const success = await peprFormat(opts.validateOnly);
17
17
 
18
18
  if (success) {
19
- console.info("Module formatted");
19
+ Log.info("Module formatted");
20
20
  } else {
21
21
  process.exit(1);
22
22
  }
@@ -59,8 +59,8 @@ export async function peprFormat(validateOnly: boolean): Promise<boolean> {
59
59
  hasFailure = hasFailure || (await formatWithPrettier(results, validateOnly));
60
60
 
61
61
  return !hasFailure;
62
- } catch (e) {
63
- console.error(`Error formatting module:`, e);
62
+ } catch (error) {
63
+ Log.error(error, `Error formatting module:`);
64
64
  return false;
65
65
  }
66
66
  }
@@ -3,7 +3,6 @@
3
3
 
4
4
  import { execSync } from "child_process";
5
5
  import { resolve } from "path";
6
- import prompts from "prompts";
7
6
 
8
7
  import { Command } from "commander";
9
8
  import {
@@ -28,7 +27,7 @@ import { Option } from "commander";
28
27
 
29
28
  export default function (program: Command): void {
30
29
  let response = {} as PromptOptions;
31
- let pkgOverride = "";
30
+
32
31
  program
33
32
  .command("init")
34
33
  .description("Initialize a new Pepr Module")
@@ -50,26 +49,12 @@ export default function (program: Command): void {
50
49
  )
51
50
  .option("-y, --yes", "Skip verification prompt when creating a new module.")
52
51
  .hook("preAction", async thisCommand => {
53
- // TODO: Overrides for testing. Don't be so gross with Node CLI testing
54
- // TODO: See pepr/#1140
55
- if (process.env.TEST_MODE === "true") {
56
- prompts.inject([
57
- "pepr-test-module",
58
- "A test module for Pepr",
59
- "ignore",
60
- "static-test",
61
- "y",
62
- ]);
63
- pkgOverride = "file:../pepr-0.0.0-development.tgz";
64
- response = await walkthrough();
65
- } else {
66
- response = await walkthrough(thisCommand.opts());
67
- Object.entries(response).map(([key, value]) => thisCommand.setOptionValue(key, value));
68
- }
52
+ response = await walkthrough(thisCommand.opts());
53
+ Object.entries(response).map(([key, value]) => thisCommand.setOptionValue(key, value));
69
54
  })
70
55
  .action(async opts => {
71
56
  const dirName = sanitizeName(response.name);
72
- const packageJSON = genPkgJSON(response, pkgOverride);
57
+ const packageJSON = genPkgJSON(response);
73
58
 
74
59
  const confirmed = await confirm(dirName, packageJSON, peprTSTemplate.path, opts.yes);
75
60
 
@@ -49,7 +49,7 @@ export type peprPackageJSON = {
49
49
  print: string;
50
50
  };
51
51
 
52
- export function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPackageJSON {
52
+ export function genPkgJSON(opts: InitOptions): peprPackageJSON {
53
53
  // Generate a random UUID for the module based on the module name if it is not provided
54
54
  const uuid = !opts.uuid ? uuidv4() : opts.uuid;
55
55
  // Generate a name for the module based on the module name
@@ -57,11 +57,6 @@ export function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPack
57
57
  // Make typescript a dev dependency
58
58
  const { typescript } = peerDependencies;
59
59
 
60
- const testEnv = {
61
- MY_CUSTOM_VAR: "example-value",
62
- ZARF_VAR: "###ZARF_VAR_THING###",
63
- };
64
-
65
60
  const data = {
66
61
  name,
67
62
  version: "0.0.1",
@@ -71,7 +66,7 @@ export function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPack
71
66
  node: ">=20.0.0",
72
67
  },
73
68
  pepr: {
74
- uuid: pgkVerOverride ? "static-test" : uuid,
69
+ uuid: uuid,
75
70
  onError: opts.errorBehavior,
76
71
  webhookTimeout: 10,
77
72
  customLabels: {
@@ -93,13 +88,13 @@ export function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPack
93
88
  },
94
89
  },
95
90
  includedFiles: [],
96
- env: pgkVerOverride ? testEnv : {},
91
+ env: {},
97
92
  },
98
93
  scripts: {
99
94
  "k3d-setup": scripts["test:journey:k3d"],
100
95
  },
101
96
  dependencies: {
102
- pepr: pgkVerOverride || version,
97
+ pepr: version,
103
98
  undici: "^7.0.1",
104
99
  },
105
100
  devDependencies: {
package/src/cli/uuid.ts CHANGED
@@ -10,29 +10,8 @@ export default function (program: Command): void {
10
10
  .command("uuid [uuid]")
11
11
  .description("Module UUID(s) currently deployed in the cluster")
12
12
  .action(async uuid => {
13
- const uuidTable: Record<string, string> = {};
14
- let deployments: KubernetesListObject<kind.Deployment>;
15
-
16
- if (!uuid) {
17
- deployments = await K8s(kind.Deployment)
18
- .InNamespace("pepr-system")
19
- .WithLabel("pepr.dev/uuid")
20
- .Get();
21
- } else {
22
- deployments = await K8s(kind.Deployment)
23
- .InNamespace("pepr-system")
24
- .WithLabel("pepr.dev/uuid", uuid)
25
- .Get();
26
- }
27
-
28
- // Populate the uuidTable with the UUID and description
29
- deployments.items.map(deploy => {
30
- const uuid = deploy.metadata?.labels?.["pepr.dev/uuid"] || "";
31
- const description = deploy.metadata?.annotations?.["pepr.dev/description"] || "";
32
- if (uuid !== "") {
33
- uuidTable[uuid] = description;
34
- }
35
- });
13
+ const deployments = await getPeprDeploymentsByUUID(uuid);
14
+ const uuidTable = buildUUIDTable(deployments);
36
15
 
37
16
  console.log("UUID\t\tDescription");
38
17
  console.log("--------------------------------------------");
@@ -42,3 +21,41 @@ export default function (program: Command): void {
42
21
  });
43
22
  });
44
23
  }
24
+
25
+ export async function getPeprDeploymentsByUUID(
26
+ uuid?: string,
27
+ ): Promise<KubernetesListObject<kind.Deployment>> {
28
+ const k8sQuery = K8s(kind.Deployment).InNamespace("pepr-system");
29
+
30
+ let deployments = uuid
31
+ ? await k8sQuery.WithLabel("pepr.dev/uuid", uuid).Get()
32
+ : await k8sQuery.WithLabel("pepr.dev/uuid").Get();
33
+
34
+ if (uuid) {
35
+ deployments = {
36
+ ...deployments,
37
+ items: deployments.items.filter(
38
+ deploy => deploy.metadata?.labels?.["pepr.dev/uuid"] === uuid,
39
+ ),
40
+ };
41
+ }
42
+
43
+ return deployments;
44
+ }
45
+
46
+ export function buildUUIDTable(
47
+ deployments: KubernetesListObject<kind.Deployment>,
48
+ ): Record<string, string> {
49
+ const uuidTable: Record<string, string> = {};
50
+
51
+ deployments.items.forEach(deploy => {
52
+ const uuid = deploy.metadata?.labels?.["pepr.dev/uuid"] || "";
53
+ const description = deploy.metadata?.annotations?.["pepr.dev/description"] || "";
54
+
55
+ if (uuid !== "") {
56
+ uuidTable[uuid] = description;
57
+ }
58
+ });
59
+
60
+ return uuidTable;
61
+ }
@@ -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: {},