@illuin-public/wombat-pulumi 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -0
- package/bin/components/args/commons-args.d.ts +4 -0
- package/bin/components/args/commons-args.js +3 -0
- package/bin/components/args/commons-args.js.map +1 -0
- package/bin/components/args/commons-config.d.ts +3 -0
- package/bin/components/args/commons-config.js +14 -0
- package/bin/components/args/commons-config.js.map +1 -0
- package/bin/components/args/dependencies-args.d.ts +23 -0
- package/bin/components/args/dependencies-args.js +9 -0
- package/bin/components/args/dependencies-args.js.map +1 -0
- package/bin/components/args/dependencies-config.d.ts +8 -0
- package/bin/components/args/dependencies-config.js +70 -0
- package/bin/components/args/dependencies-config.js.map +1 -0
- package/bin/components/args/extensions-args.d.ts +12 -0
- package/bin/components/args/extensions-args.js +3 -0
- package/bin/components/args/extensions-args.js.map +1 -0
- package/bin/components/args/extensions-config.d.ts +6 -0
- package/bin/components/args/extensions-config.js +14 -0
- package/bin/components/args/extensions-config.js.map +1 -0
- package/bin/components/args/k8s-args.d.ts +17 -0
- package/bin/components/args/k8s-args.js +3 -0
- package/bin/components/args/k8s-args.js.map +1 -0
- package/bin/components/args/k8s-config.d.ts +10 -0
- package/bin/components/args/k8s-config.js +9 -0
- package/bin/components/args/k8s-config.js.map +1 -0
- package/bin/components/args/monitored-environments-args.d.ts +72 -0
- package/bin/components/args/monitored-environments-args.js +10 -0
- package/bin/components/args/monitored-environments-args.js.map +1 -0
- package/bin/components/args/monitored-environments-config.d.ts +6 -0
- package/bin/components/args/monitored-environments-config.js +59 -0
- package/bin/components/args/monitored-environments-config.js.map +1 -0
- package/bin/components/args/persistence-args.d.ts +32 -0
- package/bin/components/args/persistence-args.js +9 -0
- package/bin/components/args/persistence-args.js.map +1 -0
- package/bin/components/args/persistence-config.d.ts +6 -0
- package/bin/components/args/persistence-config.js +29 -0
- package/bin/components/args/persistence-config.js.map +1 -0
- package/bin/components/args/wombat-args.d.ts +55 -0
- package/bin/components/args/wombat-args.js +3 -0
- package/bin/components/args/wombat-args.js.map +1 -0
- package/bin/components/args/wombat-config.d.ts +4 -0
- package/bin/components/args/wombat-config.js +36 -0
- package/bin/components/args/wombat-config.js.map +1 -0
- package/bin/components/utils/basic-auth.d.ts +20 -0
- package/bin/components/utils/basic-auth.js +38 -0
- package/bin/components/utils/basic-auth.js.map +1 -0
- package/bin/components/utils/image-pull-secrets.d.ts +51 -0
- package/bin/components/utils/image-pull-secrets.js +62 -0
- package/bin/components/utils/image-pull-secrets.js.map +1 -0
- package/bin/components/utils/tools.d.ts +26 -0
- package/bin/components/utils/tools.js +65 -0
- package/bin/components/utils/tools.js.map +1 -0
- package/bin/components/wombat.d.ts +6 -0
- package/bin/components/wombat.js +241 -0
- package/bin/components/wombat.js.map +1 -0
- package/bin/index.d.ts +18 -0
- package/bin/index.js +35 -0
- package/bin/index.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @illuin-public/wombat-pulumi
|
|
2
|
+
|
|
3
|
+
Pulumi Component Resource library for deploying the `wombat` service to Kubernetes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @illuin-public/wombat-pulumi
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
15
|
+
import { WombatResource, WombatArgs } from "@illuin-public/wombat-pulumi";
|
|
16
|
+
|
|
17
|
+
const config = new pulumi.Config();
|
|
18
|
+
const serviceArgs = config.requireObject<WombatArgs>("service");
|
|
19
|
+
|
|
20
|
+
export const wombat = new WombatResource("wombat", serviceArgs);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration Reference (`WombatArgs`)
|
|
24
|
+
|
|
25
|
+
All service settings live under the `service` config key (or pass them directly as `WombatArgs`).
|
|
26
|
+
|
|
27
|
+
### Application & Monitoring Configuration
|
|
28
|
+
|
|
29
|
+
* `config.monitor.heartbeat`: CRON expression controlling how often monitored assets are polled (e.g. `"*/10 * * * * ?"`).
|
|
30
|
+
* `config.metrics.aggregationWindow`: `{ duration: number, unit: "MINUTES" | "HOURS" | "DAYS" }` specifying the time window for metrics aggregation (e.g. `{ duration: 5, unit: "MINUTES" }`).
|
|
31
|
+
* `config.ui.maxDateRange`: `{ duration: number, unit: "DAYS" | "MONTHS" | "YEARS" }` specifying the maximum date range queryable in the dashboard UI (e.g. `{ duration: 1, unit: "YEARS" }`).
|
|
32
|
+
|
|
33
|
+
### Monitored Environments
|
|
34
|
+
|
|
35
|
+
* `monitoredEnvironments.environments`: a map of environment id → `{ id, name, assets }`, where each asset has a `type`, `id`, `name`, optional `resolvers`, and a `profile` configuration:
|
|
36
|
+
* `tech.illuin.wombat-module.kubernetes-api`: reads cluster workload via a mounted kubeconfig. Parameters include `namespace`, optional `context`, `readTimeout`, `heartbeatSkip`, and `profile` (`provider`, `instanceType`, `location`, `lifespan`).
|
|
37
|
+
* `tech.illuin.wombat-module.llm-static`: static LLM traffic estimation. Parameters include `profile.models` array (`provider`, `model`, `location`, `requestProfile.outputTokenCount`, `requestProfile.requestPerYear`).
|
|
38
|
+
* `tech.illuin.wombat-module.llm-prometheus`: live LLM metrics polled from a Prometheus endpoint. Parameters include `prometheusUrl`, optional `proxyUrl`, `username`, `passwordKey`, `heartbeatSkip`, and `profile` (`provider`, `model`, `location`, `dynamicProfile.query`).
|
|
39
|
+
|
|
40
|
+
Monitoring configurations are compiled into a `/monitored/monitored-environments.yaml` file mounted in the container. Each `tech.illuin.wombat-module.kubernetes-api` asset's `config-path` is automatically pointed to `/kubeconfigs/<id>.config`.
|
|
41
|
+
|
|
42
|
+
### Kubeconfigs & Secret Management
|
|
43
|
+
|
|
44
|
+
#### Kubeconfigs
|
|
45
|
+
Kubeconfigs are supplied inline as strings in `monitoredEnvironments.kubeconfigs`. Set each via the Pulumi CLI as a secret:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pulumi config set --secret --path 'service.monitoredEnvironments.kubeconfigs[0].content' -- "$(cat /path/to/kubeconfig)"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
They are compiled into a Kubernetes `Secret` and mounted into the container under `/kubeconfigs/<id>.config`.
|
|
52
|
+
|
|
53
|
+
#### Runtime Secrets
|
|
54
|
+
Generic runtime secrets (e.g. Prometheus passwords referenced in `passwordKey`) are declared under `secrets`:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pulumi config set --secret --path 'service.secrets.WOMBAT_PROMETHEUS_PASSWORD' <password>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
When provided, Pulumi provisions a Kubernetes `Secret` mounted as a directory volume at `/secrets`, and configures `wombat.secret.directory.path: /secrets`. The backend's `DirectorySecretResolver` resolves secrets directly from this directory.
|
|
61
|
+
|
|
62
|
+
### Extensions
|
|
63
|
+
|
|
64
|
+
Mount user-provided extension JARs into the container (default mount path `/extensions`):
|
|
65
|
+
|
|
66
|
+
* `extensions.existingClaimName`: reference an existing PersistentVolumeClaim.
|
|
67
|
+
* `extensions.pvc`: provision a managed PVC with `size` (e.g. `1Gi`), `storageClassName`, and `accessModes` (e.g. `["ReadWriteOnce"]`).
|
|
68
|
+
* `extensions.mountPath`: optional custom mount path inside the container (defaults to `/extensions`).
|
|
69
|
+
|
|
70
|
+
### Dependencies & Connectors
|
|
71
|
+
|
|
72
|
+
Wombat can use either container sidecars or external endpoints for BoaviztAPI and Ecologits:
|
|
73
|
+
|
|
74
|
+
* `dependencies.boaviztapi`: `CONTAINER` (defaults to sidecar with BoaviztAPI `2.4.1`) or `EXTERNAL` with `endpoint`.
|
|
75
|
+
* `dependencies.ecologits`: `CONTAINER` (defaults to sidecar with Ecologits `0.0.2`) or `EXTERNAL` with `endpoint`.
|
|
76
|
+
|
|
77
|
+
These are automatically mapped to `connector.boavizta.uri` and `connector.ecologits.uri` in the container configuration.
|
|
78
|
+
|
|
79
|
+
### Persistence
|
|
80
|
+
|
|
81
|
+
#### Persistence Modes
|
|
82
|
+
* `persistence.type`: `SQLITE_TRANSIENT` (in-memory SQLite, Deployment) or `SQLITE_WITH_BACKUP` (file-backed SQLite with S3 backup, StatefulSet).
|
|
83
|
+
|
|
84
|
+
#### S3 Backup
|
|
85
|
+
* `persistence.backup.enabled` (boolean, default `true` when using `SQLITE_WITH_BACKUP`): enables the periodic SQLite backup service.
|
|
86
|
+
* `persistence.backup.cron`: cron expression for the backup schedule (default `0 0 2 * * ?`, i.e. daily at 2am).
|
|
87
|
+
* `persistence.backup.restoreOnStartup`: boolean, restore latest S3 backup snapshot on container startup (default `true`).
|
|
88
|
+
* `persistence.backup.cleanup.cron`: cron expression for old backup cleanup (e.g. `0 0 3 * * ?`).
|
|
89
|
+
* `persistence.backup.cleanup.retainLast`: number of most recent snapshots to retain in S3 (e.g. `25`).
|
|
90
|
+
* `persistence.backup.s3`: **required when `backup.enabled` is `true`**. Set `endpoint`, `bucket`, `accessKey`, `secretKey`, and optionally `keyPrefix` and `region`.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pulumi config set --path 'service.persistence.backup.s3.endpoint' https://s3.example.com
|
|
94
|
+
pulumi config set --path 'service.persistence.backup.s3.bucket' wombat-backup
|
|
95
|
+
pulumi config set --secret --path 'service.persistence.backup.s3.accessKey' <access-key>
|
|
96
|
+
pulumi config set --secret --path 'service.persistence.backup.s3.secretKey' <secret-key>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Other Useful Settings
|
|
100
|
+
|
|
101
|
+
* `container.imageVersion`: the `wombat` image tag to deploy.
|
|
102
|
+
* `container.pullSecret`: optional; GAR/GCR service account JSON (as a secret) for pulling the image from a private registry.
|
|
103
|
+
* `resources`: K8S `resources.limits` and `resources.requests` for the container.
|
|
104
|
+
* `jvmOptions`: JVM options such as `xms: 512M`, `xmx: 512M`.
|
|
105
|
+
* `ingress`: optional; set `className`, `host`, `path`, `pathType`, `annotations`, and `tlsSecretName` to expose the service through an `Ingress`.
|
|
106
|
+
* `ingress.basicAuth`: optional; set `username` and `password` (optionally `realm`) to protect the ingress with HTTP basic auth. A `Secret` holding the corresponding htpasswd entry is created automatically.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons-args.js","sourceRoot":"","sources":["../../../components/args/commons-args.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOverrideConf = createOverrideConf;
|
|
4
|
+
const tools_1 = require("../utils/tools");
|
|
5
|
+
const yaml = require("yaml");
|
|
6
|
+
function createOverrideConf(args) {
|
|
7
|
+
let overridden = Object.assign({}, args);
|
|
8
|
+
return new tools_1.ConfGroup("/conf", "application-conf", [{
|
|
9
|
+
id: "application-conf",
|
|
10
|
+
filename: "application-dynamic.yaml",
|
|
11
|
+
data: yaml.stringify((0, tools_1.kebabize)(overridden)),
|
|
12
|
+
}]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=commons-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons-config.js","sourceRoot":"","sources":["../../../components/args/commons-config.ts"],"names":[],"mappings":";;AAIA,gDAWC;AAdD,0CAAmD;AACnD,6BAA6B;AAE7B,SAAgB,kBAAkB,CAAC,IAAwB;IACvD,IAAI,UAAU,qBAA4B,IAAI,CAAE,CAAC;IACjD,OAAO,IAAI,iBAAS,CAChB,OAAO,EACP,kBAAkB,EAClB,CAAC;YACG,EAAE,EAAE,kBAAkB;YACtB,QAAQ,EAAE,0BAA0B;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAA,gBAAQ,EAAC,UAAU,CAAC,CAAC;SAC7C,CAAC,CACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export declare enum DependencyMode {
|
|
3
|
+
EXTERNAL = "EXTERNAL",
|
|
4
|
+
CONTAINER = "CONTAINER"
|
|
5
|
+
}
|
|
6
|
+
interface DependencyBase {
|
|
7
|
+
type: DependencyMode;
|
|
8
|
+
}
|
|
9
|
+
export interface ExternalDependency extends DependencyBase {
|
|
10
|
+
type: DependencyMode.EXTERNAL;
|
|
11
|
+
endpoint: pulumi.Input<string>;
|
|
12
|
+
}
|
|
13
|
+
export interface ContainerDependency extends DependencyBase {
|
|
14
|
+
type: DependencyMode.CONTAINER;
|
|
15
|
+
imageOverride?: pulumi.Input<string>;
|
|
16
|
+
tagOverride?: pulumi.Input<string>;
|
|
17
|
+
}
|
|
18
|
+
export type WombatDependency = ExternalDependency | ContainerDependency;
|
|
19
|
+
export interface WombatDependencyConfig {
|
|
20
|
+
boaviztapi: WombatDependency;
|
|
21
|
+
ecologits: WombatDependency;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DependencyMode = void 0;
|
|
4
|
+
var DependencyMode;
|
|
5
|
+
(function (DependencyMode) {
|
|
6
|
+
DependencyMode["EXTERNAL"] = "EXTERNAL";
|
|
7
|
+
DependencyMode["CONTAINER"] = "CONTAINER";
|
|
8
|
+
})(DependencyMode || (exports.DependencyMode = DependencyMode = {}));
|
|
9
|
+
//# sourceMappingURL=dependencies-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies-args.js","sourceRoot":"","sources":["../../../components/args/dependencies-args.ts"],"names":[],"mappings":";;;AAEA,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as k8s from "@pulumi/kubernetes";
|
|
2
|
+
import { WombatNativeConfig } from "./wombat-args";
|
|
3
|
+
import { WombatDependencyConfig } from "./dependencies-args";
|
|
4
|
+
/**
|
|
5
|
+
* Tweaks the Quarkus application configuration based on the WombatDependencyConfig.
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyDependenciesConfig(config: WombatNativeConfig, depConfig: WombatDependencyConfig): WombatNativeConfig;
|
|
8
|
+
export declare function createDependencyContainers(depConfig: WombatDependencyConfig): k8s.types.input.core.v1.Container[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyDependenciesConfig = applyDependenciesConfig;
|
|
4
|
+
exports.createDependencyContainers = createDependencyContainers;
|
|
5
|
+
const dependencies_args_1 = require("./dependencies-args");
|
|
6
|
+
const BOAVIZTAPI_PORT = 5001;
|
|
7
|
+
const ECOLOGITS_PORT = 5002;
|
|
8
|
+
/**
|
|
9
|
+
* Tweaks the Quarkus application configuration based on the WombatDependencyConfig.
|
|
10
|
+
*/
|
|
11
|
+
function applyDependenciesConfig(config, depConfig) {
|
|
12
|
+
config.connector = config.connector || {};
|
|
13
|
+
config.connector.boavizta = config.connector.boavizta || {};
|
|
14
|
+
switch (depConfig.boaviztapi.type) {
|
|
15
|
+
case dependencies_args_1.DependencyMode.EXTERNAL:
|
|
16
|
+
config.connector.boavizta.uri = depConfig.boaviztapi.endpoint;
|
|
17
|
+
break;
|
|
18
|
+
case dependencies_args_1.DependencyMode.CONTAINER:
|
|
19
|
+
config.connector.boavizta.uri = `http://localhost:${BOAVIZTAPI_PORT}/v1/`;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
config.connector.ecologits = config.connector.ecologits || {};
|
|
23
|
+
switch (depConfig.ecologits.type) {
|
|
24
|
+
case dependencies_args_1.DependencyMode.EXTERNAL:
|
|
25
|
+
config.connector.ecologits.uri = depConfig.ecologits.endpoint;
|
|
26
|
+
break;
|
|
27
|
+
case dependencies_args_1.DependencyMode.CONTAINER:
|
|
28
|
+
config.connector.ecologits.uri = `http://localhost:${ECOLOGITS_PORT}/`;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
return config;
|
|
32
|
+
}
|
|
33
|
+
function createDependencyContainers(depConfig) {
|
|
34
|
+
const containers = [];
|
|
35
|
+
if (depConfig.boaviztapi.type == dependencies_args_1.DependencyMode.CONTAINER) {
|
|
36
|
+
const containerConfig = depConfig.boaviztapi;
|
|
37
|
+
containers.push({
|
|
38
|
+
name: "boaviztapi",
|
|
39
|
+
image: computeImageName(containerConfig, "ghcr.io/boavizta/boaviztapi", "2.4.1"),
|
|
40
|
+
ports: [{ containerPort: BOAVIZTAPI_PORT, name: "boaviztapi" }],
|
|
41
|
+
args: [
|
|
42
|
+
"uvicorn", "boaviztapi.main:app",
|
|
43
|
+
"--host", "0.0.0.0",
|
|
44
|
+
"--port", `${BOAVIZTAPI_PORT}`
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (depConfig.ecologits.type == dependencies_args_1.DependencyMode.CONTAINER) {
|
|
49
|
+
const containerConfig = depConfig.ecologits;
|
|
50
|
+
containers.push({
|
|
51
|
+
name: "ecologits",
|
|
52
|
+
image: computeImageName(containerConfig, "ghcr.io/mlco2/ecologits-api", "0.0.2"),
|
|
53
|
+
ports: [{ containerPort: ECOLOGITS_PORT, name: "ecologits" }],
|
|
54
|
+
args: [
|
|
55
|
+
"/app/.venv/bin/fastapi",
|
|
56
|
+
"run", "app/main.py",
|
|
57
|
+
"--port", `${ECOLOGITS_PORT}`,
|
|
58
|
+
"--host", "0.0.0.0"
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return containers;
|
|
63
|
+
}
|
|
64
|
+
function computeImageName(config, defaultName, defaultTag) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const imageName = ((_a = config.imageOverride) === null || _a === void 0 ? void 0 : _a.toString()) || defaultName;
|
|
67
|
+
const imageTag = ((_b = config.tagOverride) === null || _b === void 0 ? void 0 : _b.toString()) || defaultTag;
|
|
68
|
+
return `${imageName}:${imageTag}`;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=dependencies-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies-config.js","sourceRoot":"","sources":["../../../components/args/dependencies-config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export interface ExtensionsPvcArgs {
|
|
3
|
+
existingClaimName?: pulumi.Input<string>;
|
|
4
|
+
size?: pulumi.Input<string>;
|
|
5
|
+
storageClassName?: pulumi.Input<string>;
|
|
6
|
+
accessModes?: pulumi.Input<pulumi.Input<string>[]>;
|
|
7
|
+
}
|
|
8
|
+
export interface ExtensionsConfig {
|
|
9
|
+
pvc?: ExtensionsPvcArgs;
|
|
10
|
+
existingClaimName?: pulumi.Input<string>;
|
|
11
|
+
mountPath?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions-args.js","sourceRoot":"","sources":["../../../components/args/extensions-args.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WombatNativeConfig } from "./wombat-args";
|
|
2
|
+
import { ExtensionsConfig } from "./extensions-args";
|
|
3
|
+
/**
|
|
4
|
+
* Tweaks the Quarkus application configuration based on the ExtensionsConfig.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyExtensionsConfig(config: WombatNativeConfig, extensions?: ExtensionsConfig): WombatNativeConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyExtensionsConfig = applyExtensionsConfig;
|
|
4
|
+
/**
|
|
5
|
+
* Tweaks the Quarkus application configuration based on the ExtensionsConfig.
|
|
6
|
+
*/
|
|
7
|
+
function applyExtensionsConfig(config, extensions) {
|
|
8
|
+
if (extensions && (extensions.existingClaimName || extensions.pvc)) {
|
|
9
|
+
config.module = config.module || {};
|
|
10
|
+
config.module.extension = Object.assign(Object.assign({}, (config.module.extension || {})), { path: extensions.mountPath || "/extensions" });
|
|
11
|
+
}
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=extensions-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions-config.js","sourceRoot":"","sources":["../../../components/args/extensions-config.ts"],"names":[],"mappings":";;AAMA,sDASC;AAZD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAA0B,EAAE,UAA6B;IAC3F,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,iBAAiB,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,SAAS,mCAChB,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,KAClC,IAAI,EAAE,UAAU,CAAC,SAAS,IAAI,aAAa,GAC9C,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export interface IngressBasicAuthArgs {
|
|
3
|
+
username: pulumi.Input<string>;
|
|
4
|
+
password: pulumi.Input<string>;
|
|
5
|
+
realm?: pulumi.Input<string>;
|
|
6
|
+
}
|
|
7
|
+
export interface IngressArgs {
|
|
8
|
+
className: pulumi.Input<string>;
|
|
9
|
+
annotations: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
host: pulumi.Input<string>;
|
|
13
|
+
tlsSecretName: pulumi.Input<string>;
|
|
14
|
+
path: pulumi.Input<string>;
|
|
15
|
+
pathType: pulumi.Input<string>;
|
|
16
|
+
basicAuth?: IngressBasicAuthArgs;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k8s-args.js","sourceRoot":"","sources":["../../../components/args/k8s-args.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkloadType = void 0;
|
|
4
|
+
var WorkloadType;
|
|
5
|
+
(function (WorkloadType) {
|
|
6
|
+
WorkloadType["DEPLOYMENT"] = "DEPLOYMENT";
|
|
7
|
+
WorkloadType["STATEFUL_SET"] = "STATEFUL_SET";
|
|
8
|
+
})(WorkloadType || (exports.WorkloadType = WorkloadType = {}));
|
|
9
|
+
//# sourceMappingURL=k8s-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k8s-config.js","sourceRoot":"","sources":["../../../components/args/k8s-config.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,yCAAyB,CAAA;IACzB,6CAA6B,CAAA;AACjC,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export declare enum MonitoredEnvironmentAssetType {
|
|
3
|
+
KUBERNETES_API = "tech.illuin.wombat-module.kubernetes-api",
|
|
4
|
+
LLM_STATIC = "tech.illuin.wombat-module.llm-static",
|
|
5
|
+
LLM_PROMETHEUS = "tech.illuin.wombat-module.llm-prometheus"
|
|
6
|
+
}
|
|
7
|
+
interface MonitoredEnvironmentAssetBase {
|
|
8
|
+
type: pulumi.Input<string>;
|
|
9
|
+
id: pulumi.Input<string>;
|
|
10
|
+
name: pulumi.Input<string>;
|
|
11
|
+
resolvers?: {
|
|
12
|
+
cost?: pulumi.Input<string>;
|
|
13
|
+
activity?: pulumi.Input<string>;
|
|
14
|
+
impact?: pulumi.Input<string>;
|
|
15
|
+
[key: string]: pulumi.Input<string> | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface K8SApiAsset extends MonitoredEnvironmentAssetBase {
|
|
19
|
+
type: MonitoredEnvironmentAssetType.KUBERNETES_API;
|
|
20
|
+
namespace: pulumi.Input<string>;
|
|
21
|
+
configPath?: pulumi.Input<string>;
|
|
22
|
+
context?: pulumi.Input<string>;
|
|
23
|
+
readTimeout?: pulumi.Input<string>;
|
|
24
|
+
heartbeatSkip?: pulumi.Input<number>;
|
|
25
|
+
profile: {
|
|
26
|
+
provider: pulumi.Input<string>;
|
|
27
|
+
instanceType: pulumi.Input<string>;
|
|
28
|
+
location: pulumi.Input<string>;
|
|
29
|
+
lifespan: pulumi.Input<number>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface LLMStaticModelConfig {
|
|
33
|
+
provider: pulumi.Input<string>;
|
|
34
|
+
model: pulumi.Input<string>;
|
|
35
|
+
location: pulumi.Input<string>;
|
|
36
|
+
requestProfile: {
|
|
37
|
+
outputTokenCount: pulumi.Input<number>;
|
|
38
|
+
requestPerYear: pulumi.Input<number>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface LLMStaticAsset {
|
|
42
|
+
type: MonitoredEnvironmentAssetType.LLM_STATIC;
|
|
43
|
+
profile: {
|
|
44
|
+
models: LLMStaticModelConfig[];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface LLMPrometheusAsset extends MonitoredEnvironmentAssetBase {
|
|
48
|
+
type: MonitoredEnvironmentAssetType.LLM_PROMETHEUS;
|
|
49
|
+
prometheusUrl: pulumi.Input<string>;
|
|
50
|
+
proxyUrl?: pulumi.Input<string>;
|
|
51
|
+
username?: pulumi.Input<string>;
|
|
52
|
+
passwordKey?: pulumi.Input<string>;
|
|
53
|
+
heartbeatSkip?: pulumi.Input<number>;
|
|
54
|
+
profile: {
|
|
55
|
+
provider: pulumi.Input<string>;
|
|
56
|
+
model: pulumi.Input<string>;
|
|
57
|
+
location: pulumi.Input<string>;
|
|
58
|
+
dynamicProfile: {
|
|
59
|
+
query: pulumi.Input<string>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export type MonitoredEnvironmentAsset = K8SApiAsset | LLMStaticAsset | LLMPrometheusAsset;
|
|
64
|
+
export interface MonitoredEnvironment {
|
|
65
|
+
id?: string;
|
|
66
|
+
assets: MonitoredEnvironmentAsset[];
|
|
67
|
+
}
|
|
68
|
+
export interface KubeconfigEntry {
|
|
69
|
+
id: pulumi.Input<string>;
|
|
70
|
+
content: pulumi.Input<string>;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MonitoredEnvironmentAssetType = void 0;
|
|
4
|
+
var MonitoredEnvironmentAssetType;
|
|
5
|
+
(function (MonitoredEnvironmentAssetType) {
|
|
6
|
+
MonitoredEnvironmentAssetType["KUBERNETES_API"] = "tech.illuin.wombat-module.kubernetes-api";
|
|
7
|
+
MonitoredEnvironmentAssetType["LLM_STATIC"] = "tech.illuin.wombat-module.llm-static";
|
|
8
|
+
MonitoredEnvironmentAssetType["LLM_PROMETHEUS"] = "tech.illuin.wombat-module.llm-prometheus";
|
|
9
|
+
})(MonitoredEnvironmentAssetType || (exports.MonitoredEnvironmentAssetType = MonitoredEnvironmentAssetType = {}));
|
|
10
|
+
//# sourceMappingURL=monitored-environments-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitored-environments-args.js","sourceRoot":"","sources":["../../../components/args/monitored-environments-args.ts"],"names":[],"mappings":";;;AAEA,IAAY,6BAIX;AAJD,WAAY,6BAA6B;IACrC,4FAA2D,CAAA;IAC3D,oFAAmD,CAAA;IACnD,4FAA2D,CAAA;AAC/D,CAAC,EAJW,6BAA6B,6CAA7B,6BAA6B,QAIxC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMonitoredEnvironmentsConf = createMonitoredEnvironmentsConf;
|
|
4
|
+
const tools_1 = require("../utils/tools");
|
|
5
|
+
const monitored_environments_args_1 = require("./monitored-environments-args");
|
|
6
|
+
const yaml = require("yaml");
|
|
7
|
+
function createKubeconfigConf(args) {
|
|
8
|
+
return new tools_1.ConfGroup("/kubeconfigs", "kubeconfigs", (args.monitoredEnvironments.kubeconfigs || []).map(kc => ({
|
|
9
|
+
id: kc.id.toString(),
|
|
10
|
+
filename: `${kc.id}.config`,
|
|
11
|
+
data: kc.content.toString(),
|
|
12
|
+
})));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Rewrites a `KUBERNETES_API` asset: looks up its mounted kubeconfig by id and points `config-path` at it.
|
|
16
|
+
* Throws if no matching kubeconfig was provided.
|
|
17
|
+
*/
|
|
18
|
+
function rewriteKubernetesApiAsset(envId, asset, kubeconfigConf, kubeconfigById) {
|
|
19
|
+
const kubeconfig = kubeconfigById.get(asset.id.toString());
|
|
20
|
+
if (!kubeconfig)
|
|
21
|
+
throw new Error(`No kubeconfig provided for monitored environment asset "${asset.id}"`);
|
|
22
|
+
return Object.assign(Object.assign({}, (0, tools_1.kebabize)(asset)), { "environment-id": envId, "config-path": `${kubeconfigConf.path}/${kubeconfig.filename}` });
|
|
23
|
+
}
|
|
24
|
+
function rewriteLLMStaticAsset(envId, asset) {
|
|
25
|
+
return Object.assign(Object.assign({}, (0, tools_1.kebabize)(asset)), { "environment-id": envId });
|
|
26
|
+
}
|
|
27
|
+
function rewriteLLMPrometheusAsset(envId, asset) {
|
|
28
|
+
return Object.assign(Object.assign({}, (0, tools_1.kebabize)(asset)), { "environment-id": envId });
|
|
29
|
+
}
|
|
30
|
+
function rewriteAsset(envId, asset, kubeconfigConf, kubeconfigById) {
|
|
31
|
+
switch (asset.type) {
|
|
32
|
+
case monitored_environments_args_1.MonitoredEnvironmentAssetType.KUBERNETES_API:
|
|
33
|
+
return rewriteKubernetesApiAsset(envId, asset, kubeconfigConf, kubeconfigById);
|
|
34
|
+
case monitored_environments_args_1.MonitoredEnvironmentAssetType.LLM_STATIC:
|
|
35
|
+
return rewriteLLMStaticAsset(envId, asset);
|
|
36
|
+
case monitored_environments_args_1.MonitoredEnvironmentAssetType.LLM_PROMETHEUS:
|
|
37
|
+
return rewriteLLMPrometheusAsset(envId, asset);
|
|
38
|
+
default:
|
|
39
|
+
return Object.assign(Object.assign({}, (0, tools_1.kebabize)(asset)), { "environment-id": envId });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function createMonitoredEnvironmentsConf(args) {
|
|
43
|
+
const kubeconfigConf = createKubeconfigConf(args);
|
|
44
|
+
const kubeconfigById = new Map(kubeconfigConf.confs.map(c => [c.id, c]));
|
|
45
|
+
const environments = Object.fromEntries(Object.entries(args.monitoredEnvironments.environments).map(([envId, env]) => [
|
|
46
|
+
envId,
|
|
47
|
+
{
|
|
48
|
+
id: env.id || envId,
|
|
49
|
+
assets: env.assets.map((asset) => rewriteAsset(envId, asset, kubeconfigConf, kubeconfigById)),
|
|
50
|
+
},
|
|
51
|
+
]));
|
|
52
|
+
const monitoredEnvConf = new tools_1.ConfGroup("/monitored", "monitored-environments-conf", [{
|
|
53
|
+
id: "monitored-environments-conf",
|
|
54
|
+
filename: "monitored-environments.yaml",
|
|
55
|
+
data: yaml.stringify({ environments }),
|
|
56
|
+
}]);
|
|
57
|
+
return { kubeconfigConf, monitoredEnvConf };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=monitored-environments-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitored-environments-config.js","sourceRoot":"","sources":["../../../components/args/monitored-environments-config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export declare enum PersistenceMode {
|
|
3
|
+
SQLITE_TRANSIENT = "SQLITE_TRANSIENT",
|
|
4
|
+
SQLITE_WITH_BACKUP = "SQLITE_WITH_BACKUP"
|
|
5
|
+
}
|
|
6
|
+
interface PersistenceProfileBase {
|
|
7
|
+
type: PersistenceMode;
|
|
8
|
+
}
|
|
9
|
+
export interface SqliteTransient extends PersistenceProfileBase {
|
|
10
|
+
type: PersistenceMode.SQLITE_TRANSIENT;
|
|
11
|
+
}
|
|
12
|
+
export interface SqliteWithBackup extends PersistenceProfileBase {
|
|
13
|
+
type: PersistenceMode.SQLITE_WITH_BACKUP;
|
|
14
|
+
backup: {
|
|
15
|
+
cron: pulumi.Input<string>;
|
|
16
|
+
restoreOnStartup: pulumi.Input<boolean>;
|
|
17
|
+
s3: {
|
|
18
|
+
endpoint: pulumi.Input<string>;
|
|
19
|
+
bucket: pulumi.Input<string>;
|
|
20
|
+
region?: pulumi.Input<string>;
|
|
21
|
+
keyPrefix?: pulumi.Input<string>;
|
|
22
|
+
accessKey: pulumi.Input<string>;
|
|
23
|
+
secretKey: pulumi.Input<string>;
|
|
24
|
+
};
|
|
25
|
+
cleanup?: {
|
|
26
|
+
cron: pulumi.Input<string>;
|
|
27
|
+
retainLast: pulumi.Input<number>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export type PersistenceProfile = SqliteTransient | SqliteWithBackup;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PersistenceMode = void 0;
|
|
4
|
+
var PersistenceMode;
|
|
5
|
+
(function (PersistenceMode) {
|
|
6
|
+
PersistenceMode["SQLITE_TRANSIENT"] = "SQLITE_TRANSIENT";
|
|
7
|
+
PersistenceMode["SQLITE_WITH_BACKUP"] = "SQLITE_WITH_BACKUP";
|
|
8
|
+
})(PersistenceMode || (exports.PersistenceMode = PersistenceMode = {}));
|
|
9
|
+
//# sourceMappingURL=persistence-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence-args.js","sourceRoot":"","sources":["../../../components/args/persistence-args.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,wDAAqC,CAAA;IACrC,4DAAyC,CAAA;AAC7C,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WombatNativeConfig } from "./wombat-args";
|
|
2
|
+
import { PersistenceProfile } from "./persistence-args";
|
|
3
|
+
/**
|
|
4
|
+
* Tweaks the Quarkus application configuration based on the PersistenceProfile.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyPersistenceConfig(config: WombatNativeConfig, profile: PersistenceProfile): WombatNativeConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyPersistenceConfig = applyPersistenceConfig;
|
|
4
|
+
const persistence_args_1 = require("./persistence-args");
|
|
5
|
+
/**
|
|
6
|
+
* Tweaks the Quarkus application configuration based on the PersistenceProfile.
|
|
7
|
+
*/
|
|
8
|
+
function applyPersistenceConfig(config, profile) {
|
|
9
|
+
config.quarkus = config.quarkus || {};
|
|
10
|
+
config.quarkus.datasource = config.quarkus.datasource || {};
|
|
11
|
+
config.quarkus.datasource.jdbc = config.quarkus.datasource.jdbc || {};
|
|
12
|
+
switch (profile.type) {
|
|
13
|
+
case persistence_args_1.PersistenceMode.SQLITE_TRANSIENT:
|
|
14
|
+
// We use an in-memory SQLite database for transient setups
|
|
15
|
+
config.quarkus.datasource.jdbc.url = "jdbc:sqlite::memory:";
|
|
16
|
+
config.backup = { enabled: false };
|
|
17
|
+
break;
|
|
18
|
+
case persistence_args_1.PersistenceMode.SQLITE_WITH_BACKUP:
|
|
19
|
+
// We use a temporary file that is periodically backed up in on an S3 bucket
|
|
20
|
+
config.quarkus.datasource.jdbc.url = "jdbc:sqlite:/var/tmp/wombat.db";
|
|
21
|
+
config.backup = profile.backup;
|
|
22
|
+
config.backup.enabled = true;
|
|
23
|
+
if (config.backup.cleanup)
|
|
24
|
+
config.backup.cleanup.enabled = true;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=persistence-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence-config.js","sourceRoot":"","sources":["../../../components/args/persistence-config.ts"],"names":[],"mappings":";;AAMA,wDAuBC;AA5BD,yDAAuE;AAEvE;;GAEG;AACH,SAAgB,sBAAsB,CAAC,MAA0B,EAAE,OAA2B;IAC1F,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IAC5D,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;IAEtE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,kCAAe,CAAC,gBAAgB;YACjC,2DAA2D;YAC3D,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,GAAG,sBAAsB,CAAC;YAC5D,MAAM,CAAC,MAAM,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACnC,MAAM;QAEV,KAAK,kCAAe,CAAC,kBAAkB;YACnC,4EAA4E;YAC5E,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,GAAG,gCAAgC,CAAC;YACtE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC/B,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YAC7B,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO;gBACrB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;YACzC,MAAM;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|