underpost 2.89.44 → 2.90.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 +2 -2
- package/cli.md +112 -101
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +8 -24
- package/manifests/kubeadm-calico-config.yaml +1 -1
- package/manifests/lxd/underpost-setup.sh +1 -1
- package/package.json +1 -1
- package/scripts/nvim.sh +1 -1
- package/src/cli/cluster.js +17 -55
- package/src/cli/db.js +34 -10
- package/src/cli/deploy.js +280 -178
- package/src/cli/index.js +18 -4
- package/src/cli/monitor.js +4 -2
- package/src/cli/run.js +218 -13
- package/src/client/components/core/CalendarCore.js +1 -7
- package/src/client/components/core/Modal.js +2 -2
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +1 -5
- package/src/client/components/default/MenuDefault.js +5 -30
- package/src/index.js +1 -1
- package/src/server/client-build.js +13 -31
- package/src/server/json-schema.js +0 -77
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- badges -->
|
|
20
20
|
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.90.0) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
22
22
|
|
|
23
23
|
<!-- end-badges -->
|
|
24
24
|
|
|
@@ -66,7 +66,7 @@ Run dev client server
|
|
|
66
66
|
npm run dev
|
|
67
67
|
```
|
|
68
68
|
<!-- -->
|
|
69
|
-
## underpost ci/cd cli v2.
|
|
69
|
+
## underpost ci/cd cli v2.90.0
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.
|
|
1
|
+
## underpost ci/cd cli v2.90.0
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -245,69 +245,75 @@ Options:
|
|
|
245
245
|
Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
246
246
|
|
|
247
247
|
Arguments:
|
|
248
|
-
pod-name
|
|
249
|
-
|
|
248
|
+
pod-name Optional: Filters information by a
|
|
249
|
+
specific pod name.
|
|
250
250
|
|
|
251
251
|
Options:
|
|
252
|
-
--reset
|
|
253
|
-
|
|
254
|
-
--mariadb
|
|
255
|
-
|
|
256
|
-
--mysql
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
--
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
--
|
|
266
|
-
|
|
267
|
-
--
|
|
268
|
-
|
|
269
|
-
--
|
|
270
|
-
|
|
271
|
-
--
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
--
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
--
|
|
293
|
-
|
|
294
|
-
--
|
|
295
|
-
|
|
296
|
-
--
|
|
297
|
-
|
|
298
|
-
--
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
--
|
|
307
|
-
|
|
308
|
-
--
|
|
309
|
-
|
|
310
|
-
-
|
|
252
|
+
--reset Deletes all clusters and prunes all
|
|
253
|
+
related data and caches.
|
|
254
|
+
--mariadb Initializes the cluster with a MariaDB
|
|
255
|
+
statefulset.
|
|
256
|
+
--mysql Initializes the cluster with a MySQL
|
|
257
|
+
statefulset.
|
|
258
|
+
--mongodb Initializes the cluster with a MongoDB
|
|
259
|
+
statefulset.
|
|
260
|
+
--mongo-db-host <host> Set custom mongo db host
|
|
261
|
+
--postgresql Initializes the cluster with a
|
|
262
|
+
PostgreSQL statefulset.
|
|
263
|
+
--mongodb4 Initializes the cluster with a MongoDB
|
|
264
|
+
4.4 service.
|
|
265
|
+
--valkey Initializes the cluster with a Valkey
|
|
266
|
+
service.
|
|
267
|
+
--contour Initializes the cluster with Project
|
|
268
|
+
Contour base HTTPProxy and Envoy.
|
|
269
|
+
--cert-manager Initializes the cluster with a Let's
|
|
270
|
+
Encrypt production ClusterIssuer.
|
|
271
|
+
--dedicated-gpu Initializes the cluster with dedicated
|
|
272
|
+
GPU base resources and environment
|
|
273
|
+
settings.
|
|
274
|
+
--full Initializes the cluster with all
|
|
275
|
+
available statefulsets and services.
|
|
276
|
+
--ns-use <ns-name> Switches the current Kubernetes context
|
|
277
|
+
to the specified namespace (creates if
|
|
278
|
+
it doesn't exist).
|
|
279
|
+
--kubeadm Initializes the cluster using kubeadm
|
|
280
|
+
for control plane management.
|
|
281
|
+
--pod-network-cidr <cidr> Sets custom pod network CIDR for kubeadm
|
|
282
|
+
cluster initialization (defaults to
|
|
283
|
+
"192.168.0.0/16").
|
|
284
|
+
--control-plane-endpoint <endpoint> Sets custom control plane endpoint for
|
|
285
|
+
kubeadm cluster initialization (defaults
|
|
286
|
+
to "localhost:6443").
|
|
287
|
+
--grafana Initializes the cluster with a Grafana
|
|
288
|
+
deployment.
|
|
289
|
+
--prom [hosts] Initializes the cluster with a
|
|
290
|
+
Prometheus Operator deployment and
|
|
291
|
+
monitor scrap for specified hosts.
|
|
292
|
+
--dev Initializes a development-specific
|
|
293
|
+
cluster configuration.
|
|
294
|
+
--list-pods Displays detailed information about all
|
|
295
|
+
pods.
|
|
296
|
+
--pull-image Sets an optional associated image to
|
|
297
|
+
pull during initialization.
|
|
298
|
+
--init-host Installs necessary Kubernetes node CLI
|
|
299
|
+
tools (e.g., kind, kubeadm, docker,
|
|
300
|
+
podman, helm).
|
|
301
|
+
--uninstall-host Uninstalls all host components installed
|
|
302
|
+
by init-host.
|
|
303
|
+
--config Sets the base Kubernetes node
|
|
304
|
+
configuration.
|
|
305
|
+
--worker Sets the context for a worker node.
|
|
306
|
+
--chown Sets the appropriate ownership for
|
|
307
|
+
Kubernetes kubeconfig files.
|
|
308
|
+
--k3s Initializes the cluster using K3s
|
|
309
|
+
(Lightweight Kubernetes).
|
|
310
|
+
--hosts <hosts> A comma-separated list of cluster
|
|
311
|
+
hostnames or IP addresses.
|
|
312
|
+
--remove-volume-host-paths Removes specified volume host paths
|
|
313
|
+
after execution.
|
|
314
|
+
--namespace <namespace> Kubernetes namespace for cluster
|
|
315
|
+
operations (defaults to "default").
|
|
316
|
+
-h, --help display help for command
|
|
311
317
|
|
|
312
318
|
```
|
|
313
319
|
|
|
@@ -334,8 +340,6 @@ Options:
|
|
|
334
340
|
configuration.
|
|
335
341
|
--expose Exposes services matching the provided
|
|
336
342
|
deployment ID list.
|
|
337
|
-
--info-util Displays useful `kubectl` utility
|
|
338
|
-
management commands.
|
|
339
343
|
--cert Resets TLS/SSL certificate secrets for
|
|
340
344
|
deployments.
|
|
341
345
|
--cert-hosts <hosts> Resets TLS/SSL certificate secrets for
|
|
@@ -660,45 +664,52 @@ Options:
|
|
|
660
664
|
Runs a script from the specified path.
|
|
661
665
|
|
|
662
666
|
Arguments:
|
|
663
|
-
runner-id
|
|
664
|
-
path
|
|
667
|
+
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, metadata, svc-ls, svc-rm, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, tz, cron, get-proxy, instance-promote, instance, ls-deployments, ls-images, host-update, dd-container, ip-info, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, sync-replica, tf-vae-test, deploy-job.
|
|
668
|
+
path The absolute or relative directory path where the script is located.
|
|
665
669
|
|
|
666
670
|
Options:
|
|
667
|
-
--command <command-array>
|
|
668
|
-
--args <args-array>
|
|
669
|
-
--dev
|
|
670
|
-
--build
|
|
671
|
-
--replicas <replicas>
|
|
672
|
-
--pod-name <pod-name>
|
|
673
|
-
--node-name <node-name>
|
|
674
|
-
--port <port>
|
|
675
|
-
--etc-hosts
|
|
676
|
-
--volume-host-path <volume-host-path>
|
|
677
|
-
--volume-mount-path <volume-mount-path>
|
|
678
|
-
--volume-type <volume-type>
|
|
679
|
-
--image-name <image-name>
|
|
680
|
-
--container-name <container-name>
|
|
681
|
-
--namespace <namespace>
|
|
682
|
-
--tty
|
|
683
|
-
--stdin
|
|
684
|
-
--restart-policy <policy>
|
|
685
|
-
--runtime-class-name <name>
|
|
686
|
-
--image-pull-policy <policy>
|
|
687
|
-
--api-version <version>
|
|
688
|
-
--labels <labels>
|
|
689
|
-
--claim-name <name>
|
|
690
|
-
--kind <kind-type>
|
|
691
|
-
--kubeadm
|
|
692
|
-
--k3s
|
|
693
|
-
--force
|
|
694
|
-
--tls
|
|
695
|
-
--reset
|
|
696
|
-
--terminal
|
|
697
|
-
--dev-proxy-port-offset <port-offset>
|
|
698
|
-
--host-network
|
|
699
|
-
--
|
|
700
|
-
--
|
|
701
|
-
-
|
|
671
|
+
--command <command-array> Array of commands to run.
|
|
672
|
+
--args <args-array> Array of arguments to pass to the command.
|
|
673
|
+
--dev Sets the development context environment for the script.
|
|
674
|
+
--build Set builder context runner
|
|
675
|
+
--replicas <replicas> Sets a custom number of replicas for deployment.
|
|
676
|
+
--pod-name <pod-name> Optional: Specifies the pod name for execution.
|
|
677
|
+
--node-name <node-name> Optional: Specifies the node name for execution.
|
|
678
|
+
--port <port> Optional: Specifies the port for execution.
|
|
679
|
+
--etc-hosts Enables etc-hosts context for the runner execution.
|
|
680
|
+
--volume-host-path <volume-host-path> Optional: Specifies the volume host path for test execution.
|
|
681
|
+
--volume-mount-path <volume-mount-path> Optional: Specifies the volume mount path for test execution.
|
|
682
|
+
--volume-type <volume-type> Optional: Specifies the volume type for test execution.
|
|
683
|
+
--image-name <image-name> Optional: Specifies the image name for test execution.
|
|
684
|
+
--container-name <container-name> Optional: Specifies the container name for test execution.
|
|
685
|
+
--namespace <namespace> Optional: Specifies the namespace for test execution.
|
|
686
|
+
--tty Enables TTY for the container in deploy-job.
|
|
687
|
+
--stdin Keeps STDIN open for the container in deploy-job.
|
|
688
|
+
--restart-policy <policy> Sets the restart policy for the job in deploy-job.
|
|
689
|
+
--runtime-class-name <name> Sets the runtime class name for the job in deploy-job.
|
|
690
|
+
--image-pull-policy <policy> Sets the image pull policy for the job in deploy-job.
|
|
691
|
+
--api-version <version> Sets the API version for the job manifest in deploy-job.
|
|
692
|
+
--labels <labels> Optional: Specifies a comma-separated list of key-value pairs for labels (e.g., "app=my-app,env=prod").
|
|
693
|
+
--claim-name <name> Optional: Specifies the claim name for volume mounting in deploy-job.
|
|
694
|
+
--kind <kind-type> Specifies the kind of Kubernetes resource (e.g., Job, Deployment) for deploy-job.
|
|
695
|
+
--kubeadm Flag to indicate Kubeadm cluster type context
|
|
696
|
+
--k3s Flag to indicate K3s cluster type context
|
|
697
|
+
--force Forces operation, overriding any warnings or conflicts.
|
|
698
|
+
--tls Enables TLS for the runner execution.
|
|
699
|
+
--reset Resets the runner state before execution.
|
|
700
|
+
--terminal Enables terminal mode for interactive script execution.
|
|
701
|
+
--dev-proxy-port-offset <port-offset> Sets a custom port offset for development proxy.
|
|
702
|
+
--host-network Enables host network mode for the runner execution.
|
|
703
|
+
--requests-memory <requests-memory> Requests memory limit for the runner execution.
|
|
704
|
+
--requests-cpu <requests-cpu> Requests CPU limit for the runner execution.
|
|
705
|
+
--limits-memory <limits-memory> Sets memory limit for the runner execution.
|
|
706
|
+
--limits-cpu <limits-cpu> Sets CPU limit for the runner execution.
|
|
707
|
+
--resource-template-id <resource-template-id > Specifies a resource template ID for the runner execution.
|
|
708
|
+
--etcHosts Enables /etc/hosts management for the runner execution.
|
|
709
|
+
--expose Enables service exposure for the runner execution.
|
|
710
|
+
--conf-server-path <conf-server-path> Sets a custom configuration server path.
|
|
711
|
+
--underpost-root <underpost-root> Sets a custom Underpost root path.
|
|
712
|
+
-h, --help display help for command
|
|
702
713
|
|
|
703
714
|
```
|
|
704
715
|
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.90.0
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.90.0
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,22 +18,14 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
22
|
-
|
|
23
|
-
# requests:
|
|
24
|
-
# memory: "96294Ki"
|
|
25
|
-
# cpu: "75m"
|
|
26
|
-
# limits:
|
|
27
|
-
# memory: "1540709Ki"
|
|
28
|
-
# cpu: "1200m"
|
|
21
|
+
image: localhost/rockylinux9-underpost:v2.90.0
|
|
22
|
+
|
|
29
23
|
command:
|
|
30
24
|
- /bin/sh
|
|
31
25
|
- -c
|
|
32
26
|
- >
|
|
33
|
-
npm install -g npm@11.2.0 &&
|
|
34
|
-
|
|
35
|
-
underpost secret underpost --create-from-file /etc/config/.env.development &&
|
|
36
|
-
underpost start --build --run dd-test development
|
|
27
|
+
npm install -g npm@11.2.0 && npm install -g underpost && underpost secret underpost --create-from-file /etc/config/.env.development && underpost start --build --run dd-test development
|
|
28
|
+
|
|
37
29
|
|
|
38
30
|
volumeMounts:
|
|
39
31
|
- name: config-volume-dd-test-development-blue
|
|
@@ -111,22 +103,14 @@ spec:
|
|
|
111
103
|
spec:
|
|
112
104
|
containers:
|
|
113
105
|
- name: dd-test-development-green
|
|
114
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
115
|
-
|
|
116
|
-
# requests:
|
|
117
|
-
# memory: "96294Ki"
|
|
118
|
-
# cpu: "75m"
|
|
119
|
-
# limits:
|
|
120
|
-
# memory: "1540709Ki"
|
|
121
|
-
# cpu: "1200m"
|
|
106
|
+
image: localhost/rockylinux9-underpost:v2.90.0
|
|
107
|
+
|
|
122
108
|
command:
|
|
123
109
|
- /bin/sh
|
|
124
110
|
- -c
|
|
125
111
|
- >
|
|
126
|
-
npm install -g npm@11.2.0 &&
|
|
127
|
-
|
|
128
|
-
underpost secret underpost --create-from-file /etc/config/.env.development &&
|
|
129
|
-
underpost start --build --run dd-test development
|
|
112
|
+
npm install -g npm@11.2.0 && npm install -g underpost && underpost secret underpost --create-from-file /etc/config/.env.development && underpost start --build --run dd-test development
|
|
113
|
+
|
|
130
114
|
|
|
131
115
|
volumeMounts:
|
|
132
116
|
- name: config-volume-dd-test-development-green
|
|
@@ -40,7 +40,7 @@ sudo dnf -y update
|
|
|
40
40
|
|
|
41
41
|
# --- NVM and Node.js Installation ---
|
|
42
42
|
echo "Installing NVM and Node.js v24.10.0..."
|
|
43
|
-
curl -o- https://
|
|
43
|
+
curl -o- https://cdn.jsdelivr.net/gh/nvm-sh/nvm@v0.40.1/install.sh | bash
|
|
44
44
|
|
|
45
45
|
# Load nvm for the current session
|
|
46
46
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
package/package.json
CHANGED
package/scripts/nvim.sh
CHANGED
|
@@ -12,7 +12,7 @@ mkdir -p ~/.local/share/nvim/site/autoload
|
|
|
12
12
|
|
|
13
13
|
# Install vim-plug for Neovim
|
|
14
14
|
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
|
15
|
-
|
|
15
|
+
https://cdn.jsdelivr.net/gh/junegunn/vim-plug@master/plug.vim
|
|
16
16
|
|
|
17
17
|
# Create an init.vim with nvim-tree.lua + web-devicons + gruvbox (theme)
|
|
18
18
|
cat > ~/.config/nvim/init.vim <<'EOF'
|
package/src/cli/cluster.js
CHANGED
|
@@ -51,6 +51,8 @@ class UnderpostCluster {
|
|
|
51
51
|
* @param {boolean} [options.pullImage=false] - Pull necessary Docker images before deployment.
|
|
52
52
|
* @param {boolean} [options.dedicatedGpu=false] - Configure for dedicated GPU usage (e.g., NVIDIA GPU Operator).
|
|
53
53
|
* @param {boolean} [options.kubeadm=false] - Initialize the cluster using Kubeadm.
|
|
54
|
+
* @param {string} [options.podNetworkCidr='192.168.0.0/16'] - Custom pod network CIDR for Kubeadm cluster initialization. Defaults to '192.168.0.0/16'.
|
|
55
|
+
* @param {string} [options.controlPlaneEndpoint=''] - Custom control plane endpoint for Kubeadm cluster initialization. Defaults to '${os.hostname()}:6443'.
|
|
54
56
|
* @param {boolean} [options.k3s=false] - Initialize the cluster using K3s.
|
|
55
57
|
* @param {boolean} [options.initHost=false] - Perform initial host setup (install Docker, Podman, Kind, Kubeadm, Helm).
|
|
56
58
|
* @param {boolean} [options.grafana=false] - Initialize the cluster with a Grafana deployment.
|
|
@@ -86,6 +88,8 @@ class UnderpostCluster {
|
|
|
86
88
|
pullImage: false,
|
|
87
89
|
dedicatedGpu: false,
|
|
88
90
|
kubeadm: false,
|
|
91
|
+
podNetworkCidr: '192.168.0.0/16',
|
|
92
|
+
controlPlaneEndpoint: '',
|
|
89
93
|
k3s: false,
|
|
90
94
|
initHost: false,
|
|
91
95
|
grafana: false,
|
|
@@ -113,10 +117,6 @@ class UnderpostCluster {
|
|
|
113
117
|
const npmRoot = getNpmRootPath();
|
|
114
118
|
const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
|
|
115
119
|
|
|
116
|
-
// Information gathering options
|
|
117
|
-
if (options.infoCapacityPod === true) return logger.info('', UnderpostDeploy.API.resourcesFactory());
|
|
118
|
-
if (options.infoCapacity === true)
|
|
119
|
-
return logger.info('', UnderpostCluster.API.getResourcesCapacity(options.kubeadm || options.k3s)); // Adjust for k3s
|
|
120
120
|
if (options.listPods === true) return console.table(UnderpostDeploy.API.get(podName ?? undefined));
|
|
121
121
|
// Set default namespace if not specified
|
|
122
122
|
if (!options.namespace) options.namespace = 'default';
|
|
@@ -140,39 +140,6 @@ class UnderpostCluster {
|
|
|
140
140
|
logger.info(`Context switched to namespace: ${options.nsUse}`);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
if (options.info === true) {
|
|
144
|
-
shellExec(`kubectl config get-contexts`);
|
|
145
|
-
shellExec(`kubectl config get-clusters`);
|
|
146
|
-
shellExec(`kubectl get nodes -o wide`);
|
|
147
|
-
shellExec(`kubectl config view | grep namespace`);
|
|
148
|
-
shellExec(`kubectl get ns -o wide`);
|
|
149
|
-
shellExec(`kubectl get pvc --all-namespaces -o wide`);
|
|
150
|
-
shellExec(`kubectl get pv --all-namespaces -o wide`);
|
|
151
|
-
shellExec(`kubectl get cronjob --all-namespaces -o wide`);
|
|
152
|
-
shellExec(`kubectl get svc --all-namespaces -o wide`);
|
|
153
|
-
shellExec(`kubectl get statefulsets --all-namespaces -o wide`);
|
|
154
|
-
shellExec(`kubectl get deployments --all-namespaces -o wide`);
|
|
155
|
-
shellExec(`kubectl get configmap --all-namespaces -o wide`);
|
|
156
|
-
shellExec(`kubectl get pods --all-namespaces -o wide`);
|
|
157
|
-
shellExec(
|
|
158
|
-
`kubectl get pod --all-namespaces -o="custom-columns=NAME:.metadata.name,INIT-CONTAINERS:.spec.initContainers[*].name,CONTAINERS:.spec.containers[*].name"`,
|
|
159
|
-
);
|
|
160
|
-
shellExec(
|
|
161
|
-
`kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\\n"}{.metadata.name}{":\\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}'`,
|
|
162
|
-
);
|
|
163
|
-
shellExec(`sudo crictl images`);
|
|
164
|
-
console.log();
|
|
165
|
-
logger.info('contour -------------------------------------------------');
|
|
166
|
-
for (const _k of ['Cluster', 'HTTPProxy', 'ClusterIssuer', 'Certificate']) {
|
|
167
|
-
shellExec(`kubectl get ${_k} --all-namespaces -o wide`);
|
|
168
|
-
}
|
|
169
|
-
logger.info('----------------------------------------------------------------');
|
|
170
|
-
shellExec(`kubectl get secrets --all-namespaces -o wide`);
|
|
171
|
-
shellExec(`docker secret ls`);
|
|
172
|
-
shellExec(`kubectl get crd --all-namespaces -o wide`);
|
|
173
|
-
shellExec(`sudo kubectl api-resources`);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
143
|
|
|
177
144
|
// Reset Kubernetes cluster components (Kind/Kubeadm/K3s) and container runtimes
|
|
178
145
|
if (options.reset === true)
|
|
@@ -250,9 +217,13 @@ class UnderpostCluster {
|
|
|
250
217
|
logger.info('K3s comes with local-path-provisioner by default. Skipping explicit installation.');
|
|
251
218
|
} else if (options.kubeadm === true) {
|
|
252
219
|
logger.info('Initializing Kubeadm control plane...');
|
|
220
|
+
// Set default values if not provided
|
|
221
|
+
const podNetworkCidr = options.podNetworkCidr || '192.168.0.0/16';
|
|
222
|
+
const controlPlaneEndpoint = options.controlPlaneEndpoint || `${os.hostname()}:6443`;
|
|
223
|
+
|
|
253
224
|
// Initialize kubeadm control plane
|
|
254
225
|
shellExec(
|
|
255
|
-
`sudo kubeadm init --pod-network-cidr
|
|
226
|
+
`sudo kubeadm init --pod-network-cidr=${podNetworkCidr} --control-plane-endpoint="${controlPlaneEndpoint}"`,
|
|
256
227
|
);
|
|
257
228
|
// Configure kubectl for the current user
|
|
258
229
|
UnderpostCluster.API.chown('kubeadm'); // Pass 'kubeadm' to chown
|
|
@@ -260,11 +231,12 @@ class UnderpostCluster {
|
|
|
260
231
|
// Install Calico CNI
|
|
261
232
|
logger.info('Installing Calico CNI...');
|
|
262
233
|
shellExec(
|
|
263
|
-
`sudo kubectl create -f https://
|
|
234
|
+
`sudo kubectl create -f https://cdn.jsdelivr.net/gh/projectcalico/calico@v3.29.3/manifests/tigera-operator.yaml`,
|
|
264
235
|
);
|
|
265
236
|
shellExec(
|
|
266
|
-
`
|
|
237
|
+
`kubectl create -f https://cdn.jsdelivr.net/gh/projectcalico/calico@v3.29.3/manifests/custom-resources.yaml`,
|
|
267
238
|
);
|
|
239
|
+
shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/kubeadm-calico-config.yaml`);
|
|
268
240
|
|
|
269
241
|
// Untaint control plane node to allow scheduling pods
|
|
270
242
|
const nodeName = os.hostname();
|
|
@@ -272,7 +244,7 @@ class UnderpostCluster {
|
|
|
272
244
|
// Install local-path-provisioner for dynamic PVCs (optional but recommended)
|
|
273
245
|
logger.info('Installing local-path-provisioner...');
|
|
274
246
|
shellExec(
|
|
275
|
-
`kubectl apply -f https://
|
|
247
|
+
`kubectl apply -f https://cdn.jsdelivr.net/gh/rancher/local-path-provisioner@master/deploy/local-path-storage.yaml`,
|
|
276
248
|
);
|
|
277
249
|
} else {
|
|
278
250
|
// Kind cluster initialization (if not using kubeadm or k3s)
|
|
@@ -338,18 +310,6 @@ EOF
|
|
|
338
310
|
${yaml}
|
|
339
311
|
EOF
|
|
340
312
|
`);
|
|
341
|
-
|
|
342
|
-
// https://grafana.com/docs/grafana-cloud/monitor-infrastructure/kubernetes-monitoring/configuration/config-other-methods/prometheus/prometheus-operator/
|
|
343
|
-
// shellExec(
|
|
344
|
-
// `kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml`,
|
|
345
|
-
// );
|
|
346
|
-
// shellExec(`kubectl apply -f ${underpostRoot}/manifests/prometheus/prometheus-cr.yaml`);
|
|
347
|
-
// shellExec(`kubectl rollout status sts prometheus-prometheus -n default`);
|
|
348
|
-
// shellExec(`kubectl apply -f ${underpostRoot}/manifests/prometheus/prometheus-server.yaml`);
|
|
349
|
-
// shellExec(`helm repo add prometheus-community https://prometheus-community.github.io/helm-charts`);
|
|
350
|
-
// shellExec(`helm repo update`);
|
|
351
|
-
// shellExec(`helm install prometheus prometheus-community/prometheus`);
|
|
352
|
-
// shellExec(`kubectl rollout status deployment prometheus-server -n default`);
|
|
353
313
|
}
|
|
354
314
|
|
|
355
315
|
if (options.full === true || options.valkey === true) {
|
|
@@ -479,7 +439,9 @@ EOF
|
|
|
479
439
|
}
|
|
480
440
|
|
|
481
441
|
if (options.full === true || options.contour === true) {
|
|
482
|
-
shellExec(
|
|
442
|
+
shellExec(
|
|
443
|
+
`kubectl apply -f https://cdn.jsdelivr.net/gh/projectcontour/contour@release-1.33/examples/render/contour.yaml`,
|
|
444
|
+
);
|
|
483
445
|
if (options.kubeadm === true) {
|
|
484
446
|
// Envoy service might need NodePort for kubeadm
|
|
485
447
|
shellExec(
|
|
@@ -810,7 +772,7 @@ EOF`);
|
|
|
810
772
|
shellExec(`sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes`);
|
|
811
773
|
|
|
812
774
|
// Install Helm
|
|
813
|
-
shellExec(`curl -fsSL -o get_helm.sh https://
|
|
775
|
+
shellExec(`curl -fsSL -o get_helm.sh https://cdn.jsdelivr.net/gh/helm/helm@main/scripts/get-helm-3`);
|
|
814
776
|
shellExec(`chmod 700 get_helm.sh`);
|
|
815
777
|
shellExec(`./get_helm.sh`);
|
|
816
778
|
shellExec(`chmod +x /usr/local/bin/helm`);
|
package/src/cli/db.js
CHANGED
|
@@ -147,18 +147,20 @@ class UnderpostDB {
|
|
|
147
147
|
for (const podNameData of [podNames[0]]) {
|
|
148
148
|
const podName = podNameData.NAME;
|
|
149
149
|
if (options.import === true) {
|
|
150
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}.sql"`);
|
|
150
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}.sql"`);
|
|
151
151
|
shellExec(`sudo kubectl cp ${_toSqlPath} ${nameSpace}/${podName}:/${dbName}.sql`);
|
|
152
152
|
const cmd = `mariadb -u ${user} -p${password} ${dbName} < /${dbName}.sql`;
|
|
153
153
|
shellExec(
|
|
154
|
-
`kubectl exec -i ${podName} -- ${serviceName} -p${password} -e 'CREATE DATABASE ${dbName};'`,
|
|
154
|
+
`kubectl exec -n ${nameSpace} -i ${podName} -- ${serviceName} -p${password} -e 'CREATE DATABASE ${dbName};'`,
|
|
155
155
|
);
|
|
156
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
156
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
157
157
|
}
|
|
158
158
|
if (options.export === true) {
|
|
159
|
-
shellExec(
|
|
159
|
+
shellExec(
|
|
160
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf ${sqlContainerPath}"`,
|
|
161
|
+
);
|
|
160
162
|
const cmd = `mariadb-dump --user=${user} --password=${password} --lock-tables ${dbName} > ${sqlContainerPath}`;
|
|
161
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
163
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
162
164
|
shellExec(
|
|
163
165
|
`sudo kubectl cp ${nameSpace}/${podName}:${sqlContainerPath} ${
|
|
164
166
|
options.outPath ? options.outPath : _toNewSqlPath
|
|
@@ -179,7 +181,7 @@ class UnderpostDB {
|
|
|
179
181
|
// `mongodb-0`;
|
|
180
182
|
for (const podNameData of [podNames[0]]) {
|
|
181
183
|
const podName = podNameData.NAME;
|
|
182
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
184
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
183
185
|
shellExec(
|
|
184
186
|
`sudo kubectl cp ${
|
|
185
187
|
options.outPath ? options.outPath : _toBsonPath
|
|
@@ -188,7 +190,7 @@ class UnderpostDB {
|
|
|
188
190
|
const cmd = `mongorestore -d ${dbName} /${dbName}${options.drop ? ' --drop' : ''}${
|
|
189
191
|
options.preserveUUID ? ' --preserveUUID' : ''
|
|
190
192
|
}`;
|
|
191
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
193
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
if (options.export === true) {
|
|
@@ -198,13 +200,16 @@ class UnderpostDB {
|
|
|
198
200
|
: UnderpostDeploy.API.get('mongo'); // `backup-access`;
|
|
199
201
|
for (const podNameData of [podNames[0]]) {
|
|
200
202
|
const podName = podNameData.NAME;
|
|
201
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
203
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
202
204
|
if (options.collections)
|
|
203
205
|
for (const collection of options.collections.split(','))
|
|
204
206
|
shellExec(
|
|
205
|
-
`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o /"`,
|
|
207
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o /"`,
|
|
206
208
|
);
|
|
207
|
-
else
|
|
209
|
+
else
|
|
210
|
+
shellExec(
|
|
211
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "mongodump -d ${dbName} -o /"`,
|
|
212
|
+
);
|
|
208
213
|
shellExec(
|
|
209
214
|
`sudo kubectl cp ${nameSpace}/${podName}:/${dbName} ${
|
|
210
215
|
options.outPath ? options.outPath : _toNewBsonPath
|
|
@@ -311,6 +316,25 @@ class UnderpostDB {
|
|
|
311
316
|
}
|
|
312
317
|
}
|
|
313
318
|
}
|
|
319
|
+
if (fs.existsSync(`./engine-private/conf/${deployId}/conf.instances.json`)) {
|
|
320
|
+
const confInstances = JSON.parse(
|
|
321
|
+
fs.readFileSync(`./engine-private/conf/${deployId}/conf.instances.json`, 'utf8'),
|
|
322
|
+
);
|
|
323
|
+
for (const instance of confInstances) {
|
|
324
|
+
const { id, host, path, fromPort, metadata } = instance;
|
|
325
|
+
const { runtime } = metadata;
|
|
326
|
+
const body = {
|
|
327
|
+
deployId,
|
|
328
|
+
host,
|
|
329
|
+
path,
|
|
330
|
+
port: fromPort,
|
|
331
|
+
client: id,
|
|
332
|
+
runtime,
|
|
333
|
+
};
|
|
334
|
+
logger.info('Instance save', body);
|
|
335
|
+
await new Instance(body).save();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
314
338
|
}
|
|
315
339
|
} catch (error) {
|
|
316
340
|
logger.error(error, error.stack);
|