underpost 2.8.812 → 2.8.814
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 +1 -1
- package/bin/deploy.js +51 -43
- package/cli.md +1 -1
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/src/cli/cluster.js +16 -12
- package/src/index.js +1 -1
package/README.md
CHANGED
package/bin/deploy.js
CHANGED
|
@@ -59,15 +59,13 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
|
|
|
59
59
|
const [consumer_key, consumer_token, secret] = MAAS_API_TOKEN.split(`\n`)[0].split(':');
|
|
60
60
|
const chronyConfPath = `/etc/chrony/chrony.conf`;
|
|
61
61
|
const timezone = 'America/New_York';
|
|
62
|
-
const timeZoneSteps = [
|
|
63
|
-
`apt-get update`,
|
|
64
62
|
|
|
63
|
+
const timeZoneSteps = [
|
|
65
64
|
`export DEBIAN_FRONTEND=noninteractive`,
|
|
66
65
|
|
|
67
66
|
`ln -fs /usr/share/zoneinfo/${timezone} /etc/localtime`,
|
|
68
67
|
|
|
69
|
-
`
|
|
70
|
-
`dpkg-reconfigure --frontend noninteractive tzdata`,
|
|
68
|
+
`sudo dpkg-reconfigure --frontend noninteractive tzdata`,
|
|
71
69
|
];
|
|
72
70
|
const keyboardSteps = [
|
|
73
71
|
`sudo locale-gen en_US.UTF-8`,
|
|
@@ -78,46 +76,22 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
|
|
|
78
76
|
];
|
|
79
77
|
// # - ${JSON.stringify([...timeZoneSteps, ...chronySetUp(chronyConfPath)])}
|
|
80
78
|
const installSteps = [
|
|
81
|
-
`apt
|
|
82
|
-
|
|
83
|
-
`ln -sf /lib/systemd/systemd /sbin/init`,
|
|
84
|
-
|
|
85
|
-
`echo 'deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
79
|
+
`cat <<EOF | tee /etc/apt/sources.list
|
|
80
|
+
deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
86
81
|
deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
|
|
87
82
|
deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
|
|
88
|
-
|
|
89
|
-
# Uncomment the following lines if you also need source packages (for building from source)
|
|
90
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
91
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
|
|
92
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
|
|
93
|
-
' > /etc/apt/sources.list`,
|
|
94
|
-
`apt update`,
|
|
95
|
-
`apt -y full-upgrade`,
|
|
96
|
-
// `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
|
|
97
|
-
|
|
98
|
-
`systemctl enable ssh`,
|
|
83
|
+
EOF`,
|
|
99
84
|
|
|
100
85
|
`apt update -qq`,
|
|
86
|
+
`apt -y full-upgrade`,
|
|
101
87
|
`apt install -y xinput x11-xkb-utils usbutils`,
|
|
88
|
+
// `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
|
|
89
|
+
`apt install -y cloud-init systemd-sysv openssh-server sudo locales udev util-linux systemd-sysv iproute2 netplan.io ca-certificates curl wget chrony`,
|
|
90
|
+
`ln -sf /lib/systemd/systemd /sbin/init`,
|
|
102
91
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
...timeZoneSteps,
|
|
107
|
-
...chronySetUp(chronyConfPath),
|
|
108
|
-
...keyboardSteps,
|
|
109
|
-
|
|
110
|
-
// Create root user
|
|
111
|
-
`useradd -m -s /bin/bash -G sudo root`,
|
|
112
|
-
`echo 'root:root' | chpasswd`,
|
|
113
|
-
`mkdir -p /home/root/.ssh`,
|
|
114
|
-
`echo '${fs.readFileSync(
|
|
115
|
-
`/home/dd/engine/engine-private/deploy/id_rsa.pub`,
|
|
116
|
-
'utf8',
|
|
117
|
-
)}' > /home/root/.ssh/authorized_keys`,
|
|
118
|
-
`chown -R root /home/root/.ssh`,
|
|
119
|
-
`chmod 700 /home/root/.ssh`,
|
|
120
|
-
`chmod 600 /home/root/.ssh/authorized_keys`,
|
|
92
|
+
`apt-get update`,
|
|
93
|
+
`DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils`,
|
|
94
|
+
`DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata kmod keyboard-configuration console-setup`,
|
|
121
95
|
];
|
|
122
96
|
|
|
123
97
|
let steps = [
|
|
@@ -191,12 +165,12 @@ network:
|
|
|
191
165
|
version: 2
|
|
192
166
|
ethernets:
|
|
193
167
|
${process.env.RPI4_INTERFACE_NAME}:
|
|
194
|
-
dhcp4:
|
|
168
|
+
dhcp4: true
|
|
195
169
|
addresses:
|
|
196
170
|
- ${ipaddr}/24
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
171
|
+
# routes:
|
|
172
|
+
# - to: default
|
|
173
|
+
# via: ${gatewayip}
|
|
200
174
|
|
|
201
175
|
# chpasswd:
|
|
202
176
|
# expire: false
|
|
@@ -214,7 +188,6 @@ bootcmd:
|
|
|
214
188
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
215
189
|
- echo "Init bootcmd"
|
|
216
190
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
217
|
-
- ntpdate -u ${IP_ADDRESS} || ntpdate -u ${process.env.MAAS_NTP_SERVER}
|
|
218
191
|
runcmd:
|
|
219
192
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
220
193
|
- echo "Init runcmd"
|
|
@@ -264,6 +237,41 @@ echo 'nameserver 8.8.8.8' > /run/systemd/resolve/stub-resolv.conf
|
|
|
264
237
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
|
|
265
238
|
'utf8',
|
|
266
239
|
);
|
|
240
|
+
|
|
241
|
+
runSteps([
|
|
242
|
+
// `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
|
|
243
|
+
// `date`,
|
|
244
|
+
...timeZoneSteps,
|
|
245
|
+
...chronySetUp(chronyConfPath),
|
|
246
|
+
...keyboardSteps,
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
runSteps([
|
|
250
|
+
`useradd -m -s /bin/bash -G sudo root`,
|
|
251
|
+
`echo 'root:root' | chpasswd`,
|
|
252
|
+
`mkdir -p /home/root/.ssh`,
|
|
253
|
+
`echo '${fs.readFileSync(
|
|
254
|
+
`/home/dd/engine/engine-private/deploy/id_rsa.pub`,
|
|
255
|
+
'utf8',
|
|
256
|
+
)}' > /home/root/.ssh/authorized_keys`,
|
|
257
|
+
`chown -R root /home/root/.ssh`,
|
|
258
|
+
`chmod 700 /home/root/.ssh`,
|
|
259
|
+
`chmod 600 /home/root/.ssh/authorized_keys`,
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
logger.info('Check virtual root user config');
|
|
264
|
+
{
|
|
265
|
+
const cmd = `sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF_OUTER'
|
|
266
|
+
echo -e "\n=== Current date/time ==="
|
|
267
|
+
date '+%Y-%m-%d %H:%M:%S'
|
|
268
|
+
echo -e "\n=== Keyboard layout ==="
|
|
269
|
+
cat /etc/default/keyboard
|
|
270
|
+
echo -e "\n=== Registered users ==="
|
|
271
|
+
cut -d: -f1 /etc/passwd
|
|
272
|
+
EOF_OUTER`;
|
|
273
|
+
|
|
274
|
+
shellExec(cmd);
|
|
267
275
|
}
|
|
268
276
|
};
|
|
269
277
|
|
package/cli.md
CHANGED
package/docker-compose.yml
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-template-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.814
|
|
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-template-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.814
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
package/package.json
CHANGED
package/src/cli/cluster.js
CHANGED
|
@@ -508,20 +508,24 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`);
|
|
|
508
508
|
logger.info('Phase 1/6: Cleaning up Kubernetes resources (PVCs, PVs) while API server is accessible...');
|
|
509
509
|
|
|
510
510
|
// Get all Persistent Volumes and identify their host paths for data deletion.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
511
|
+
try {
|
|
512
|
+
const pvListJson = shellExec(`kubectl get pv -o json || echo '{"items":[]}'`, { stdout: true, silent: true });
|
|
513
|
+
const pvList = JSON.parse(pvListJson);
|
|
514
|
+
|
|
515
|
+
if (pvList.items && pvList.items.length > 0) {
|
|
516
|
+
for (const pv of pvList.items) {
|
|
517
|
+
// Check if the PV uses hostPath and delete its contents
|
|
518
|
+
if (pv.spec.hostPath && pv.spec.hostPath.path) {
|
|
519
|
+
const hostPath = pv.spec.hostPath.path;
|
|
520
|
+
logger.info(`Removing data from host path for PV '${pv.metadata.name}': ${hostPath}`);
|
|
521
|
+
shellExec(`sudo rm -rf ${hostPath}/* || true`);
|
|
522
|
+
}
|
|
521
523
|
}
|
|
524
|
+
} else {
|
|
525
|
+
logger.info('No Persistent Volumes found with hostPath to clean up.');
|
|
522
526
|
}
|
|
523
|
-
}
|
|
524
|
-
logger.
|
|
527
|
+
} catch (error) {
|
|
528
|
+
logger.error('Failed to clean up Persistent Volumes:', error);
|
|
525
529
|
}
|
|
526
530
|
|
|
527
531
|
// Phase 2: Stop Kubelet/K3s agent and remove CNI configuration
|