underpost 2.89.22 → 2.89.37
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 +3 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +6 -6
- package/manifests/pv-pvc-dd.yaml +8 -8
- package/package.json +1 -1
- package/scripts/gen-fqdns.sh +14 -0
- package/scripts/ip-info.sh +118 -0
- package/src/api/user/user.model.js +10 -1
- package/src/cli/deploy.js +35 -19
- package/src/cli/index.js +1 -0
- package/src/cli/run.js +49 -17
- package/src/index.js +1 -1
- package/src/server/start.js +1 -1
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.89.37) [](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.89.
|
|
69
|
+
## underpost ci/cd cli v2.89.37
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.89.
|
|
1
|
+
## underpost ci/cd cli v2.89.37
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -641,7 +641,7 @@ Options:
|
|
|
641
641
|
Runs a script from the specified path.
|
|
642
642
|
|
|
643
643
|
Arguments:
|
|
644
|
-
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, ls-deployments, ls-images, host-update, dd-container, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, sync-replica, tf-vae-test, deploy-job.
|
|
644
|
+
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, 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.
|
|
645
645
|
path The absolute or relative directory path where the script is located.
|
|
646
646
|
|
|
647
647
|
Options:
|
|
@@ -675,6 +675,7 @@ Options:
|
|
|
675
675
|
--reset Resets the runner state before execution.
|
|
676
676
|
--terminal Enables terminal mode for interactive script execution.
|
|
677
677
|
--dev-proxy-port-offset <port-offset> Sets a custom port offset for development proxy.
|
|
678
|
+
--host-network Enables host network mode for the runner execution.
|
|
678
679
|
--conf-server-path <conf-server-path> Sets a custom configuration server path.
|
|
679
680
|
--underpost-root <underpost-root> Sets a custom Underpost root path.
|
|
680
681
|
-h, --help display help for command
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.89.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.89.37
|
|
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.89.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.89.37
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-test-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.89.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.89.37
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "96294Ki"
|
|
@@ -35,11 +35,11 @@ spec:
|
|
|
35
35
|
underpost start --build --run dd-test development
|
|
36
36
|
|
|
37
37
|
volumeMounts:
|
|
38
|
-
- name: config-volume
|
|
38
|
+
- name: config-volume-dd-test-development-blue
|
|
39
39
|
mountPath: /etc/config
|
|
40
40
|
|
|
41
41
|
volumes:
|
|
42
|
-
- name: config-volume
|
|
42
|
+
- name: config-volume-dd-test-development-blue
|
|
43
43
|
configMap:
|
|
44
44
|
name: underpost-config
|
|
45
45
|
|
|
@@ -108,7 +108,7 @@ spec:
|
|
|
108
108
|
spec:
|
|
109
109
|
containers:
|
|
110
110
|
- name: dd-test-development-green
|
|
111
|
-
image: localhost/rockylinux9-underpost:v2.89.
|
|
111
|
+
image: localhost/rockylinux9-underpost:v2.89.37
|
|
112
112
|
# resources:
|
|
113
113
|
# requests:
|
|
114
114
|
# memory: "96294Ki"
|
|
@@ -126,11 +126,11 @@ spec:
|
|
|
126
126
|
underpost start --build --run dd-test development
|
|
127
127
|
|
|
128
128
|
volumeMounts:
|
|
129
|
-
- name: config-volume
|
|
129
|
+
- name: config-volume-dd-test-development-green
|
|
130
130
|
mountPath: /etc/config
|
|
131
131
|
|
|
132
132
|
volumes:
|
|
133
|
-
- name: config-volume
|
|
133
|
+
- name: config-volume-dd-test-development-green
|
|
134
134
|
configMap:
|
|
135
135
|
name: underpost-config
|
|
136
136
|
|
package/manifests/pv-pvc-dd.yaml
CHANGED
|
@@ -12,14 +12,14 @@ spec:
|
|
|
12
12
|
hostPath:
|
|
13
13
|
path: /home/dd
|
|
14
14
|
type: DirectoryOrCreate
|
|
15
|
-
nodeAffinity:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
# nodeAffinity:
|
|
16
|
+
# required:
|
|
17
|
+
# nodeSelectorTerms:
|
|
18
|
+
# - matchExpressions:
|
|
19
|
+
# - key: kubernetes.io/hostname
|
|
20
|
+
# operator: In
|
|
21
|
+
# values:
|
|
22
|
+
# - localhost
|
|
23
23
|
---
|
|
24
24
|
apiVersion: v1
|
|
25
25
|
kind: PersistentVolumeClaim
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# gen-fqdns.sh - generate a readable plain table with FQDNs for all services and pods in the cluster
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
CLUSTER_DOMAIN="${CLUSTER_DOMAIN:-cluster.local}"
|
|
7
|
+
|
|
8
|
+
# Services: <service>.<namespace>.svc.<cluster-domain>
|
|
9
|
+
kubectl get svc --all-namespaces -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers \
|
|
10
|
+
| awk -v cd="$CLUSTER_DOMAIN" '{printf "%-20s %-34s %-6s %s.%s.svc.%s\n", $1, $2, "svc", $2, $1, cd}'
|
|
11
|
+
|
|
12
|
+
# Pods: <pod>.<namespace>.pod.<cluster-domain>
|
|
13
|
+
kubectl get pods --all-namespaces -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers \
|
|
14
|
+
| awk -v cd="$CLUSTER_DOMAIN" '{printf "%-20s %-34s %-6s %s.%s.pod.%s\n", $1, $2, "pod", $2, $1, cd}'
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ip-info.sh
|
|
3
|
+
# Retrieve information about an IP address or hostname
|
|
4
|
+
# Usage: ip-info.sh <IP-or-hostname>
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
IFS=$'
|
|
8
|
+
'
|
|
9
|
+
|
|
10
|
+
if [[ ${#} -lt 1 ]]; then
|
|
11
|
+
echo "Usage: $0 <IP-or-hostname>"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
TARGET="$1"
|
|
15
|
+
|
|
16
|
+
# Detect package manager
|
|
17
|
+
PKG_MANAGER=""
|
|
18
|
+
if command -v dnf >/dev/null 2>&1; then
|
|
19
|
+
PKG_MANAGER=dnf
|
|
20
|
+
elif command -v yum >/dev/null 2>&1; then
|
|
21
|
+
PKG_MANAGER=yum
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Commands we need (bind-utils provides dig)
|
|
25
|
+
REQUIRED_CMDS=(curl jq whois dig traceroute)
|
|
26
|
+
PKGS=(curl jq whois bind-utils traceroute)
|
|
27
|
+
|
|
28
|
+
missing=()
|
|
29
|
+
for i in "${!REQUIRED_CMDS[@]}"; do
|
|
30
|
+
cmd=${REQUIRED_CMDS[$i]}
|
|
31
|
+
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
32
|
+
missing+=("${PKGS[$i]}")
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
if [[ ${#missing[@]} -gt 0 ]]; then
|
|
37
|
+
if [[ -z "$PKG_MANAGER" ]]; then
|
|
38
|
+
echo "Missing packages: ${missing[*]}
|
|
39
|
+
No supported package manager found. Install: ${missing[*]} and re-run."
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
if [[ $EUID -ne 0 && -z "$(command -v sudo)" ]]; then
|
|
43
|
+
echo "Missing packages: ${missing[*]}
|
|
44
|
+
Run as root or install sudo."
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
echo "Installing missing: ${missing[*]}"
|
|
48
|
+
sudo $PKG_MANAGER install -y ${missing[*]} >/dev/null
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Resolve to IP(s)
|
|
52
|
+
resolve_ips(){
|
|
53
|
+
if getent ahosts "$TARGET" >/dev/null 2>&1; then
|
|
54
|
+
getent ahosts "$TARGET" | awk '{print $1}' | sort -u
|
|
55
|
+
else
|
|
56
|
+
dig +short "$TARGET" | awk '/^[0-9]/ {print $1}' | sort -u
|
|
57
|
+
fi
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
mapfile -t IPS < <(resolve_ips)
|
|
61
|
+
if [[ ${#IPS[@]} -eq 0 ]]; then
|
|
62
|
+
IPS=("$TARGET")
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
format(){
|
|
66
|
+
if command -v jq >/dev/null 2>&1; then
|
|
67
|
+
jq '.' 2>/dev/null || cat
|
|
68
|
+
else
|
|
69
|
+
cat
|
|
70
|
+
fi
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
for IP in "${IPS[@]}"; do
|
|
74
|
+
printf "
|
|
75
|
+
===== %s (resolved: %s) =====
|
|
76
|
+
|
|
77
|
+
" "$TARGET" "$IP"
|
|
78
|
+
|
|
79
|
+
echo "-- REVERSE DNS --"
|
|
80
|
+
dig -x "$IP" +short || true
|
|
81
|
+
|
|
82
|
+
echo "
|
|
83
|
+
-- WHOIS --"
|
|
84
|
+
whois "$IP" | sed -n '1,80p' || true
|
|
85
|
+
|
|
86
|
+
echo "
|
|
87
|
+
-- IPINFO (ipinfo.io) --"
|
|
88
|
+
curl -sS "https://ipinfo.io/$IP/json" | format || true
|
|
89
|
+
|
|
90
|
+
echo "
|
|
91
|
+
-- IP-API (ip-api.com) --"
|
|
92
|
+
curl -sS "http://ip-api.com/json/$IP?fields=status,message,country,regionName,city,zip,lat,lon,timezone,isp,org,as,query" | format || true
|
|
93
|
+
|
|
94
|
+
echo "
|
|
95
|
+
-- IPWHOIS (ipwhois.app) --"
|
|
96
|
+
curl -sS "https://ipwhois.app/json/$IP" | format || true
|
|
97
|
+
|
|
98
|
+
echo "
|
|
99
|
+
-- GEOPLUGIN --"
|
|
100
|
+
curl -sS "http://www.geoplugin.net/json.gp?ip=$IP" | format || true
|
|
101
|
+
|
|
102
|
+
echo "
|
|
103
|
+
-- TRACEROUTE --"
|
|
104
|
+
traceroute -m 20 "$IP" || true
|
|
105
|
+
|
|
106
|
+
if [[ "$TARGET" =~ [A-Za-z] ]]; then
|
|
107
|
+
echo "
|
|
108
|
+
-- DNS RECORDS for $TARGET --"
|
|
109
|
+
dig +short A "$TARGET" || true
|
|
110
|
+
dig +short AAAA "$TARGET" || true
|
|
111
|
+
dig +short MX "$TARGET" || true
|
|
112
|
+
dig +short TXT "$TARGET" || true
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
echo "
|
|
116
|
+
===== done: $IP =====
|
|
117
|
+
"
|
|
118
|
+
done
|
|
@@ -73,7 +73,16 @@ const ProviderSchema = UserSchema;
|
|
|
73
73
|
const UserDto = {
|
|
74
74
|
select: {
|
|
75
75
|
get: () => {
|
|
76
|
-
return {
|
|
76
|
+
return {
|
|
77
|
+
_id: 1,
|
|
78
|
+
username: 1,
|
|
79
|
+
email: 1,
|
|
80
|
+
role: 1,
|
|
81
|
+
emailConfirmed: 1,
|
|
82
|
+
profileImageId: 1,
|
|
83
|
+
createdAt: 1,
|
|
84
|
+
updatedAt: 1,
|
|
85
|
+
};
|
|
77
86
|
},
|
|
78
87
|
getAll: () => {
|
|
79
88
|
return { _id: 1 };
|
package/src/cli/deploy.js
CHANGED
|
@@ -179,7 +179,7 @@ spec:
|
|
|
179
179
|
npm install -g underpost &&
|
|
180
180
|
underpost secret underpost --create-from-file /etc/config/.env.${env} &&
|
|
181
181
|
underpost start --build --run ${deployId} ${env}
|
|
182
|
-
${UnderpostDeploy.API.volumeFactory(volumes)
|
|
182
|
+
${UnderpostDeploy.API.volumeFactory(volumes.map((v) => ((v.version = `${deployId}-${env}-${suffix}`), v)))
|
|
183
183
|
.render.split(`\n`)
|
|
184
184
|
.map((l) => ' ' + l)
|
|
185
185
|
.join(`\n`)}
|
|
@@ -437,6 +437,16 @@ kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
|
|
|
437
437
|
kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
|
|
438
438
|
kubectl wait --for=delete pod/busybox1 --timeout=60s
|
|
439
439
|
|
|
440
|
+
fqdn: <service>.<namespace>.<kind(svc/pod)>.<cluster-domain(cluster.local)>
|
|
441
|
+
node bin run cluster-build
|
|
442
|
+
node bin run template-deploy
|
|
443
|
+
node bin run ssh-deploy (sync-)engine-core
|
|
444
|
+
node bin run cluster --dev 'express,dd-test+dd-core'
|
|
445
|
+
node bin run dd-container --dev
|
|
446
|
+
node bin run promote dd-default production
|
|
447
|
+
node bin dockerfile-pull-base-images --dev --path 'image-path' --kind-load
|
|
448
|
+
node bin/deploy update-default-conf <deploy-id>
|
|
449
|
+
|
|
440
450
|
kubectl run --rm -it test-dns --image=busybox:latest --restart=Never -- /bin/sh -c "
|
|
441
451
|
nslookup kubernetes.default.svc.cluster.local;
|
|
442
452
|
nslookup mongodb-service.default.svc.cluster.local;
|
|
@@ -523,33 +533,34 @@ EOF`);
|
|
|
523
533
|
continue;
|
|
524
534
|
}
|
|
525
535
|
|
|
526
|
-
if (!options.disableUpdateDeployment)
|
|
527
|
-
for (const version of options.versions.split(',')) {
|
|
528
|
-
shellExec(`sudo kubectl delete svc ${deployId}-${env}-${version}-service`);
|
|
529
|
-
shellExec(`sudo kubectl delete deployment ${deployId}-${env}-${version}`);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
536
|
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
|
|
533
537
|
const confVolume = fs.existsSync(`./engine-private/conf/${deployId}/conf.volume.json`)
|
|
534
538
|
? JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.volume.json`, 'utf8'))
|
|
535
539
|
: [];
|
|
536
540
|
|
|
537
|
-
if (!options.
|
|
538
|
-
for (const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
541
|
+
if (!options.disableUpdateDeployment)
|
|
542
|
+
for (const version of options.versions.split(',')) {
|
|
543
|
+
shellExec(`sudo kubectl delete svc ${deployId}-${env}-${version}-service`);
|
|
544
|
+
shellExec(`sudo kubectl delete deployment ${deployId}-${env}-${version}`);
|
|
545
|
+
if (!options.disableUpdateVolume) {
|
|
546
|
+
for (const volume of confVolume) {
|
|
547
|
+
const pvcId = `${volume.claimName}-${deployId}-${env}-${version}`;
|
|
548
|
+
const pvId = `${volume.claimName.replace('pvc-', 'pv-')}-${deployId}-${env}-${version}`;
|
|
549
|
+
const rootVolumeHostPath = `/home/dd/engine/volume/${pvId}`;
|
|
550
|
+
if (!fs.existsSync(rootVolumeHostPath)) fs.mkdirSync(rootVolumeHostPath, { recursive: true });
|
|
551
|
+
fs.copySync(volume.volumeMountPath, rootVolumeHostPath);
|
|
552
|
+
shellExec(`kubectl delete pvc ${pvcId}`);
|
|
553
|
+
shellExec(`kubectl delete pv ${pvId}`);
|
|
554
|
+
shellExec(`kubectl apply -f - <<EOF
|
|
545
555
|
${UnderpostDeploy.API.persistentVolumeFactory({
|
|
546
|
-
hostPath:
|
|
547
|
-
pvcId
|
|
556
|
+
hostPath: rootVolumeHostPath,
|
|
557
|
+
pvcId,
|
|
548
558
|
})}
|
|
549
559
|
EOF
|
|
550
560
|
`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
551
563
|
}
|
|
552
|
-
}
|
|
553
564
|
|
|
554
565
|
for (const host of Object.keys(confServer)) {
|
|
555
566
|
if (!options.disableUpdateProxy) {
|
|
@@ -754,6 +765,7 @@ EOF
|
|
|
754
765
|
volumeType: 'Directory',
|
|
755
766
|
claimName: null,
|
|
756
767
|
configMap: null,
|
|
768
|
+
version: null,
|
|
757
769
|
},
|
|
758
770
|
],
|
|
759
771
|
) {
|
|
@@ -762,7 +774,11 @@ EOF
|
|
|
762
774
|
let _volumes = `
|
|
763
775
|
volumes:`;
|
|
764
776
|
volumes.map((volumeData) => {
|
|
765
|
-
|
|
777
|
+
let { volumeName, volumeMountPath, volumeHostPath, volumeType, claimName, configMap, version } = volumeData;
|
|
778
|
+
if (version) {
|
|
779
|
+
volumeName = `${volumeName}-${version}`;
|
|
780
|
+
claimName = claimName ? `${claimName}-${version}` : null;
|
|
781
|
+
}
|
|
766
782
|
_volumeMounts += `
|
|
767
783
|
- name: ${volumeName}
|
|
768
784
|
mountPath: ${volumeMountPath}
|
package/src/cli/index.js
CHANGED
|
@@ -411,6 +411,7 @@ program
|
|
|
411
411
|
.option('--reset', 'Resets the runner state before execution.')
|
|
412
412
|
.option('--terminal', 'Enables terminal mode for interactive script execution.')
|
|
413
413
|
.option('--dev-proxy-port-offset <port-offset>', 'Sets a custom port offset for development proxy.')
|
|
414
|
+
.option('--host-network', 'Enables host network mode for the runner execution.')
|
|
414
415
|
.option('--conf-server-path <conf-server-path>', 'Sets a custom configuration server path.')
|
|
415
416
|
.option('--underpost-root <underpost-root>', 'Sets a custom Underpost root path.')
|
|
416
417
|
.description('Runs a script from the specified path.')
|
package/src/cli/run.js
CHANGED
|
@@ -67,6 +67,7 @@ class UnderpostRun {
|
|
|
67
67
|
* @property {string} kind - The kind of resource to create.
|
|
68
68
|
* @property {boolean} terminal - Whether to open a terminal.
|
|
69
69
|
* @property {number} devProxyPortOffset - The port offset for the development proxy.
|
|
70
|
+
* @property {boolean} hostNetwork - Whether to use host networking.
|
|
70
71
|
* @property {string} confServerPath - The configuration server path.
|
|
71
72
|
* @property {string} underpostRoot - The root path of the Underpost installation.
|
|
72
73
|
* @memberof UnderpostRun
|
|
@@ -98,6 +99,7 @@ class UnderpostRun {
|
|
|
98
99
|
kind: '',
|
|
99
100
|
terminal: false,
|
|
100
101
|
devProxyPortOffset: 0,
|
|
102
|
+
hostNetwork: false,
|
|
101
103
|
confServerPath: '',
|
|
102
104
|
underpostRoot: '',
|
|
103
105
|
};
|
|
@@ -338,9 +340,10 @@ class UnderpostRun {
|
|
|
338
340
|
* @memberof UnderpostRun
|
|
339
341
|
*/
|
|
340
342
|
'cluster-build': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
343
|
+
const nodeOptions = options.nodeName ? ` --node-name ${options.nodeName}` : '';
|
|
341
344
|
shellExec(`node bin run clean`);
|
|
342
|
-
shellExec(`node bin run --dev sync-replica template-deploy`);
|
|
343
|
-
shellExec(`node bin run sync-replica template-deploy`);
|
|
345
|
+
shellExec(`node bin run --dev sync-replica template-deploy${nodeOptions}`);
|
|
346
|
+
shellExec(`node bin run sync-replica template-deploy${nodeOptions}`);
|
|
344
347
|
shellExec(`node bin env clean`);
|
|
345
348
|
for (const deployId of fs.readFileSync('./engine-private/deploy/dd.router', 'utf8').split(','))
|
|
346
349
|
shellExec(`node bin/deploy update-default-conf ${deployId.trim()}`);
|
|
@@ -599,26 +602,34 @@ class UnderpostRun {
|
|
|
599
602
|
'dd-container': async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
|
|
600
603
|
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
601
604
|
const baseClusterCommand = options.dev ? ' --dev' : '';
|
|
602
|
-
const currentImage =
|
|
603
|
-
|
|
604
|
-
false
|
|
605
|
-
|
|
606
|
-
|
|
605
|
+
const currentImage = options.imageName
|
|
606
|
+
? options.imageName
|
|
607
|
+
: UnderpostDeploy.API.getCurrentLoadedImages(options.nodeName ? options.nodeName : 'kind-worker', false).find(
|
|
608
|
+
(o) => o.IMAGE.match('underpost'),
|
|
609
|
+
);
|
|
610
|
+
const podName = options.podName || `underpost-dev-container`;
|
|
611
|
+
const volumeHostPath = options.claimName || '/home/dd';
|
|
612
|
+
const claimName = options.claimName || `pvc-dd`;
|
|
613
|
+
|
|
607
614
|
if (!options.nodeName) {
|
|
608
|
-
shellExec(`docker exec -i kind-worker bash -c "rm -rf
|
|
609
|
-
shellExec(`docker exec -i kind-worker bash -c "mkdir -p
|
|
610
|
-
shellExec(`docker cp /
|
|
611
|
-
shellExec(
|
|
615
|
+
shellExec(`docker exec -i kind-worker bash -c "rm -rf ${volumeHostPath}"`);
|
|
616
|
+
shellExec(`docker exec -i kind-worker bash -c "mkdir -p ${volumeHostPath}"`);
|
|
617
|
+
shellExec(`docker cp ${volumeHostPath}/engine kind-worker:${volumeHostPath}/engine`);
|
|
618
|
+
shellExec(
|
|
619
|
+
`docker exec -i kind-worker bash -c "chown -R 1000:1000 ${volumeHostPath} || true; chmod -R 755 ${volumeHostPath}"`,
|
|
620
|
+
);
|
|
612
621
|
} else {
|
|
613
622
|
shellExec(`kubectl apply -f ${options.underpostRoot}/manifests/pv-pvc-dd.yaml`);
|
|
614
623
|
}
|
|
624
|
+
|
|
615
625
|
if (!currentImage)
|
|
616
626
|
shellExec(
|
|
617
627
|
`${baseCommand} dockerfile-pull-base-images${baseClusterCommand} ${options.dev ? '--kind-load' : '--kubeadm-load'}`,
|
|
618
628
|
);
|
|
619
629
|
// shellExec(`kubectl delete pod ${podName} --ignore-not-found`);
|
|
620
|
-
|
|
621
|
-
|
|
630
|
+
|
|
631
|
+
const payload = {
|
|
632
|
+
...options,
|
|
622
633
|
podName,
|
|
623
634
|
imageName: currentImage
|
|
624
635
|
? currentImage.image
|
|
@@ -627,15 +638,30 @@ class UnderpostRun {
|
|
|
627
638
|
? `${currentImage.IMAGE}:${currentImage.TAG}`
|
|
628
639
|
: `localhost/rockylinux9-underpost:${Underpost.version}`
|
|
629
640
|
: `localhost/rockylinux9-underpost:${Underpost.version}`,
|
|
630
|
-
volumeMountPath:
|
|
631
|
-
...(options.dev ? { volumeHostPath
|
|
641
|
+
volumeMountPath: volumeHostPath,
|
|
642
|
+
...(options.dev ? { volumeHostPath } : { claimName }),
|
|
632
643
|
on: {
|
|
633
644
|
init: async () => {
|
|
634
645
|
// openTerminal(`kubectl logs -f ${podName}`);
|
|
635
646
|
},
|
|
636
647
|
},
|
|
637
648
|
args: [daemonProcess(path ? path : `cd /home/dd/engine && npm install && npm run test`)],
|
|
638
|
-
}
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
await UnderpostRun.RUNNERS['deploy-job'](path, payload);
|
|
652
|
+
},
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* @method ip-info
|
|
656
|
+
* @description Executes the `ip-info.sh` script to display IP-related information for the specified path.
|
|
657
|
+
* @param {string} path - The input value, identifier, or path for the operation (used as an argument to the script).
|
|
658
|
+
* @param {Object} options - The default underpost runner options for customizing workflow
|
|
659
|
+
* @memberof UnderpostRun
|
|
660
|
+
*/
|
|
661
|
+
'ip-info': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
662
|
+
const { underpostRoot } = options;
|
|
663
|
+
shellExec(`chmod +x ${underpostRoot}/scripts/ip-info.sh`);
|
|
664
|
+
shellExec(`${underpostRoot}/scripts/ip-info.sh ${path}`);
|
|
639
665
|
},
|
|
640
666
|
|
|
641
667
|
/**
|
|
@@ -1118,7 +1144,11 @@ class UnderpostRun {
|
|
|
1118
1144
|
shellExec(`${baseCommand} env ${deployId} ${env}`);
|
|
1119
1145
|
for (const host of Object.keys(confServer))
|
|
1120
1146
|
if (_path in confServer[host]) shellExec(`node bin/deploy build-single-replica ${deployId} ${host} ${_path}`);
|
|
1121
|
-
const node = options.
|
|
1147
|
+
const node = options.nodeName
|
|
1148
|
+
? options.nodeName
|
|
1149
|
+
: options.dev || !isDeployRunnerContext(path, options)
|
|
1150
|
+
? 'kind-control-plane'
|
|
1151
|
+
: os.hostname();
|
|
1122
1152
|
// deployId, replicas, versions, image, node
|
|
1123
1153
|
let defaultPath = [deployId, 1, ``, ``, node];
|
|
1124
1154
|
shellExec(`${baseCommand} run${options.dev === true ? ' --dev' : ''} --build sync ${defaultPath}`);
|
|
@@ -1193,6 +1223,7 @@ class UnderpostRun {
|
|
|
1193
1223
|
const restartPolicy = options.restartPolicy || 'Never';
|
|
1194
1224
|
const kind = options.kind || 'Pod';
|
|
1195
1225
|
const imagePullPolicy = options.imagePullPolicy || 'IfNotPresent';
|
|
1226
|
+
const hostNetwork = options.hostNetwork ? options.hostNetwork : '';
|
|
1196
1227
|
const apiVersion = options.apiVersion || 'v1';
|
|
1197
1228
|
if (options.volumeType === 'dev') options.volumeType = 'FileOrCreate';
|
|
1198
1229
|
const volumeType =
|
|
@@ -1213,6 +1244,7 @@ metadata:
|
|
|
1213
1244
|
spec:
|
|
1214
1245
|
restartPolicy: ${restartPolicy}
|
|
1215
1246
|
${runtimeClassName ? ` runtimeClassName: ${runtimeClassName}` : ''}
|
|
1247
|
+
${hostNetwork ? ` hostNetwork: ${hostNetwork}` : ''}
|
|
1216
1248
|
containers:
|
|
1217
1249
|
- name: ${containerName}
|
|
1218
1250
|
image: ${imageName}
|
package/src/index.js
CHANGED
package/src/server/start.js
CHANGED
|
@@ -133,7 +133,7 @@ class UnderpostStartUp {
|
|
|
133
133
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
134
134
|
shellExec(`cd ${buildBasePath} && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}`);
|
|
135
135
|
shellExec(`mkdir -p ${buildBasePath}/engine`);
|
|
136
|
-
shellExec(`cd ${buildBasePath} && sudo cp -a ./${repoName}
|
|
136
|
+
shellExec(`cd ${buildBasePath} && sudo cp -a ./${repoName}/. ./engine`);
|
|
137
137
|
shellExec(`cd ${buildBasePath} && sudo rm -rf ./${repoName}`);
|
|
138
138
|
shellExec(`cd ${buildBasePath}/engine && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}-private`);
|
|
139
139
|
shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);
|