underpost 3.2.80 → 3.2.90
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/CHANGELOG.md +182 -1
- package/CLI-HELP.md +37 -16
- package/README.md +2 -2
- package/bin/deploy.js +18 -16
- package/docker-compose.yml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/playwright/deployment.yaml +1 -1
- package/manifests/mongodb/kustomization.yaml +4 -1
- package/manifests/mongodb/statefulset.yaml +4 -0
- package/manifests/mongodb/storage-class.yaml +9 -2
- package/package.json +17 -17
- package/scripts/nat-iptables.sh +10 -4
- package/scripts/test-monitor.sh +4 -3
- package/src/cli/cluster.js +740 -55
- package/src/cli/db.js +2 -2
- package/src/cli/deploy.js +1679 -174
- package/src/cli/docker-compose.js +19 -178
- package/src/cli/image.js +15 -6
- package/src/cli/index.js +124 -35
- package/src/cli/ipfs.js +82 -11
- package/src/cli/monitor.js +1 -1
- package/src/cli/repository.js +1 -1
- package/src/cli/run.js +2161 -420
- package/src/cli/secrets.js +969 -0
- package/src/cli/ssh.js +8 -28
- package/src/client-builder/client-build.js +94 -11
- package/src/client-builder/ssr.js +27 -73
- package/src/db/mongo/MongoBootstrap.js +295 -54
- package/src/db/mongo/MongooseDB.js +47 -32
- package/src/index.js +1 -1
- package/src/server/conf.js +1208 -70
- package/src/server/cri.js +70 -0
- package/src/server/underpost-gateway.js +1073 -0
- package/src/server/underpost-ingress.js +364 -0
- package/test/cluster-instances.test.js +435 -0
- package/test/deploy-node-placement.test.js +45 -0
- package/test/instance-traffic-plan.test.js +710 -0
- package/test/sops-secret-store.test.js +612 -0
- package/test/underpost-gateway.test.js +469 -0
- package/test/underpost-ingress.test.js +253 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRI (Container Runtime Interface) endpoint resolution shared by every layer
|
|
3
|
+
* that shells out to `crictl`: the cluster CLI, image management, and the
|
|
4
|
+
* database bootstraps. Lives under `src/server` so the db layer can import it
|
|
5
|
+
* without depending on the CLI god-object.
|
|
6
|
+
* @module src/server/cri.js
|
|
7
|
+
* @namespace CriEndpoint
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { shellExec } from './process.js';
|
|
11
|
+
|
|
12
|
+
const CRIO_SOCKET_PATH = '/var/run/crio/crio.sock';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @constant CRI_SOCKETS
|
|
16
|
+
* @description The CRI endpoints this platform ever targets.
|
|
17
|
+
* @memberof CriEndpoint
|
|
18
|
+
*/
|
|
19
|
+
const CRI_SOCKETS = {
|
|
20
|
+
crio: `unix://${CRIO_SOCKET_PATH}`,
|
|
21
|
+
containerd: 'unix:///run/containerd/containerd.sock',
|
|
22
|
+
k3s: 'unix:///run/k3s/containerd/containerd.sock',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @method resolveCriSocket
|
|
27
|
+
* @description Resolves the CRI endpoint a `crictl` or `kubeadm` call should
|
|
28
|
+
* target. K3s runs its own embedded containerd; a kubeadm host uses CRI-O only
|
|
29
|
+
* while that socket actually exists, otherwise the host-level containerd.
|
|
30
|
+
*
|
|
31
|
+
* Detection is by socket presence, never by configuration, so a host whose
|
|
32
|
+
* CRI-O install was removed or stopped still resolves to a runtime that answers.
|
|
33
|
+
* @param {object} [options] - Resolution inputs.
|
|
34
|
+
* @param {boolean} [options.k3s=false] - Whether the cluster is K3s-based.
|
|
35
|
+
* @param {string} [options.criSocket] - Explicit endpoint override (highest precedence).
|
|
36
|
+
* @returns {string} CRI endpoint URI.
|
|
37
|
+
* @memberof CriEndpoint
|
|
38
|
+
*/
|
|
39
|
+
const resolveCriSocket = (options = {}) => {
|
|
40
|
+
if (options?.criSocket) return options.criSocket;
|
|
41
|
+
if (options?.k3s) return CRI_SOCKETS.k3s;
|
|
42
|
+
const runtime = shellExec(`test -S ${CRIO_SOCKET_PATH} && echo crio || echo containerd`, {
|
|
43
|
+
stdout: true,
|
|
44
|
+
silent: true,
|
|
45
|
+
}).trim();
|
|
46
|
+
return runtime === 'crio' ? CRI_SOCKETS.crio : CRI_SOCKETS.containerd;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @method crictlCommandFactory
|
|
51
|
+
* @description Builds a `crictl` invocation pinned to the live CRI endpoint.
|
|
52
|
+
*
|
|
53
|
+
* Both `--runtime-endpoint` and `--image-endpoint` are passed. crictl resolves
|
|
54
|
+
* the two independently, and `run install-crio` writes both into
|
|
55
|
+
* `/etc/crictl.yaml` pointing at CRI-O; overriding only the runtime leaves image
|
|
56
|
+
* operations (`pull`, `rmi`, `images`) validating a `crio.sock` that no longer
|
|
57
|
+
* exists, which fails with "validate CRI v1 image API for endpoint".
|
|
58
|
+
*
|
|
59
|
+
* crictl is not on sudo's secure_path, hence the explicit PATH.
|
|
60
|
+
* @param {string} args - crictl subcommand and arguments (e.g. `pull mongo:latest`).
|
|
61
|
+
* @param {object} [options] - Forwarded to {@link CriEndpoint.resolveCriSocket}.
|
|
62
|
+
* @returns {string} Full shell command.
|
|
63
|
+
* @memberof CriEndpoint
|
|
64
|
+
*/
|
|
65
|
+
const crictlCommandFactory = (args, options = {}) => {
|
|
66
|
+
const socket = resolveCriSocket(options);
|
|
67
|
+
return `sudo env PATH="$PATH:/usr/local/bin:/usr/bin" crictl --runtime-endpoint ${socket} --image-endpoint ${socket} ${args}`;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { CRI_SOCKETS, resolveCriSocket, crictlCommandFactory };
|