f-86: deploy: unité two-hostsvc, release et provision du lab #86
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
2e24a5da0a
commit
43f58b0852
7 changed files with 58 additions and 16 deletions
|
|
@ -4,25 +4,26 @@ E2E_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||
REPO_DIR="$(cd "${E2E_DIR}/../.." && pwd)"
|
||||
BIN_DIR="${BIN_DIR:-${E2E_DIR}/topologies/bin}"
|
||||
SCRIPTS_DIR="${SCRIPTS_DIR:-${E2E_DIR}/topologies/scripts}"
|
||||
BINARIES="agent dhcp metadata"
|
||||
BINARIES="agent dhcp metadata two-hostsvc"
|
||||
UNITS="two-hostsvc.service"
|
||||
SCRIPTS="bootstrap_kvm.sh"
|
||||
|
||||
usage () {
|
||||
cat >&2 <<USAGE
|
||||
usage: ${0##*/} [--clean]
|
||||
|
||||
sans option : compile ${BINARIES} pour linux/amd64 depuis l'arbre courant dans ${BIN_DIR},
|
||||
copie ${SCRIPTS} dans ${SCRIPTS_DIR} ; le prochain lab les installe par-dessus
|
||||
la release épinglée dans topologies/provision/hypervisor.sh
|
||||
sans option : compile ${BINARIES} pour linux/amd64 depuis l'arbre courant dans ${BIN_DIR}
|
||||
et y copie ${UNITS}, copie ${SCRIPTS} dans ${SCRIPTS_DIR} ; le prochain lab
|
||||
les installe par-dessus la release épinglée dans topologies/provision/hypervisor.sh
|
||||
--clean : vide ${BIN_DIR} et ${SCRIPTS_DIR} ; le prochain lab teste la release seule
|
||||
USAGE
|
||||
exit 2
|
||||
}
|
||||
|
||||
clean () {
|
||||
local binary script
|
||||
for binary in ${BINARIES}; do
|
||||
rm -f "${BIN_DIR}/${binary}" || return 1
|
||||
local file script
|
||||
for file in ${BINARIES} ${UNITS}; do
|
||||
rm -f "${BIN_DIR}/${file}" || return 1
|
||||
done
|
||||
for script in ${SCRIPTS}; do
|
||||
rm -f "${SCRIPTS_DIR}/${script}" || return 1
|
||||
|
|
@ -30,16 +31,19 @@ clean () {
|
|||
}
|
||||
|
||||
build () {
|
||||
local binary script
|
||||
local binary unit script
|
||||
for binary in ${BINARIES}; do
|
||||
echo "== ${binary}" >&2
|
||||
(cd "${REPO_DIR}" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${BIN_DIR}/${binary}" "./cmd/${binary}") || return 1
|
||||
done
|
||||
for unit in ${UNITS}; do
|
||||
cp "${REPO_DIR}/systemd/${unit}" "${BIN_DIR}/${unit}" || return 1
|
||||
done
|
||||
for script in ${SCRIPTS}; do
|
||||
echo "== ${script}" >&2
|
||||
cp "${REPO_DIR}/scripts/${script}" "${SCRIPTS_DIR}/${script}" || return 1
|
||||
done
|
||||
(cd "${BIN_DIR}" && sha256sum ${BINARIES} 2>/dev/null || shasum -a 256 ${BINARIES})
|
||||
(cd "${BIN_DIR}" && sha256sum ${BINARIES} ${UNITS} 2>/dev/null || shasum -a 256 ${BINARIES} ${UNITS})
|
||||
}
|
||||
|
||||
main () {
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ nodes:
|
|||
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
||||
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
services: [two-hostsvc.service, agent.service] }
|
||||
hv2:
|
||||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
||||
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
services: [two-hostsvc.service, agent.service] }
|
||||
|
|
|
|||
|
|
@ -36,18 +36,18 @@ nodes:
|
|||
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
||||
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
services: [two-hostsvc.service, agent.service] }
|
||||
hv2:
|
||||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
||||
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
services: [two-hostsvc.service, agent.service] }
|
||||
hv3:
|
||||
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
|
||||
addresses: { underlay: 192.168.14.13 }, frr: frr/hv3.conf, provision: provision/hypervisor.sh,
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
services: [two-hostsvc.service, agent.service] }
|
||||
bd1:
|
||||
{ role: host, image: debian12, cpus: 1, memory: 1024, segments: [underlay],
|
||||
addresses: { underlay: 192.168.14.21 }, frr: frr/bd1.conf, provision: provision/border.sh }
|
||||
|
|
|
|||
|
|
@ -38,7 +38,17 @@ fi
|
|||
for binary in "${LAB_FILES}"/bin/*; do
|
||||
[ -f "${binary}" ] || continue
|
||||
name=$(basename "${binary}")
|
||||
case "${name}" in *.service) continue ;; esac
|
||||
install -D -m 0755 "${binary}" "/opt/two/local/bin/${name}"
|
||||
ln -sfn "/opt/two/local/bin/${name}" "/opt/two/bin/${name}"
|
||||
echo "lab: ${name} compilé en local remplace celui de la release ${RELEASE}"
|
||||
done
|
||||
for unit in "${LAB_FILES}"/bin/*.service; do
|
||||
[ -f "${unit}" ] || continue
|
||||
name=$(basename "${unit}")
|
||||
install -m 0644 "${unit}" "/etc/systemd/system/${name}"
|
||||
systemctl daemon-reload
|
||||
systemctl enable "${name}"
|
||||
systemctl restart "${name}"
|
||||
echo "lab: unité ${name} de l'arbre local installée par-dessus la release ${RELEASE}"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue