underpost 2.8.783 → 2.8.784
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/cli.md +3 -1
- package/docker-compose.yml +1 -1
- package/manifests/lxd/underpost-setup.sh +28 -0
- package/package.json +1 -1
- package/src/cli/cluster.js +3 -2
- package/src/cli/index.js +2 -0
- package/src/cli/lxd.js +13 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.784
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -480,6 +480,8 @@ Options:
|
|
|
480
480
|
--create-admin-profile Create admin profile for lxd management
|
|
481
481
|
--create-vm <vm-id> Create default virtual machines
|
|
482
482
|
--init-vm <vm-id> Get init vm underpost script
|
|
483
|
+
--info-vm <vm-id> Get all info vm
|
|
484
|
+
--root-size <gb-size> Set root size vm
|
|
483
485
|
-h, --help display help for command
|
|
484
486
|
|
|
485
487
|
```
|
package/docker-compose.yml
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Expand /dev/sda2 partition and resize filesystem automatically
|
|
6
|
+
|
|
7
|
+
# Check if parted is installed
|
|
8
|
+
if ! command -v parted &>/dev/null; then
|
|
9
|
+
echo "parted not found, installing..."
|
|
10
|
+
dnf install -y parted
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Get start sector of /dev/sda2
|
|
14
|
+
START_SECTOR=$(parted /dev/sda -ms unit s print | awk -F: '/^2:/{print $2}' | sed 's/s//')
|
|
15
|
+
|
|
16
|
+
# Resize the partition
|
|
17
|
+
parted /dev/sda ---pretend-input-tty <<EOF
|
|
18
|
+
unit s
|
|
19
|
+
resizepart 2 100%
|
|
20
|
+
Yes
|
|
21
|
+
quit
|
|
22
|
+
EOF
|
|
23
|
+
|
|
24
|
+
# Resize the filesystem
|
|
25
|
+
resize2fs /dev/sda2
|
|
26
|
+
|
|
27
|
+
echo "Disk and filesystem resized successfully."
|
|
28
|
+
|
|
1
29
|
mkdir -p /home/dd
|
|
2
30
|
sudo dnf install -y tar
|
|
3
31
|
sudo dnf install -y bzip2
|
package/package.json
CHANGED
package/src/cli/cluster.js
CHANGED
|
@@ -113,8 +113,9 @@ class UnderpostCluster {
|
|
|
113
113
|
shellExec(
|
|
114
114
|
`sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --control-plane-endpoint="${os.hostname()}:6443"`,
|
|
115
115
|
);
|
|
116
|
-
shellExec(`
|
|
117
|
-
shellExec(`sudo
|
|
116
|
+
shellExec(`mkdir -p ~/.kube`);
|
|
117
|
+
shellExec(`sudo -E cp -i /etc/kubernetes/admin.conf ~/.kube/config`);
|
|
118
|
+
shellExec(`sudo -E chown $(id -u):$(id -g) ~/.kube/config`);
|
|
118
119
|
// https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart
|
|
119
120
|
shellExec(
|
|
120
121
|
`sudo kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.3/manifests/tigera-operator.yaml`,
|
package/src/cli/index.js
CHANGED
|
@@ -277,6 +277,8 @@ program
|
|
|
277
277
|
.option('--create-admin-profile', 'Create admin profile for lxd management')
|
|
278
278
|
.option('--create-vm <vm-id>', 'Create default virtual machines')
|
|
279
279
|
.option('--init-vm <vm-id>', 'Get init vm underpost script')
|
|
280
|
+
.option('--info-vm <vm-id>', 'Get all info vm')
|
|
281
|
+
.option('--root-size <gb-size>', 'Set root size vm')
|
|
280
282
|
.description('Lxd management')
|
|
281
283
|
.action(UnderpostLxd.API.callback);
|
|
282
284
|
|
package/src/cli/lxd.js
CHANGED
|
@@ -12,6 +12,8 @@ class UnderpostLxd {
|
|
|
12
12
|
createVirtualNetwork: false,
|
|
13
13
|
initVm: false,
|
|
14
14
|
createVm: '',
|
|
15
|
+
infoVm: '',
|
|
16
|
+
rootSize: '',
|
|
15
17
|
},
|
|
16
18
|
) {
|
|
17
19
|
const npmRoot = getNpmRootPath();
|
|
@@ -41,12 +43,22 @@ ipv6.address=none`);
|
|
|
41
43
|
}
|
|
42
44
|
if (options.createVm && typeof options.createVm === 'string') {
|
|
43
45
|
pbcopy(
|
|
44
|
-
`lxc launch images:rockylinux/9 ${
|
|
46
|
+
`lxc launch images:rockylinux/9 ${
|
|
47
|
+
options.createVm
|
|
48
|
+
} --vm --target lxd-node1 -c limits.cpu=2 -c limits.memory=4GB --profile admin-profile -d root,size=${
|
|
49
|
+
options.rootSize && typeof options.rootSize === 'string' ? options.rootSize + 'GiB' : '32GiB'
|
|
50
|
+
}`,
|
|
45
51
|
);
|
|
46
52
|
}
|
|
47
53
|
if (options.initVm && typeof options.initVm === 'string') {
|
|
48
54
|
pbcopy(`cat ${underpostRoot}/manifests/lxd/underpost-setup.sh | lxc exec ${options.initVm} -- bash`);
|
|
49
55
|
}
|
|
56
|
+
if (options.infoVm && typeof options.infoVm === 'string') {
|
|
57
|
+
shellExec(`lxc config show ${options.infoVm}`);
|
|
58
|
+
shellExec(`lxc info --show-log ${options.infoVm}`);
|
|
59
|
+
shellExec(`lxc info ${options.infoVm}`);
|
|
60
|
+
shellExec(`lxc list ${options.infoVm}`);
|
|
61
|
+
}
|
|
50
62
|
},
|
|
51
63
|
};
|
|
52
64
|
}
|