@kici-dev/orchestrator 0.14.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test-helpers__/peer-mutual-auth.d.ts +42 -0
- package/dist/__test-helpers__/scratch-db.d.ts +16 -0
- package/dist/agent/host-roster.d.ts +100 -37
- package/dist/agent/registry.d.ts +1 -8
- package/dist/app-on-error.d.ts +1 -1
- package/dist/app.d.ts +4 -2
- package/dist/artifacts/artifact-store.d.ts +0 -2
- package/dist/audit/access-log.d.ts +1 -1
- package/dist/cache/source-cache.d.ts +1 -1
- package/dist/cache/user-cache.d.ts +0 -28
- package/dist/cli/api-client.d.ts +27 -1
- package/dist/cli/commands/access-log.d.ts +1 -1
- package/dist/cli/commands/cold-store-impl.d.ts +7 -84
- package/dist/cli/commands/db.d.ts +1 -0
- package/dist/cli/commands/host.d.ts +3 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +2 -0
- package/dist/cli/commands/org.d.ts +12 -0
- package/dist/cli/commands/scaler.d.ts +14 -0
- package/dist/cli/commands/secret.d.ts +1 -45
- package/dist/cli/commands/service-health.d.ts +21 -13
- package/dist/cli/commands/shared/cli-action.d.ts +17 -0
- package/dist/cli/commands/shared/db.d.ts +5 -5
- package/dist/cli/commands/shared/org-id.d.ts +5 -0
- package/dist/cli/commands/shared/service-verbs.d.ts +19 -0
- package/dist/cli/commands/shared/table.d.ts +3 -0
- package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -22
- package/dist/cli/commands/source-manifest.d.ts +3 -3
- package/dist/cli/commands/source.d.ts +23 -0
- package/dist/cli/commands/trust-policy.d.ts +7 -31
- package/dist/cli/join.d.ts +2 -2
- package/dist/cli/kici-admin.d.ts +6 -1
- package/dist/cli/local-github-ingress-url.d.ts +6 -0
- package/dist/cli/root-option-routing.d.ts +46 -0
- package/dist/cli/webhook-url-notes.d.ts +15 -0
- package/dist/cli.js +10667 -8461
- package/dist/cluster/coordinator-credential.d.ts +21 -0
- package/dist/cluster/coordinator.d.ts +2 -2
- package/dist/cluster/index.d.ts +4 -4
- package/dist/cluster/join-client.d.ts +23 -21
- package/dist/cluster/join-handler.d.ts +24 -16
- package/dist/cluster/join-protocol-v2.d.ts +84 -0
- package/dist/cluster/join-token.d.ts +78 -56
- package/dist/cluster/peer-auth-coordinator.d.ts +16 -2
- package/dist/cluster/peer-client.d.ts +99 -5
- package/dist/cluster/peer-crypto.d.ts +60 -3
- package/dist/cluster/peer-discovery.d.ts +67 -0
- package/dist/cluster/peer-forget.d.ts +4 -9
- package/dist/cluster/peer-handler.d.ts +28 -6
- package/dist/cluster/peer-registry.d.ts +15 -1
- package/dist/cluster/peer-request-waiters.d.ts +26 -0
- package/dist/cluster/scaler-orphans-peer.d.ts +4 -9
- package/dist/cluster/scaler-reload-fanout.d.ts +29 -0
- package/dist/cluster/scaler-reload-peer.d.ts +16 -0
- package/dist/cluster/worker-cluster-settings.d.ts +1 -0
- package/dist/cold-store/load-access-log-range.d.ts +3 -3
- package/dist/cold-store/tables/access-log.d.ts +4 -12
- package/dist/cold-store/tables/event-log.d.ts +8 -19
- package/dist/cold-store/tables/execution-jobs.d.ts +7 -24
- package/dist/cold-store/tables/execution-runs.d.ts +6 -20
- package/dist/cold-store/tables/execution-steps.d.ts +8 -26
- package/dist/cold-store/tables/secret-audit-log.d.ts +4 -11
- package/dist/config/env-overlay.d.ts +3 -8
- package/dist/config/reload.d.ts +9 -2
- package/dist/config/schema.d.ts +16 -2
- package/dist/config/types.d.ts +6 -2
- package/dist/config.d.ts +22 -17
- package/dist/contexts/held-runs.d.ts +3 -6
- package/dist/dashboard/cursor.d.ts +12 -0
- package/dist/dashboard/handler.d.ts +5 -12
- package/dist/db/deferred-index-build.d.ts +42 -0
- package/dist/db/deferred-indexes.d.ts +3 -37
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +3 -5
- package/dist/db/migrations/157_host_roster_identity_source.d.ts +21 -0
- package/dist/db/migrations/158_normalize_legacy_values.d.ts +4 -0
- package/dist/db/repos/org-ids-repo.d.ts +87 -0
- package/dist/db/schema-snapshot.generated.d.ts +3 -0
- package/dist/db/types.d.ts +21 -24
- package/dist/fault-injection-types.d.ts +0 -6
- package/dist/git/dispatch-git-auth.d.ts +6 -12
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +25 -13
- package/dist/helpers/json.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +357 -216
- package/dist/metrics/prometheus.d.ts +0 -5
- package/dist/oidc/id-token-claims.d.ts +1 -1
- package/dist/oidc/resolve-signer.d.ts +2 -4
- package/dist/orchestrator-core.d.ts +10 -3
- package/dist/pipeline/global-eval-round.d.ts +2 -26
- package/dist/pipeline/install-secrets-resolver.d.ts +0 -3
- package/dist/pipeline/manual-schedule.d.ts +1 -7
- package/dist/provenance/dispatch-context.d.ts +5 -7
- package/dist/provenance/pending-attestations-repo.d.ts +1 -1
- package/dist/provenance/trust-root.d.ts +4 -5
- package/dist/provenance/verify-deferred-capture.d.ts +3 -3
- package/dist/provider-registry.d.ts +13 -40
- package/dist/providers/github/manifest.d.ts +58 -7
- package/dist/providers/universal-git/ssh-auth.d.ts +0 -5
- package/dist/reporting/check-run-reporter.d.ts +8 -21
- package/dist/reporting/check-run-summary.d.ts +2 -2
- package/dist/reporting/execution-tracker.d.ts +1 -1
- package/dist/reporting/log-chunk-sink.d.ts +1 -1
- package/dist/reporting/run-summary-fields.d.ts +25 -0
- package/dist/reporting/s3-log-storage.d.ts +2 -2
- package/dist/routes/admin-access-log.d.ts +2 -9
- package/dist/routes/admin-backends.d.ts +2 -9
- package/dist/routes/admin-cluster-name.d.ts +2 -8
- package/dist/routes/admin-cluster-settings.d.ts +2 -8
- package/dist/routes/admin-config.d.ts +0 -3
- package/dist/routes/admin-contexts.d.ts +3 -11
- package/dist/routes/admin-db.d.ts +2 -9
- package/dist/routes/admin-env.d.ts +33 -0
- package/dist/routes/admin-event-dlq.d.ts +2 -9
- package/dist/routes/admin-event-inspect.d.ts +2 -9
- package/dist/routes/admin-event-log.d.ts +2 -9
- package/dist/routes/admin-events.d.ts +3 -13
- package/dist/routes/admin-held-runs.d.ts +2 -8
- package/dist/routes/admin-list-limit.d.ts +3 -0
- package/dist/routes/admin-maintenance.d.ts +2 -9
- package/dist/routes/admin-orchestrator-drain.d.ts +2 -9
- package/dist/routes/admin-org-settings.d.ts +2 -8
- package/dist/routes/admin-orgs.d.ts +27 -0
- package/dist/routes/admin-peer-forget.d.ts +2 -9
- package/dist/routes/admin-queue-execution.d.ts +3 -10
- package/dist/routes/admin-registrations.d.ts +3 -14
- package/dist/routes/admin-runs.d.ts +3 -14
- package/dist/routes/admin-scaler-orphans.d.ts +2 -9
- package/dist/routes/admin-scaler-reload.d.ts +41 -0
- package/dist/routes/admin-scheduled-jobs.d.ts +2 -9
- package/dist/routes/admin-signing-keys.d.ts +2 -9
- package/dist/routes/admin-sources.d.ts +28 -32
- package/dist/routes/admin-trust-policy.d.ts +2 -8
- package/dist/routes/admin.d.ts +29 -30
- package/dist/routes/cluster-join.d.ts +13 -0
- package/dist/routes/github-webhook.d.ts +13 -11
- package/dist/scaler/bare-metal-backend.d.ts +42 -1
- package/dist/scaler/config.d.ts +12 -84
- package/dist/scaler/file-reload.d.ts +48 -0
- package/dist/scaler/manager.d.ts +47 -33
- package/dist/scaler/scaler-state-store.d.ts +5 -0
- package/dist/scaler/types.d.ts +8 -9
- package/dist/secrets/job-secret-gate.d.ts +2 -5
- package/dist/secrets/secret-resolver.d.ts +2 -4
- package/dist/security/trust-policy-gate.d.ts +0 -4
- package/dist/server.d.ts +6 -17
- package/dist/server.js +10933 -10836
- package/dist/sources/source-manager.d.ts +0 -24
- package/dist/sources/webhook-url-resolvers.d.ts +60 -0
- package/dist/standalone.js +10457 -10060
- package/dist/worker/reroute-dispatch.d.ts +1 -0
- package/dist/worker/reroute-spawn-control.d.ts +1 -3
- package/dist/worker-core.d.ts +9 -2
- package/dist/ws/agent-handler.d.ts +3 -3
- package/dist/ws/dashboard-access.d.ts +57 -0
- package/dist/ws/dashboard-backends-handler.d.ts +1 -6
- package/dist/ws/dashboard-context-handler.d.ts +10 -15
- package/dist/ws/dashboard-fleet-handler.d.ts +4 -3
- package/dist/ws/dashboard-fleet-write-handler.d.ts +6 -5
- package/dist/ws/dashboard-global-workflows-handler.d.ts +1 -6
- package/dist/ws/dashboard-registrations-handler.d.ts +1 -7
- package/dist/ws/platform-client.d.ts +94 -327
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +53 -53
- package/dist/cache/legacy-prefixes.d.ts +0 -19
- package/dist/cli/commands/agent-service/logs.d.ts +0 -14
- package/dist/cli/commands/agent-service/restart.d.ts +0 -12
- package/dist/cli/commands/agent-service/start.d.ts +0 -12
- package/dist/cli/commands/agent-service/stop.d.ts +0 -12
- package/dist/cli/commands/agent-service/uninstall.d.ts +0 -13
- package/dist/cli/commands/cache.d.ts +0 -51
- package/dist/cli/commands/orchestrator-service/logs.d.ts +0 -14
- package/dist/cli/commands/orchestrator-service/restart.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/start.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/stop.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/uninstall.d.ts +0 -13
- package/dist/git/inherited-secret.d.ts +0 -29
|
@@ -9,56 +9,59 @@
|
|
|
9
9
|
* the admin auth middleware in admin.ts.
|
|
10
10
|
*/
|
|
11
11
|
import { Hono } from 'hono';
|
|
12
|
-
import { OrchestratorMode } from '@kici-dev/engine';
|
|
13
12
|
import type { SourceStore } from '../sources/source-store.js';
|
|
14
|
-
import type
|
|
13
|
+
import { type WebhookUrlResolution } from '../sources/webhook-url-resolvers.js';
|
|
15
14
|
import { type RedeliverWindowResult } from '../providers/github/deliveries.js';
|
|
16
|
-
import { type FetchGithubAppIdentity } from '../github-app-name-refresher/github-app-name-refresher.js';
|
|
15
|
+
import { type FetchGithubAppIdentity, type FetchGithubAppInstallations } from '../github-app-name-refresher/github-app-name-refresher.js';
|
|
16
|
+
import { type AdminEnv } from './admin-env.js';
|
|
17
17
|
interface SourceRouteDeps {
|
|
18
18
|
sourceStore: SourceStore;
|
|
19
19
|
/**
|
|
20
20
|
* Resolve the public webhook URL for a freshly added source so the CLI can
|
|
21
|
-
* print it
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* print it, by mode: platform and hybrid read the Platform's URL from the
|
|
22
|
+
* `source.register.ack` (hybrid falls back to its own URL); observed and
|
|
23
|
+
* independent return this orchestrator's own per-source URL. A null URL
|
|
24
|
+
* carries a `webhookNote` that says why. Omitted in deployments with no
|
|
24
25
|
* resolver wired (the route then returns `webhookUrl: null`).
|
|
25
26
|
*/
|
|
26
27
|
resolveSourceWebhookUrl?: (params: {
|
|
27
28
|
routingKey: string;
|
|
28
29
|
provider: string;
|
|
29
30
|
sourceId: string;
|
|
30
|
-
}) => Promise<
|
|
31
|
-
webhookUrl: string | null;
|
|
32
|
-
webhookNote?: string;
|
|
33
|
-
}>;
|
|
31
|
+
}) => Promise<WebhookUrlResolution>;
|
|
34
32
|
/**
|
|
35
33
|
* Resolve the org-scoped GitHub webhook URL for the manifest setup flow
|
|
36
34
|
* BEFORE any App exists. The GitHub webhook URL is org-scoped
|
|
37
35
|
* (`<base>/webhook/<orgId>/github`), not app-scoped, so it can be computed
|
|
38
36
|
* up front and baked into the App manifest. Returns null + a note when the
|
|
39
|
-
* orchestrator cannot
|
|
37
|
+
* orchestrator cannot resolve it for its mode.
|
|
40
38
|
*/
|
|
41
|
-
resolveGithubWebhookUrl?: () => Promise<
|
|
42
|
-
webhookUrl: string | null;
|
|
43
|
-
webhookNote?: string;
|
|
44
|
-
}>;
|
|
39
|
+
resolveGithubWebhookUrl?: () => Promise<WebhookUrlResolution>;
|
|
45
40
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
41
|
+
* Build this orchestrator's own direct-ingress URL for a listed GitHub
|
|
42
|
+
* source, or null: platform mode serves no direct ingress, and without a
|
|
43
|
+
* public base or a known org there is no URL to print.
|
|
44
|
+
*/
|
|
45
|
+
resolveSourceIngressUrl?: (row: {
|
|
46
|
+
id: string;
|
|
47
|
+
customerId: string | null;
|
|
48
|
+
}) => string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch a GitHub App's authoritative `{ name, slug }`, events and permissions
|
|
51
|
+
* from GitHub. Injectable for tests; defaults to the real
|
|
52
|
+
* `fetchGithubAppIdentity`. Used by the `source refresh` route.
|
|
49
53
|
*/
|
|
50
54
|
fetchAppIdentity?: FetchGithubAppIdentity;
|
|
55
|
+
/**
|
|
56
|
+
* List a GitHub App's installations. Injectable for tests; defaults to
|
|
57
|
+
* `listGithubAppInstallations`. Used by the `source refresh` route.
|
|
58
|
+
*/
|
|
59
|
+
fetchAppInstallations?: FetchGithubAppInstallations;
|
|
51
60
|
/**
|
|
52
61
|
* Replay a window of GitHub webhook deliveries for one App. Injectable for
|
|
53
62
|
* tests; defaults to the real `redeliverWindow`.
|
|
54
63
|
*/
|
|
55
64
|
redeliverDeliveries?: RedeliverDeliveries;
|
|
56
|
-
/**
|
|
57
|
-
* Orchestrator operating mode. `observed` refuses GitHub-App source creation:
|
|
58
|
-
* those sources are ingested through the Platform relay, and an observed
|
|
59
|
-
* orchestrator never accepts a relay. Omitted (undefined) behaves as before.
|
|
60
|
-
*/
|
|
61
|
-
mode?: OrchestratorMode;
|
|
62
65
|
}
|
|
63
66
|
/** Replay a delivery window for a GitHub App. Matches `redeliverWindow`. */
|
|
64
67
|
export type RedeliverDeliveries = (app: {
|
|
@@ -69,13 +72,6 @@ export type RedeliverDeliveries = (app: {
|
|
|
69
72
|
until: Date;
|
|
70
73
|
dryRun?: boolean;
|
|
71
74
|
}) => Promise<RedeliverWindowResult>;
|
|
72
|
-
|
|
73
|
-
Variables: {
|
|
74
|
-
role: Role;
|
|
75
|
-
userId: string;
|
|
76
|
-
routingKey: string | null;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export declare function createSourceRoutes(deps: SourceRouteDeps): Hono<AdminSourcesEnv>;
|
|
75
|
+
export declare function createSourceRoutes(deps: SourceRouteDeps): Hono<AdminEnv>;
|
|
80
76
|
export {};
|
|
81
77
|
//# sourceMappingURL=admin-sources.d.ts.map
|
|
@@ -23,8 +23,9 @@ import { Hono } from 'hono';
|
|
|
23
23
|
import type { OrchestratorMode } from '@kici-dev/engine';
|
|
24
24
|
import type { TrustPolicyStore } from '../security/trust-policy-store.js';
|
|
25
25
|
import type { TrustDirectoryStore } from '../security/trust-directory-store.js';
|
|
26
|
-
import type { RbacEnforcer
|
|
26
|
+
import type { RbacEnforcer } from '../secrets/rbac.js';
|
|
27
27
|
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
28
|
+
import { type AdminEnv } from './admin-env.js';
|
|
28
29
|
/**
|
|
29
30
|
* Wording for the Platform-managed refusal. Shared with the CLI through the
|
|
30
31
|
* response body — the CLI surfaces this verbatim rather than inventing its own.
|
|
@@ -76,13 +77,6 @@ interface TrustPolicyRouteDeps {
|
|
|
76
77
|
*/
|
|
77
78
|
accessLog: AccessLogWriter;
|
|
78
79
|
}
|
|
79
|
-
type AdminEnv = {
|
|
80
|
-
Variables: {
|
|
81
|
-
role: Role;
|
|
82
|
-
userId: string;
|
|
83
|
-
routingKey: string | null;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
80
|
export declare function createTrustPolicyRoutes(deps: TrustPolicyRouteDeps): Hono<AdminEnv>;
|
|
87
81
|
export {};
|
|
88
82
|
//# sourceMappingURL=admin-trust-policy.d.ts.map
|
package/dist/routes/admin.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { Hono } from 'hono';
|
|
12
12
|
import type { TokenManager } from '../secrets/token-manager.js';
|
|
13
|
-
import type { RbacEnforcer
|
|
13
|
+
import type { RbacEnforcer } from '../secrets/rbac.js';
|
|
14
14
|
import type { PgSecretStore } from '../secrets/pg-secret-store.js';
|
|
15
15
|
import type { AuditLogger } from '../secrets/audit-logger.js';
|
|
16
16
|
import type { AgentTokenStore } from '../agent/token-store.js';
|
|
@@ -21,6 +21,7 @@ import { type HeldRunReleaseWiring } from './admin-held-runs.js';
|
|
|
21
21
|
import { type ClusterSettingsPropagationSource } from './admin-cluster-settings.js';
|
|
22
22
|
import { type ScalerOrphansRouteDeps } from './admin-scaler-orphans.js';
|
|
23
23
|
import { type PeerForgetRouteDeps } from './admin-peer-forget.js';
|
|
24
|
+
import { type ScalerReloadRouteDeps } from './admin-scaler-reload.js';
|
|
24
25
|
import type { DrainController } from '../drain/drain-controller.js';
|
|
25
26
|
import type { SourceStore } from '../sources/source-store.js';
|
|
26
27
|
import type { JoinTokenManager } from '../cluster/join-token.js';
|
|
@@ -30,9 +31,8 @@ import type { BackendSyncManager, OrchestratorMode } from '@kici-dev/engine';
|
|
|
30
31
|
import type { Kysely } from 'kysely';
|
|
31
32
|
import type pg from 'pg';
|
|
32
33
|
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
34
|
+
import type { WebhookUrlResolution } from '../sources/webhook-url-resolvers.js';
|
|
35
|
+
import { type AdminEnv } from './admin-env.js';
|
|
36
36
|
export interface AdminRouteDeps {
|
|
37
37
|
tokenManager: TokenManager;
|
|
38
38
|
/**
|
|
@@ -42,10 +42,8 @@ export interface AdminRouteDeps {
|
|
|
42
42
|
*/
|
|
43
43
|
databaseUrl?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Orchestrator operating mode. Gates mode-specific admin behavior
|
|
46
|
-
*
|
|
47
|
-
* Platform-relayed by nature, and an observed orchestrator never accepts a
|
|
48
|
-
* relay). Optional so WS-only / test admins can omit it.
|
|
45
|
+
* Orchestrator operating mode. Gates mode-specific admin behavior. Optional so
|
|
46
|
+
* WS-only / test admins can omit it.
|
|
49
47
|
*/
|
|
50
48
|
mode?: OrchestratorMode;
|
|
51
49
|
/**
|
|
@@ -56,6 +54,12 @@ export interface AdminRouteDeps {
|
|
|
56
54
|
* an independent orchestrator and on a test admin, which have no connection.
|
|
57
55
|
*/
|
|
58
56
|
platformConnected?: () => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The org the Platform named on `auth.success`, read per request; `undefined`
|
|
59
|
+
* before the first authentication. Backs the attachment `GET /org-ids` reports.
|
|
60
|
+
* Absent on an independent orchestrator and on a test admin.
|
|
61
|
+
*/
|
|
62
|
+
getPlatformOrgId?: () => string | undefined;
|
|
59
63
|
rbac: RbacEnforcer;
|
|
60
64
|
secretStore: PgSecretStore;
|
|
61
65
|
auditLogger: AuditLogger;
|
|
@@ -104,26 +108,24 @@ export interface AdminRouteDeps {
|
|
|
104
108
|
sourceStore?: SourceStore;
|
|
105
109
|
/**
|
|
106
110
|
* Optional -- resolves the public webhook URL for a newly added source so
|
|
107
|
-
* `kici-admin source add` can print it.
|
|
108
|
-
*
|
|
109
|
-
* with a note.
|
|
111
|
+
* `kici-admin source add` can print it. The rules per mode live in
|
|
112
|
+
* `sources/webhook-url-resolvers.ts`.
|
|
110
113
|
*/
|
|
111
114
|
resolveSourceWebhookUrl?: (params: {
|
|
112
115
|
routingKey: string;
|
|
113
116
|
provider: string;
|
|
114
117
|
sourceId: string;
|
|
115
|
-
}) => Promise<
|
|
116
|
-
webhookUrl: string | null;
|
|
117
|
-
webhookNote?: string;
|
|
118
|
-
}>;
|
|
118
|
+
}) => Promise<WebhookUrlResolution>;
|
|
119
119
|
/**
|
|
120
120
|
* Optional -- resolves the org-scoped GitHub webhook URL for the manifest
|
|
121
|
-
* setup pre-flight (before any App exists)
|
|
122
|
-
*/
|
|
123
|
-
resolveGithubWebhookUrl?: () => Promise<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
* setup pre-flight (before any App exists), by mode.
|
|
122
|
+
*/
|
|
123
|
+
resolveGithubWebhookUrl?: () => Promise<WebhookUrlResolution>;
|
|
124
|
+
/** Optional — builds the direct-ingress URL `source list` prints per GitHub source. */
|
|
125
|
+
resolveSourceIngressUrl?: (row: {
|
|
126
|
+
id: string;
|
|
127
|
+
customerId: string | null;
|
|
128
|
+
}) => string | null;
|
|
127
129
|
/** Optional -- for DB migration endpoints. */
|
|
128
130
|
db?: Kysely<any>;
|
|
129
131
|
/** Optional -- for DB migration endpoints. */
|
|
@@ -169,6 +171,12 @@ export interface AdminRouteDeps {
|
|
|
169
171
|
* Bound by orchestrator-core once the cluster is up.
|
|
170
172
|
*/
|
|
171
173
|
scalerOrphans?: ScalerOrphansRouteDeps;
|
|
174
|
+
/**
|
|
175
|
+
* Optional -- reload the scaler config here and on every connected peer.
|
|
176
|
+
* Backs `POST /api/v1/admin/scaler/reload` (`kici-admin scaler reload`).
|
|
177
|
+
* Bound by orchestrator-core once the cluster is up.
|
|
178
|
+
*/
|
|
179
|
+
scalerReload?: ScalerReloadRouteDeps;
|
|
172
180
|
/**
|
|
173
181
|
* Optional -- forget a departed peer here and on every connected sibling
|
|
174
182
|
* coordinator. Backs `POST /api/v1/admin/peers/forget` (`kici-admin peer
|
|
@@ -205,14 +213,6 @@ export interface AdminRouteDeps {
|
|
|
205
213
|
*/
|
|
206
214
|
heldRunRelease?: HeldRunReleaseWiring;
|
|
207
215
|
}
|
|
208
|
-
/** Hono env type for admin routes with context variables. */
|
|
209
|
-
type AdminEnv = {
|
|
210
|
-
Variables: {
|
|
211
|
-
role: Role;
|
|
212
|
-
userId: string;
|
|
213
|
-
routingKey: string | null;
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
216
|
/**
|
|
217
217
|
* Create admin API routes with Bearer token authentication and RBAC.
|
|
218
218
|
*
|
|
@@ -220,5 +220,4 @@ type AdminEnv = {
|
|
|
220
220
|
* @returns Hono app with admin routes mounted at /api/v1/admin/*
|
|
221
221
|
*/
|
|
222
222
|
export declare function createAdminRoutes(deps: AdminRouteDeps): Hono<AdminEnv>;
|
|
223
|
-
export {};
|
|
224
223
|
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/v1/cluster/join: the direct transport of `kici-admin join --peer`.
|
|
3
|
+
*
|
|
4
|
+
* The body is the same join.request the Platform relays. Unauthenticated by design:
|
|
5
|
+
* the joiner proves it holds a join token inside the request. A version-1 body (one
|
|
6
|
+
* that carries the token) is refused with 426 and `Upgrade: kici-join-v2`.
|
|
7
|
+
*/
|
|
8
|
+
import { Hono } from 'hono';
|
|
9
|
+
import { type JoinResponse } from '@kici-dev/engine';
|
|
10
|
+
/** HTTP status for a join answer: a refusal without an error code is an internal failure. */
|
|
11
|
+
export declare function joinResponseHttpStatus(response: JoinResponse): 200 | 400 | 401 | 426 | 500;
|
|
12
|
+
export declare function createClusterJoinRoutes(onJoinRequest: (raw: unknown) => Promise<JoinResponse>): Hono;
|
|
13
|
+
//# sourceMappingURL=cluster-join.d.ts.map
|
|
@@ -25,19 +25,21 @@ export interface GithubWebhookRoutesDeps {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function shouldServeGithubIngress(mode: OrchestratorMode): boolean;
|
|
27
27
|
/**
|
|
28
|
-
* Direct GitHub
|
|
28
|
+
* Direct GitHub webhook ingress, bypassing the Platform relay:
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* App
|
|
30
|
+
* - `POST /webhook/:orgId/github/:sourceId` (per-source) serves an App-level
|
|
31
|
+
* repoint (GitHub sends `X-GitHub-Hook-Installation-Target-Type:
|
|
32
|
+
* integration` + `-Target-ID: <appId>`, validated against the source's
|
|
33
|
+
* routing key) and a classic repository hook (no App target headers;
|
|
34
|
+
* `:sourceId` identifies the source).
|
|
35
|
+
* - `POST /webhook/:orgId/github` (org-scoped) serves an App-level webhook:
|
|
36
|
+
* the App's target id names the source. It is the URL the manifest flow
|
|
37
|
+
* bakes into a new App in observed and independent mode.
|
|
37
38
|
*
|
|
38
|
-
*
|
|
39
|
-
* read from the orchestrator secret store
|
|
40
|
-
*
|
|
39
|
+
* Both routes share verification (the local `verify-inbound.ts` GitHub path,
|
|
40
|
+
* secret read from the orchestrator secret store, rotation-aware), dedup on the
|
|
41
|
+
* raw `X-GitHub-Delivery`, and ingest through the `processWebhook` pipeline via
|
|
42
|
+
* `onWebhook`.
|
|
41
43
|
*/
|
|
42
44
|
export declare function createGithubWebhookRoutes(deps: GithubWebhookRoutesDeps): Hono;
|
|
43
45
|
//# sourceMappingURL=github-webhook.d.ts.map
|
|
@@ -49,6 +49,18 @@ export interface BareMetalScalerBackendOptions {
|
|
|
49
49
|
* (`systemd-run` does not exist), with a one-time startup warning.
|
|
50
50
|
*/
|
|
51
51
|
enforceCgroups?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Run the `nft` calls of job-image mode (the scaler-level `requireSudo`)
|
|
54
|
+
* through `sudo -n`, for an orchestrator that runs as a non-root user with a
|
|
55
|
+
* NOPASSWD sudoers rule for nft. Process mode runs no nft. Default false.
|
|
56
|
+
*/
|
|
57
|
+
requireSudo?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Extra `host:address` mappings (the scaler-level `extraHosts`) for the agent
|
|
60
|
+
* containers of job-image mode, passed to the runtime as `ExtraHosts`.
|
|
61
|
+
* Process mode ignores them.
|
|
62
|
+
*/
|
|
63
|
+
extraHosts?: string[];
|
|
52
64
|
}
|
|
53
65
|
export declare class BareMetalScalerBackend implements ScalerBackend {
|
|
54
66
|
readonly type: "bare-metal";
|
|
@@ -71,7 +83,36 @@ export declare class BareMetalScalerBackend implements ScalerBackend {
|
|
|
71
83
|
private readonly logCaptures;
|
|
72
84
|
/** Container-mode agents' IPs on the isolated network, for nftables cleanup. */
|
|
73
85
|
private readonly containerIps;
|
|
74
|
-
|
|
86
|
+
/** Whether job-image mode's nft calls run through `sudo -n`. */
|
|
87
|
+
private readonly requireSudo;
|
|
88
|
+
private readonly extraHosts?;
|
|
89
|
+
/**
|
|
90
|
+
* Why this host cannot run nft the way {@link requireSudo} asks, as `create`
|
|
91
|
+
* probed it; `null` when it can. `reload` is synchronous and reads it to
|
|
92
|
+
* refuse job-image label sets a reload adds.
|
|
93
|
+
*/
|
|
94
|
+
private readonly nftFailure;
|
|
95
|
+
/**
|
|
96
|
+
* Build a backend and check, once, that this host can run nft the way the
|
|
97
|
+
* scaler asks. A scaler with a job-image label set is refused here when it
|
|
98
|
+
* cannot, so the orchestrator stops at startup (and a reload that adds the
|
|
99
|
+
* scaler fails) instead of failing every spawn. A process-only scaler is
|
|
100
|
+
* never refused: process mode runs no nft.
|
|
101
|
+
*/
|
|
102
|
+
static create(options: BareMetalScalerBackendOptions): Promise<BareMetalScalerBackend>;
|
|
103
|
+
/**
|
|
104
|
+
* @param nftFailure - The `create` probe's answer. A backend built directly
|
|
105
|
+
* was not probed, and is treated as able to run nft.
|
|
106
|
+
*/
|
|
107
|
+
constructor(options: BareMetalScalerBackendOptions, nftFailure?: string | null);
|
|
108
|
+
/**
|
|
109
|
+
* Why a reload's job-image label sets cannot run here. `reload` is
|
|
110
|
+
* synchronous and cannot probe nft, so it reads what `create` probed — which
|
|
111
|
+
* holds only for the `requireSudo` the backend was built with.
|
|
112
|
+
*/
|
|
113
|
+
private jobImageReloadErrors;
|
|
114
|
+
/** How every nft call of job-image mode runs: through `sudo -n` or not. */
|
|
115
|
+
private nftOpts;
|
|
75
116
|
/**
|
|
76
117
|
* Warn about label sets whose `networkPolicy` this backend cannot enforce.
|
|
77
118
|
*
|
package/dist/scaler/config.d.ts
CHANGED
|
@@ -37,40 +37,16 @@ export declare const labelSetConfigSchema: z.ZodObject<{
|
|
|
37
37
|
Never: "Never";
|
|
38
38
|
}>>;
|
|
39
39
|
binaryPath: z.ZodOptional<z.ZodString>;
|
|
40
|
-
resources: z.ZodOptional<z.
|
|
40
|
+
resources: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
41
41
|
requests: z.ZodOptional<z.ZodObject<{
|
|
42
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
43
42
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
44
44
|
}, z.core.$strict>>;
|
|
45
45
|
limits: z.ZodOptional<z.ZodObject<{
|
|
46
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
47
46
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
48
48
|
}, z.core.$strict>>;
|
|
49
|
-
}, z.core.$strict>,
|
|
50
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
51
|
-
cpus: z.ZodOptional<z.ZodNumber>;
|
|
52
|
-
}, z.core.$strict>]>, z.ZodTransform<{
|
|
53
|
-
requests?: {
|
|
54
|
-
cpus?: number;
|
|
55
|
-
memory?: string;
|
|
56
|
-
};
|
|
57
|
-
limits?: {
|
|
58
|
-
cpus?: number;
|
|
59
|
-
memory?: string;
|
|
60
|
-
};
|
|
61
|
-
}, {
|
|
62
|
-
memory?: string | undefined;
|
|
63
|
-
cpus?: number | undefined;
|
|
64
|
-
} | {
|
|
65
|
-
requests?: {
|
|
66
|
-
memory?: string | undefined;
|
|
67
|
-
cpus?: number | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
limits?: {
|
|
70
|
-
memory?: string | undefined;
|
|
71
|
-
cpus?: number | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
}>>>;
|
|
49
|
+
}, z.core.$strict>, unknown>>;
|
|
74
50
|
volumes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
51
|
containerSocket: z.ZodDefault<z.ZodBoolean>;
|
|
76
52
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -109,40 +85,16 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
109
85
|
version: z.ZodLiteral<1>;
|
|
110
86
|
globalMaxAgents: z.ZodDefault<z.ZodNumber>;
|
|
111
87
|
defaults: z.ZodOptional<z.ZodObject<{
|
|
112
|
-
resources: z.ZodOptional<z.
|
|
88
|
+
resources: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
113
89
|
requests: z.ZodOptional<z.ZodObject<{
|
|
114
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
115
90
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
116
92
|
}, z.core.$strict>>;
|
|
117
93
|
limits: z.ZodOptional<z.ZodObject<{
|
|
118
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
119
94
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
120
96
|
}, z.core.$strict>>;
|
|
121
|
-
}, z.core.$strict>,
|
|
122
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
123
|
-
cpus: z.ZodOptional<z.ZodNumber>;
|
|
124
|
-
}, z.core.$strict>]>, z.ZodTransform<{
|
|
125
|
-
requests?: {
|
|
126
|
-
cpus?: number;
|
|
127
|
-
memory?: string;
|
|
128
|
-
};
|
|
129
|
-
limits?: {
|
|
130
|
-
cpus?: number;
|
|
131
|
-
memory?: string;
|
|
132
|
-
};
|
|
133
|
-
}, {
|
|
134
|
-
memory?: string | undefined;
|
|
135
|
-
cpus?: number | undefined;
|
|
136
|
-
} | {
|
|
137
|
-
requests?: {
|
|
138
|
-
memory?: string | undefined;
|
|
139
|
-
cpus?: number | undefined;
|
|
140
|
-
} | undefined;
|
|
141
|
-
limits?: {
|
|
142
|
-
memory?: string | undefined;
|
|
143
|
-
cpus?: number | undefined;
|
|
144
|
-
} | undefined;
|
|
145
|
-
}>>>;
|
|
97
|
+
}, z.core.$strict>, unknown>>;
|
|
146
98
|
}, z.core.$strip>>;
|
|
147
99
|
globalResourceCap: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
148
100
|
maxCpu: z.ZodOptional<z.ZodNumber>;
|
|
@@ -186,40 +138,16 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
186
138
|
Never: "Never";
|
|
187
139
|
}>>;
|
|
188
140
|
binaryPath: z.ZodOptional<z.ZodString>;
|
|
189
|
-
resources: z.ZodOptional<z.
|
|
141
|
+
resources: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
190
142
|
requests: z.ZodOptional<z.ZodObject<{
|
|
191
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
192
143
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
193
145
|
}, z.core.$strict>>;
|
|
194
146
|
limits: z.ZodOptional<z.ZodObject<{
|
|
195
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
196
147
|
cpus: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
197
149
|
}, z.core.$strict>>;
|
|
198
|
-
}, z.core.$strict>,
|
|
199
|
-
memory: z.ZodOptional<z.ZodString>;
|
|
200
|
-
cpus: z.ZodOptional<z.ZodNumber>;
|
|
201
|
-
}, z.core.$strict>]>, z.ZodTransform<{
|
|
202
|
-
requests?: {
|
|
203
|
-
cpus?: number;
|
|
204
|
-
memory?: string;
|
|
205
|
-
};
|
|
206
|
-
limits?: {
|
|
207
|
-
cpus?: number;
|
|
208
|
-
memory?: string;
|
|
209
|
-
};
|
|
210
|
-
}, {
|
|
211
|
-
memory?: string | undefined;
|
|
212
|
-
cpus?: number | undefined;
|
|
213
|
-
} | {
|
|
214
|
-
requests?: {
|
|
215
|
-
memory?: string | undefined;
|
|
216
|
-
cpus?: number | undefined;
|
|
217
|
-
} | undefined;
|
|
218
|
-
limits?: {
|
|
219
|
-
memory?: string | undefined;
|
|
220
|
-
cpus?: number | undefined;
|
|
221
|
-
} | undefined;
|
|
222
|
-
}>>>;
|
|
150
|
+
}, z.core.$strict>, unknown>>;
|
|
223
151
|
volumes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
224
152
|
containerSocket: z.ZodDefault<z.ZodBoolean>;
|
|
225
153
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one scaler config reload: re-read the scaler file, hand it to the
|
|
3
|
+
* manager (which validates everything before it applies anything), and report
|
|
4
|
+
* what happened.
|
|
5
|
+
*
|
|
6
|
+
* `SIGHUP` (through `ConfigReloader`), the `POST /admin/scaler/reload` route
|
|
7
|
+
* and a peer's `peer.scaler.reload.request` all run this function, so each of
|
|
8
|
+
* them applies a file the same way.
|
|
9
|
+
*/
|
|
10
|
+
import { type Logger } from '@kici-dev/shared';
|
|
11
|
+
import { type ScalerReloadAnswer } from '@kici-dev/engine';
|
|
12
|
+
import type { ScalerManager } from './manager.js';
|
|
13
|
+
import type { ScalerConfig } from './types.js';
|
|
14
|
+
export interface ScalerFileReloadDeps {
|
|
15
|
+
/** Null when the orchestrator runs without a scaler config. */
|
|
16
|
+
manager: Pick<ScalerManager, 'reload'> | null;
|
|
17
|
+
/** Re-reads the scaler config from disk; throws on a missing or invalid file. */
|
|
18
|
+
load: () => Promise<ScalerConfig>;
|
|
19
|
+
/** Runs after a reload applied (the dashboard diagnostics snapshot). */
|
|
20
|
+
onApplied?: (config: ScalerConfig) => void;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One orchestrator's scaler reload outcome: `applied` with its plan, `rejected`
|
|
25
|
+
* with its errors (nothing applied), or `not-configured`.
|
|
26
|
+
*/
|
|
27
|
+
export type ScalerFileReloadResult = ScalerReloadAnswer;
|
|
28
|
+
/** Runs one scaler file reload; see `createScalerFileReload`. */
|
|
29
|
+
export type ScalerFileReload = () => Promise<ScalerFileReloadResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Build the reload function. Calls run one after the other: a reload that
|
|
32
|
+
* arrives while another runs (a `SIGHUP` during an HTTP reload) waits, then
|
|
33
|
+
* reads the file again, and each caller gets the outcome of its own run.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createScalerFileReload(deps: ScalerFileReloadDeps): ScalerFileReload;
|
|
36
|
+
/** The part of `process` the signal listener needs, injectable for tests. */
|
|
37
|
+
export interface SignalSource {
|
|
38
|
+
on(signal: 'SIGHUP', listener: () => void): unknown;
|
|
39
|
+
off(signal: 'SIGHUP', listener: () => void): unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run `reload` on `SIGHUP`, debounced like the coordinator's `ConfigReloader`
|
|
43
|
+
* so a burst of signals reloads once. A Node.js process with no `SIGHUP`
|
|
44
|
+
* listener exits on the signal, so a host that reloads only its scaler config
|
|
45
|
+
* (a worker) installs this one. Returns the disposer that removes the listener.
|
|
46
|
+
*/
|
|
47
|
+
export declare function installScalerReloadSignal(reload: ScalerFileReload, logger: Logger, signals?: SignalSource): () => void;
|
|
48
|
+
//# sourceMappingURL=file-reload.d.ts.map
|