pepr 0.32.3 → 0.32.4
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.js +88 -18
- package/dist/controller.js +1 -1
- package/dist/lib/assets/deploy.d.ts +2 -0
- package/dist/lib/assets/deploy.d.ts.map +1 -1
- package/dist/lib/assets/index.d.ts +1 -1
- package/dist/lib/assets/index.d.ts.map +1 -1
- package/dist/lib/assets/pods.d.ts +2 -105
- package/dist/lib/assets/pods.d.ts.map +1 -1
- package/dist/lib/assets/yaml.d.ts +1 -1
- package/dist/lib/assets/yaml.d.ts.map +1 -1
- package/dist/lib/types.d.ts +13 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/lib/assets/deploy.ts +28 -1
- package/src/lib/assets/index.ts +2 -2
- package/src/lib/assets/pods.ts +21 -4
- package/src/lib/assets/yaml.ts +3 -4
- package/src/lib/types.ts +14 -0
package/dist/cli.js
CHANGED
|
@@ -475,7 +475,7 @@ function namespace(namespaceLabels) {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function watcher(assets, hash, buildTimestamp) {
|
|
478
|
+
function watcher(assets, hash, buildTimestamp, imagePullSecret) {
|
|
479
479
|
const { name: name2, image, capabilities, config } = assets;
|
|
480
480
|
let hasSchedule = false;
|
|
481
481
|
const app = `${name2}-watcher`;
|
|
@@ -490,7 +490,7 @@ function watcher(assets, hash, buildTimestamp) {
|
|
|
490
490
|
if (bindings.length < 1 && !hasSchedule) {
|
|
491
491
|
return null;
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
const deploy2 = {
|
|
494
494
|
apiVersion: "apps/v1",
|
|
495
495
|
kind: "Deployment",
|
|
496
496
|
metadata: {
|
|
@@ -612,11 +612,15 @@ function watcher(assets, hash, buildTimestamp) {
|
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
+
if (imagePullSecret) {
|
|
616
|
+
deploy2.spec.template.spec.imagePullSecrets = [{ name: imagePullSecret }];
|
|
617
|
+
}
|
|
618
|
+
return deploy2;
|
|
615
619
|
}
|
|
616
|
-
function deployment(assets, hash, buildTimestamp) {
|
|
620
|
+
function deployment(assets, hash, buildTimestamp, imagePullSecret) {
|
|
617
621
|
const { name: name2, image, config } = assets;
|
|
618
622
|
const app = name2;
|
|
619
|
-
|
|
623
|
+
const deploy2 = {
|
|
620
624
|
apiVersion: "apps/v1",
|
|
621
625
|
kind: "Deployment",
|
|
622
626
|
metadata: {
|
|
@@ -747,6 +751,10 @@ function deployment(assets, hash, buildTimestamp) {
|
|
|
747
751
|
}
|
|
748
752
|
}
|
|
749
753
|
};
|
|
754
|
+
if (imagePullSecret) {
|
|
755
|
+
deploy2.spec.template.spec.imagePullSecrets = [{ name: imagePullSecret }];
|
|
756
|
+
}
|
|
757
|
+
return deploy2;
|
|
750
758
|
}
|
|
751
759
|
function moduleSecret(name2, data, hash) {
|
|
752
760
|
const compressed = (0, import_zlib.gzipSync)(data);
|
|
@@ -1026,6 +1034,32 @@ async function webhookConfig(assets, mutateOrValidate, timeoutSeconds = 10) {
|
|
|
1026
1034
|
}
|
|
1027
1035
|
|
|
1028
1036
|
// src/lib/assets/deploy.ts
|
|
1037
|
+
async function deployImagePullSecret(imagePullSecret, name2) {
|
|
1038
|
+
try {
|
|
1039
|
+
await (0, import_kubernetes_fluent_client4.K8s)(import_kubernetes_fluent_client4.kind.Namespace).Get("pepr-system");
|
|
1040
|
+
} catch {
|
|
1041
|
+
await (0, import_kubernetes_fluent_client4.K8s)(import_kubernetes_fluent_client4.kind.Namespace).Apply(namespace());
|
|
1042
|
+
}
|
|
1043
|
+
try {
|
|
1044
|
+
await (0, import_kubernetes_fluent_client4.K8s)(import_kubernetes_fluent_client4.kind.Secret).Apply(
|
|
1045
|
+
{
|
|
1046
|
+
apiVersion: "v1",
|
|
1047
|
+
kind: "Secret",
|
|
1048
|
+
metadata: {
|
|
1049
|
+
name: name2,
|
|
1050
|
+
namespace: "pepr-system"
|
|
1051
|
+
},
|
|
1052
|
+
type: "kubernetes.io/dockerconfigjson",
|
|
1053
|
+
data: {
|
|
1054
|
+
".dockerconfigjson": Buffer.from(JSON.stringify(imagePullSecret)).toString("base64")
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
{ force: true }
|
|
1058
|
+
);
|
|
1059
|
+
} catch (e) {
|
|
1060
|
+
logger_default.error(e);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1029
1063
|
async function deploy(assets, force, webhookTimeout) {
|
|
1030
1064
|
logger_default.info("Establishing connection to Kubernetes");
|
|
1031
1065
|
const { name: name2, host, path } = assets;
|
|
@@ -1308,13 +1342,13 @@ function zarfYamlChart({ name: name2, image, config }, path) {
|
|
|
1308
1342
|
};
|
|
1309
1343
|
return (0, import_client_node.dumpYaml)(zarfCfg, { noRefs: true });
|
|
1310
1344
|
}
|
|
1311
|
-
async function allYaml(assets, rbacMode) {
|
|
1345
|
+
async function allYaml(assets, rbacMode, imagePullSecret) {
|
|
1312
1346
|
const { name: name2, tls, apiToken, path } = assets;
|
|
1313
1347
|
const code = await import_fs4.promises.readFile(path);
|
|
1314
1348
|
assets.hash = import_crypto2.default.createHash("sha256").update(code).digest("hex");
|
|
1315
1349
|
const mutateWebhook = await webhookConfig(assets, "mutate", assets.config.webhookTimeout);
|
|
1316
1350
|
const validateWebhook = await webhookConfig(assets, "validate", assets.config.webhookTimeout);
|
|
1317
|
-
const watchDeployment = watcher(assets, assets.hash, assets.buildTimestamp);
|
|
1351
|
+
const watchDeployment = watcher(assets, assets.hash, assets.buildTimestamp, imagePullSecret);
|
|
1318
1352
|
const resources = [
|
|
1319
1353
|
namespace(assets.config.customLabels?.namespace),
|
|
1320
1354
|
clusterRole(name2, assets.capabilities, rbacMode),
|
|
@@ -1322,7 +1356,7 @@ async function allYaml(assets, rbacMode) {
|
|
|
1322
1356
|
serviceAccount(name2),
|
|
1323
1357
|
apiTokenSecret(name2, apiToken),
|
|
1324
1358
|
tlsSecret(name2, tls),
|
|
1325
|
-
deployment(assets, assets.hash, assets.buildTimestamp),
|
|
1359
|
+
deployment(assets, assets.hash, assets.buildTimestamp, imagePullSecret),
|
|
1326
1360
|
service(name2),
|
|
1327
1361
|
watcherService(name2),
|
|
1328
1362
|
moduleSecret(name2, code, assets.hash),
|
|
@@ -1591,12 +1625,12 @@ var Assets = class {
|
|
|
1591
1625
|
};
|
|
1592
1626
|
zarfYaml = (path) => zarfYaml(this, path);
|
|
1593
1627
|
zarfYamlChart = (path) => zarfYamlChart(this, path);
|
|
1594
|
-
allYaml = async (rbacMode) => {
|
|
1628
|
+
allYaml = async (rbacMode, imagePullSecret) => {
|
|
1595
1629
|
this.capabilities = await loadCapabilities(this.path);
|
|
1596
1630
|
for (const capability of this.capabilities) {
|
|
1597
1631
|
namespaceComplianceValidator(capability, this.alwaysIgnore.namespaces);
|
|
1598
1632
|
}
|
|
1599
|
-
return allYaml(this, rbacMode);
|
|
1633
|
+
return allYaml(this, rbacMode, imagePullSecret);
|
|
1600
1634
|
};
|
|
1601
1635
|
generateHelmChart = async (basePath) => {
|
|
1602
1636
|
const CHART_DIR = `${basePath}/${this.config.uuid}-chart`;
|
|
@@ -1888,7 +1922,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
|
|
|
1888
1922
|
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```\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';
|
|
1889
1923
|
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';
|
|
1890
1924
|
var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\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\n .SetLabel("pepr", "was-here")\n .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>) {\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)\n .IsCreated()\n .InNamespace("pepr-demo-2")\n .WithName("example-4a")\n .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 .IsCreated()\n .WithLabel("chuck-norris")\n .Mutate(async change => {\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(\n "https://icanhazdadjoke.com/",\n {\n headers: {\n Accept: "application/json",\n },\n },\n );\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n // Add the Chuck Norris joke to the configmap\n change.Raw.data["chuck-says"] = response.data.joke;\n return;\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';
|
|
1891
|
-
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" }, version: "0.32.
|
|
1925
|
+
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" }, version: "0.32.4", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", "build:image": "npm run build && docker buildx build --tag pepr:dev .", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage --detectOpenHandles --coverageDirectory=./coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey:prep": "if [ ! -d ./pepr-upgrade-test ]; then git clone https://github.com/defenseunicorns/pepr-upgrade-test.git ; fi", "test:journey-wasm": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run-wasm", "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:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts && npm run test:journey:prep && npm run test:journey:upgrade", "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts", "test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && jest --detectOpenHandles journey/pepr-upgrade.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { "@types/ramda": "0.30.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.2", pino: "9.2.0", "pino-pretty": "11.2.1", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@fast-check/jest": "^1.8.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "fast-check": "^3.19.0", "@types/uuid": "10.0.0", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.5" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
|
|
1892
1926
|
|
|
1893
1927
|
// src/templates/pepr.code-snippets.json
|
|
1894
1928
|
var pepr_code_snippets_default = {
|
|
@@ -2140,6 +2174,9 @@ function build_default(program2) {
|
|
|
2140
2174
|
).option(
|
|
2141
2175
|
"-v, --version <version>. Example: '0.27.3'",
|
|
2142
2176
|
"The version of the Pepr image to use in the deployment manifests."
|
|
2177
|
+
).option(
|
|
2178
|
+
"--withPullSecret <imagePullSecret>",
|
|
2179
|
+
"Image Pull Secret: Use image pull secret for controller Deployment."
|
|
2143
2180
|
).addOption(
|
|
2144
2181
|
new import_commander.Option(
|
|
2145
2182
|
"--registry <GitHub|Iron Bank>",
|
|
@@ -2208,10 +2245,18 @@ function build_default(program2) {
|
|
|
2208
2245
|
if (image !== "") {
|
|
2209
2246
|
assets.image = image;
|
|
2210
2247
|
}
|
|
2248
|
+
if (opts.withPullSecret) {
|
|
2249
|
+
if (sanitizeResourceName(opts.withPullSecret) !== opts.withPullSecret) {
|
|
2250
|
+
console.error(
|
|
2251
|
+
"Invalid imagePullSecret. Please provide a valid name as defined in RFC 1123."
|
|
2252
|
+
);
|
|
2253
|
+
process.exit(1);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2211
2256
|
const yamlFile = `pepr-module-${uuid}.yaml`;
|
|
2212
2257
|
const chartPath = `${uuid}-chart`;
|
|
2213
2258
|
const yamlPath = (0, import_path2.resolve)(outputDir, yamlFile);
|
|
2214
|
-
const yaml = await assets.allYaml(opts.rbacMode);
|
|
2259
|
+
const yaml = await assets.allYaml(opts.rbacMode, opts.withPullSecret);
|
|
2215
2260
|
try {
|
|
2216
2261
|
validateCapabilityNames(assets.capabilities);
|
|
2217
2262
|
} catch (e) {
|
|
@@ -2359,7 +2404,32 @@ async function buildModule(reloader, entryPoint = peprTS2, embed = true) {
|
|
|
2359
2404
|
// src/cli/deploy.ts
|
|
2360
2405
|
var import_prompts = __toESM(require("prompts"));
|
|
2361
2406
|
function deploy_default(program2) {
|
|
2362
|
-
program2.command("deploy").description("Deploy a Pepr Module").option("-i, --image [image]", "Override the image tag").option("--confirm", "Skip confirmation prompt").option("--force", "Force deploy the module, override manager field").action(async (opts) => {
|
|
2407
|
+
program2.command("deploy").description("Deploy a Pepr Module").option("-i, --image [image]", "Override the image tag").option("--confirm", "Skip confirmation prompt").option("--pullSecret <name>", "Deploy imagePullSecret for Controller private registry").option("--docker-server <server>", "Docker server address").option("--docker-username <username>", "Docker registry username").option("--docker-email <email>", "Email for Docker registry").option("--docker-password <password>", "Password for Docker registry").option("--force", "Force deploy the module, override manager field").action(async (opts) => {
|
|
2408
|
+
let imagePullSecret;
|
|
2409
|
+
if (opts.pullSecret && opts.pullSecret.length > 0 && (!opts.dockerServer || !opts.dockerUsername || !opts.dockerEmail || !opts.dockerPassword)) {
|
|
2410
|
+
console.error(
|
|
2411
|
+
"Error: Must provide docker server, username, email, and password when providing pull secret"
|
|
2412
|
+
);
|
|
2413
|
+
process.exit(1);
|
|
2414
|
+
} else if (opts.pullSecret && opts.pullSecret !== sanitizeName(opts.pullSecret)) {
|
|
2415
|
+
console.error(
|
|
2416
|
+
"Invalid imagePullSecret name. Please provide a valid name as defined in RFC 1123."
|
|
2417
|
+
);
|
|
2418
|
+
process.exit(1);
|
|
2419
|
+
} else if (opts.pullSecret) {
|
|
2420
|
+
imagePullSecret = {
|
|
2421
|
+
auths: {
|
|
2422
|
+
[opts.dockerServer]: {
|
|
2423
|
+
username: opts.dockerUsername,
|
|
2424
|
+
password: opts.dockerPassword,
|
|
2425
|
+
email: opts.dockerEmail,
|
|
2426
|
+
auth: Buffer.from(`${opts.dockerUsername}:${opts.dockerPassword}`).toString("base64")
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
};
|
|
2430
|
+
await deployImagePullSecret(imagePullSecret, opts.pullSecret);
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2363
2433
|
if (!opts.confirm) {
|
|
2364
2434
|
const confirm2 = await (0, import_prompts.default)({
|
|
2365
2435
|
type: "confirm",
|
|
@@ -2504,19 +2574,19 @@ function monitor_default(program2) {
|
|
|
2504
2574
|
kc.loadFromDefault();
|
|
2505
2575
|
const log = new import_client_node4.Log(kc);
|
|
2506
2576
|
const logStream = new import_stream.default.PassThrough();
|
|
2507
|
-
logStream.on("data", (chunk) => {
|
|
2577
|
+
logStream.on("data", async (chunk) => {
|
|
2508
2578
|
const respMsg = `"msg":"Check response"`;
|
|
2509
|
-
const lines = chunk.toString().split("\n");
|
|
2579
|
+
const lines = await chunk.toString().split("\n");
|
|
2510
2580
|
for (const line of lines) {
|
|
2511
2581
|
if (line.includes(respMsg)) {
|
|
2512
2582
|
try {
|
|
2513
|
-
const payload = JSON.parse(line);
|
|
2583
|
+
const payload = JSON.parse(line.trim());
|
|
2514
2584
|
const isMutate = payload.res.patchType || payload.res.warnings;
|
|
2515
2585
|
const name2 = `${payload.namespace}${payload.name}`;
|
|
2516
|
-
const uid = payload.uid;
|
|
2586
|
+
const uid = payload.res.uid;
|
|
2517
2587
|
if (isMutate) {
|
|
2518
|
-
const plainPatch = atob(payload.res.patch)
|
|
2519
|
-
const patch = JSON.stringify(JSON.parse(plainPatch), null, 2);
|
|
2588
|
+
const plainPatch = payload.res?.patch !== void 0 && payload.res?.patch !== null ? atob(payload.res.patch) : "";
|
|
2589
|
+
const patch = plainPatch !== "" && JSON.stringify(JSON.parse(plainPatch), null, 2);
|
|
2520
2590
|
const patchType = payload.res.patchType || payload.res.warnings || "";
|
|
2521
2591
|
const allowOrDeny = payload.res.allowed ? "\u{1F500}" : "\u{1F6AB}";
|
|
2522
2592
|
console.log(`
|
package/dist/controller.js
CHANGED
|
@@ -51,7 +51,7 @@ if (process.env.LOG_LEVEL) {
|
|
|
51
51
|
var logger_default = Log;
|
|
52
52
|
|
|
53
53
|
// src/templates/data.json
|
|
54
|
-
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" }, version: "0.32.
|
|
54
|
+
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" }, version: "0.32.4", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", "build:image": "npm run build && docker buildx build --tag pepr:dev .", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage --detectOpenHandles --coverageDirectory=./coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey:prep": "if [ ! -d ./pepr-upgrade-test ]; then git clone https://github.com/defenseunicorns/pepr-upgrade-test.git ; fi", "test:journey-wasm": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run-wasm", "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:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts && npm run test:journey:prep && npm run test:journey:upgrade", "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts", "test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && jest --detectOpenHandles journey/pepr-upgrade.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { "@types/ramda": "0.30.0", express: "4.19.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "2.6.2", pino: "9.2.0", "pino-pretty": "11.2.1", "prom-client": "15.1.2", ramda: "0.30.1" }, devDependencies: { "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@fast-check/jest": "^1.8.2", "@jest/globals": "29.7.0", "@types/eslint": "8.56.10", "@types/express": "4.17.21", "@types/node": "18.x.x", "@types/node-forge": "1.3.11", "@types/prompts": "2.4.9", "fast-check": "^3.19.0", "@types/uuid": "10.0.0", jest: "29.7.0", nock: "13.5.4", "ts-jest": "29.1.5" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.15.0", "@typescript-eslint/parser": "6.15.0", commander: "11.1.0", esbuild: "0.19.10", eslint: "8.56.0", "node-forge": "1.3.1", prettier: "3.1.1", prompts: "2.4.2", typescript: "5.3.3", uuid: "9.0.1" } };
|
|
55
55
|
|
|
56
56
|
// src/lib/k8s.ts
|
|
57
57
|
var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Assets } from ".";
|
|
2
|
+
import { ImagePullSecret } from "../types";
|
|
3
|
+
export declare function deployImagePullSecret(imagePullSecret: ImagePullSecret, name: string): Promise<void>;
|
|
2
4
|
export declare function deploy(assets: Assets, force: boolean, webhookTimeout?: number): Promise<void>;
|
|
3
5
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAO3B,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7D,wBAAsB,qBAAqB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,iBA0BzF;AACD,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,iBA8CnF"}
|
|
@@ -19,7 +19,7 @@ export declare class Assets {
|
|
|
19
19
|
deploy: (force: boolean, webhookTimeout?: number) => Promise<void>;
|
|
20
20
|
zarfYaml: (path: string) => string;
|
|
21
21
|
zarfYamlChart: (path: string) => string;
|
|
22
|
-
allYaml: (rbacMode: string) => Promise<string>;
|
|
22
|
+
allYaml: (rbacMode: string, imagePullSecret?: string) => Promise<string>;
|
|
23
23
|
generateHelmChart: (basePath: string) => Promise<void>;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAA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C;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAG,aAAa,CAAC;IACtC,YAAY,EAAG,gBAAgB,EAAE,CAAC;IAElC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;gBAGF,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,oBAAQ;IAcxB,OAAO,SAAU,MAAM,UAErB;IAEF,MAAM,UAAiB,OAAO,mBAAmB,MAAM,mBAGrD;IAEF,QAAQ,SAAU,MAAM,YAA0B;IAElD,aAAa,SAAU,MAAM,YAA+B;IAE5D,OAAO,aAAoB,MAAM,oBAAoB,MAAM,qBAQzD;IAEF,iBAAiB,aAAoB,MAAM,mBAoGzC;CACH"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { V1EnvVar } from "@kubernetes/client-node";
|
|
3
2
|
import { kind } from "kubernetes-fluent-client";
|
|
4
3
|
import { Assets } from ".";
|
|
5
4
|
/** Generate the pepr-system namespace */
|
|
@@ -18,109 +17,7 @@ export declare function namespace(namespaceLabels?: Record<string, string>): {
|
|
|
18
17
|
labels?: undefined;
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
|
-
export declare function watcher(assets: Assets, hash: string, buildTimestamp: string):
|
|
22
|
-
|
|
23
|
-
kind: string;
|
|
24
|
-
metadata: {
|
|
25
|
-
name: string;
|
|
26
|
-
namespace: string;
|
|
27
|
-
annotations: {
|
|
28
|
-
"pepr.dev/description": string;
|
|
29
|
-
};
|
|
30
|
-
labels: {
|
|
31
|
-
app: string;
|
|
32
|
-
"pepr.dev/controller": string;
|
|
33
|
-
"pepr.dev/uuid": string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
spec: {
|
|
37
|
-
replicas: number;
|
|
38
|
-
strategy: {
|
|
39
|
-
type: string;
|
|
40
|
-
};
|
|
41
|
-
selector: {
|
|
42
|
-
matchLabels: {
|
|
43
|
-
app: string;
|
|
44
|
-
"pepr.dev/controller": string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
template: {
|
|
48
|
-
metadata: {
|
|
49
|
-
annotations: {
|
|
50
|
-
buildTimestamp: string;
|
|
51
|
-
};
|
|
52
|
-
labels: {
|
|
53
|
-
app: string;
|
|
54
|
-
"pepr.dev/controller": string;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
spec: {
|
|
58
|
-
terminationGracePeriodSeconds: number;
|
|
59
|
-
serviceAccountName: string;
|
|
60
|
-
securityContext: {
|
|
61
|
-
runAsUser: number;
|
|
62
|
-
runAsGroup: number;
|
|
63
|
-
runAsNonRoot: boolean;
|
|
64
|
-
fsGroup: number;
|
|
65
|
-
};
|
|
66
|
-
containers: {
|
|
67
|
-
name: string;
|
|
68
|
-
image: string;
|
|
69
|
-
imagePullPolicy: string;
|
|
70
|
-
command: string[];
|
|
71
|
-
readinessProbe: {
|
|
72
|
-
httpGet: {
|
|
73
|
-
path: string;
|
|
74
|
-
port: number;
|
|
75
|
-
scheme: string;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
livenessProbe: {
|
|
79
|
-
httpGet: {
|
|
80
|
-
path: string;
|
|
81
|
-
port: number;
|
|
82
|
-
scheme: string;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
ports: {
|
|
86
|
-
containerPort: number;
|
|
87
|
-
}[];
|
|
88
|
-
resources: {
|
|
89
|
-
requests: {
|
|
90
|
-
memory: string;
|
|
91
|
-
cpu: string;
|
|
92
|
-
};
|
|
93
|
-
limits: {
|
|
94
|
-
memory: string;
|
|
95
|
-
cpu: string;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
securityContext: {
|
|
99
|
-
runAsUser: number;
|
|
100
|
-
runAsGroup: number;
|
|
101
|
-
runAsNonRoot: boolean;
|
|
102
|
-
allowPrivilegeEscalation: boolean;
|
|
103
|
-
capabilities: {
|
|
104
|
-
drop: string[];
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
volumeMounts: {
|
|
108
|
-
name: string;
|
|
109
|
-
mountPath: string;
|
|
110
|
-
readOnly: boolean;
|
|
111
|
-
}[];
|
|
112
|
-
env: V1EnvVar[];
|
|
113
|
-
}[];
|
|
114
|
-
volumes: {
|
|
115
|
-
name: string;
|
|
116
|
-
secret: {
|
|
117
|
-
secretName: string;
|
|
118
|
-
};
|
|
119
|
-
}[];
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
} | null;
|
|
124
|
-
export declare function deployment(assets: Assets, hash: string, buildTimestamp: string): kind.Deployment;
|
|
20
|
+
export declare function watcher(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string): kind.Deployment | null;
|
|
21
|
+
export declare function deployment(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string): kind.Deployment;
|
|
125
22
|
export declare function moduleSecret(name: string, data: Buffer, hash: string): kind.Secret;
|
|
126
23
|
//# sourceMappingURL=pods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pods.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/pods.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"pods.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/pods.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAI3B,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;EAmBjE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,0BAuJrG;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,GACvB,IAAI,CAAC,UAAU,CA6IjB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAuBlF"}
|
|
@@ -2,5 +2,5 @@ import { Assets } from ".";
|
|
|
2
2
|
export declare function overridesFile({ hash, name, image, config, apiToken }: Assets, path: string): Promise<void>;
|
|
3
3
|
export declare function zarfYaml({ name, image, config }: Assets, path: string): string;
|
|
4
4
|
export declare function zarfYamlChart({ name, image, config }: Assets, path: string): string;
|
|
5
|
-
export declare function allYaml(assets: Assets, rbacMode: string): Promise<string>;
|
|
5
|
+
export declare function allYaml(assets: Assets, rbacMode: string, imagePullSecret?: string): Promise<string>;
|
|
6
6
|
//# sourceMappingURL=yaml.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/yaml.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAO3B,wBAAsB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAwHhG;AACD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA0BrE;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA2B1E;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/yaml.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAO3B,wBAAsB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAwHhG;AACD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA0BrE;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA2B1E;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,mBAwCvF"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -2,6 +2,19 @@ import { GenericClass, GroupVersionKind, KubernetesObject } from "kubernetes-flu
|
|
|
2
2
|
import { WatchAction } from "kubernetes-fluent-client/dist/fluent/types";
|
|
3
3
|
import { PeprMutateRequest } from "./mutate-request";
|
|
4
4
|
import { PeprValidateRequest } from "./validate-request";
|
|
5
|
+
/**
|
|
6
|
+
* Specifically for deploying images with a private registry
|
|
7
|
+
*/
|
|
8
|
+
export interface ImagePullSecret {
|
|
9
|
+
auths: {
|
|
10
|
+
[server: string]: {
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
email: string;
|
|
14
|
+
auth: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Specifically for parsing logs in monitor mode
|
|
7
20
|
*/
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
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C,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAClF,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,CAC/F,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,KACtB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,CACjG,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,KACxB,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.32.
|
|
12
|
+
"version": "0.32.4",
|
|
13
13
|
"main": "dist/lib.js",
|
|
14
14
|
"types": "dist/lib.d.ts",
|
|
15
15
|
"scripts": {
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@commitlint/cli": "19.3.0",
|
|
46
46
|
"@commitlint/config-conventional": "19.2.2",
|
|
47
|
+
"@fast-check/jest": "^1.8.2",
|
|
47
48
|
"@jest/globals": "29.7.0",
|
|
48
49
|
"@types/eslint": "8.56.10",
|
|
49
50
|
"@types/express": "4.17.21",
|
|
50
51
|
"@types/node": "18.x.x",
|
|
51
52
|
"@types/node-forge": "1.3.11",
|
|
52
53
|
"@types/prompts": "2.4.9",
|
|
53
|
-
"
|
|
54
|
+
"fast-check": "^3.19.0",
|
|
55
|
+
"@types/uuid": "10.0.0",
|
|
54
56
|
"jest": "29.7.0",
|
|
55
57
|
"nock": "13.5.4",
|
|
56
58
|
"ts-jest": "29.1.5"
|
package/src/lib/assets/deploy.ts
CHANGED
|
@@ -12,8 +12,35 @@ import { deployment, moduleSecret, namespace, watcher } from "./pods";
|
|
|
12
12
|
import { clusterRole, clusterRoleBinding, serviceAccount, storeRole, storeRoleBinding } from "./rbac";
|
|
13
13
|
import { peprStoreCRD } from "./store";
|
|
14
14
|
import { webhookConfig } from "./webhooks";
|
|
15
|
-
import { CapabilityExport } from "../types";
|
|
15
|
+
import { CapabilityExport, ImagePullSecret } from "../types";
|
|
16
16
|
|
|
17
|
+
export async function deployImagePullSecret(imagePullSecret: ImagePullSecret, name: string) {
|
|
18
|
+
try {
|
|
19
|
+
await K8s(kind.Namespace).Get("pepr-system");
|
|
20
|
+
} catch {
|
|
21
|
+
await K8s(kind.Namespace).Apply(namespace());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
await K8s(kind.Secret).Apply(
|
|
26
|
+
{
|
|
27
|
+
apiVersion: "v1",
|
|
28
|
+
kind: "Secret",
|
|
29
|
+
metadata: {
|
|
30
|
+
name,
|
|
31
|
+
namespace: "pepr-system",
|
|
32
|
+
},
|
|
33
|
+
type: "kubernetes.io/dockerconfigjson",
|
|
34
|
+
data: {
|
|
35
|
+
".dockerconfigjson": Buffer.from(JSON.stringify(imagePullSecret)).toString("base64"),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{ force: true },
|
|
39
|
+
);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
Log.error(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
17
44
|
export async function deploy(assets: Assets, force: boolean, webhookTimeout?: number) {
|
|
18
45
|
Log.info("Establishing connection to Kubernetes");
|
|
19
46
|
|
package/src/lib/assets/index.ts
CHANGED
|
@@ -61,14 +61,14 @@ export class Assets {
|
|
|
61
61
|
|
|
62
62
|
zarfYamlChart = (path: string) => zarfYamlChart(this, path);
|
|
63
63
|
|
|
64
|
-
allYaml = async (rbacMode: string) => {
|
|
64
|
+
allYaml = async (rbacMode: string, imagePullSecret?: string) => {
|
|
65
65
|
this.capabilities = await loadCapabilities(this.path);
|
|
66
66
|
// give error if namespaces are not respected
|
|
67
67
|
for (const capability of this.capabilities) {
|
|
68
68
|
namespaceComplianceValidator(capability, this.alwaysIgnore.namespaces);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return allYaml(this, rbacMode);
|
|
71
|
+
return allYaml(this, rbacMode, imagePullSecret);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
generateHelmChart = async (basePath: string) => {
|
package/src/lib/assets/pods.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function namespace(namespaceLabels?: Record<string, string>) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function watcher(assets: Assets, hash: string, buildTimestamp: string) {
|
|
34
|
+
export function watcher(assets: Assets, hash: string, buildTimestamp: string, imagePullSecret?: string) {
|
|
35
35
|
const { name, image, capabilities, config } = assets;
|
|
36
36
|
|
|
37
37
|
let hasSchedule = false;
|
|
@@ -54,7 +54,7 @@ export function watcher(assets: Assets, hash: string, buildTimestamp: string) {
|
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
const deploy: kind.Deployment = {
|
|
58
58
|
apiVersion: "apps/v1",
|
|
59
59
|
kind: "Deployment",
|
|
60
60
|
metadata: {
|
|
@@ -176,13 +176,24 @@ export function watcher(assets: Assets, hash: string, buildTimestamp: string) {
|
|
|
176
176
|
},
|
|
177
177
|
},
|
|
178
178
|
};
|
|
179
|
+
|
|
180
|
+
if (imagePullSecret) {
|
|
181
|
+
deploy.spec!.template.spec!.imagePullSecrets = [{ name: imagePullSecret }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return deploy;
|
|
179
185
|
}
|
|
180
186
|
|
|
181
|
-
export function deployment(
|
|
187
|
+
export function deployment(
|
|
188
|
+
assets: Assets,
|
|
189
|
+
hash: string,
|
|
190
|
+
buildTimestamp: string,
|
|
191
|
+
imagePullSecret?: string,
|
|
192
|
+
): kind.Deployment {
|
|
182
193
|
const { name, image, config } = assets;
|
|
183
194
|
const app = name;
|
|
184
195
|
|
|
185
|
-
|
|
196
|
+
const deploy: kind.Deployment = {
|
|
186
197
|
apiVersion: "apps/v1",
|
|
187
198
|
kind: "Deployment",
|
|
188
199
|
metadata: {
|
|
@@ -313,6 +324,12 @@ export function deployment(assets: Assets, hash: string, buildTimestamp: string)
|
|
|
313
324
|
},
|
|
314
325
|
},
|
|
315
326
|
};
|
|
327
|
+
|
|
328
|
+
if (imagePullSecret) {
|
|
329
|
+
deploy.spec!.template.spec!.imagePullSecrets = [{ name: imagePullSecret }];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return deploy;
|
|
316
333
|
}
|
|
317
334
|
|
|
318
335
|
export function moduleSecret(name: string, data: Buffer, hash: string): kind.Secret {
|
package/src/lib/assets/yaml.ts
CHANGED
|
@@ -190,9 +190,8 @@ export function zarfYamlChart({ name, image, config }: Assets, path: string) {
|
|
|
190
190
|
return dumpYaml(zarfCfg, { noRefs: true });
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
export async function allYaml(assets: Assets, rbacMode: string) {
|
|
193
|
+
export async function allYaml(assets: Assets, rbacMode: string, imagePullSecret?: string) {
|
|
194
194
|
const { name, tls, apiToken, path } = assets;
|
|
195
|
-
|
|
196
195
|
const code = await fs.readFile(path);
|
|
197
196
|
|
|
198
197
|
// Generate a hash of the code
|
|
@@ -200,7 +199,7 @@ export async function allYaml(assets: Assets, rbacMode: string) {
|
|
|
200
199
|
|
|
201
200
|
const mutateWebhook = await webhookConfig(assets, "mutate", assets.config.webhookTimeout);
|
|
202
201
|
const validateWebhook = await webhookConfig(assets, "validate", assets.config.webhookTimeout);
|
|
203
|
-
const watchDeployment = watcher(assets, assets.hash, assets.buildTimestamp);
|
|
202
|
+
const watchDeployment = watcher(assets, assets.hash, assets.buildTimestamp, imagePullSecret);
|
|
204
203
|
|
|
205
204
|
const resources = [
|
|
206
205
|
namespace(assets.config.customLabels?.namespace),
|
|
@@ -209,7 +208,7 @@ export async function allYaml(assets: Assets, rbacMode: string) {
|
|
|
209
208
|
serviceAccount(name),
|
|
210
209
|
apiTokenSecret(name, apiToken),
|
|
211
210
|
tlsSecret(name, tls),
|
|
212
|
-
deployment(assets, assets.hash, assets.buildTimestamp),
|
|
211
|
+
deployment(assets, assets.hash, assets.buildTimestamp, imagePullSecret),
|
|
213
212
|
service(name),
|
|
214
213
|
watcherService(name),
|
|
215
214
|
moduleSecret(name, code, assets.hash),
|
package/src/lib/types.ts
CHANGED
|
@@ -7,6 +7,20 @@ import { WatchAction } from "kubernetes-fluent-client/dist/fluent/types";
|
|
|
7
7
|
import { PeprMutateRequest } from "./mutate-request";
|
|
8
8
|
import { PeprValidateRequest } from "./validate-request";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Specifically for deploying images with a private registry
|
|
12
|
+
*/
|
|
13
|
+
export interface ImagePullSecret {
|
|
14
|
+
auths: {
|
|
15
|
+
[server: string]: {
|
|
16
|
+
username: string;
|
|
17
|
+
password: string;
|
|
18
|
+
email: string;
|
|
19
|
+
auth: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
/**
|
|
11
25
|
* Specifically for parsing logs in monitor mode
|
|
12
26
|
*/
|