f-87: deploy: vxlan-public sur br-public, --public_vni (1), lab au VNI 1 #87
bootstrap_kvm.sh crée vxlan-public (VTEP = IPv4 du bridge principal, nolearning) esclave du bridge public, recréé si le VNI ou le VTEP change. Lab : bordures au VNI 1 (MAC 02:01:00:00:00:01) ; build.sh copie bootstrap_kvm.sh, que hypervisor.sh appelle après la release 0.2.0. Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
5061e773df
commit
7535e068b9
10 changed files with 90 additions and 27 deletions
|
|
@ -3,33 +3,42 @@
|
|||
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"
|
||||
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} ;
|
||||
le prochain lab les installe par-dessus la release épinglée dans
|
||||
topologies/provision/hypervisor.sh
|
||||
--clean : vide ${BIN_DIR} ; le prochain lab teste la release seule
|
||||
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
|
||||
--clean : vide ${BIN_DIR} et ${SCRIPTS_DIR} ; le prochain lab teste la release seule
|
||||
USAGE
|
||||
exit 2
|
||||
}
|
||||
|
||||
clean () {
|
||||
local binary
|
||||
local binary script
|
||||
for binary in ${BINARIES}; do
|
||||
rm -f "${BIN_DIR}/${binary}" || return 1
|
||||
done
|
||||
for script in ${SCRIPTS}; do
|
||||
rm -f "${SCRIPTS_DIR}/${script}" || return 1
|
||||
done
|
||||
}
|
||||
|
||||
build () {
|
||||
local binary
|
||||
local binary 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 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})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ nodes:
|
|||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||
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 },
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin, scripts: scripts },
|
||||
services: [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 },
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
|
|
|
|||
|
|
@ -35,18 +35,18 @@ nodes:
|
|||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||
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 },
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin, scripts: scripts },
|
||||
services: [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 },
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [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 },
|
||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin, scripts: scripts },
|
||||
services: [agent.service] }
|
||||
bd1:
|
||||
{ role: host, image: debian12, cpus: 1, memory: 1024, segments: [underlay],
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
VNI=66001
|
||||
VNI=1
|
||||
GATEWAY=240.0.0.1/24
|
||||
GATEWAY_MAC=02:01:00:01:01:d1
|
||||
GATEWAY_MAC=02:01:00:00:00:01
|
||||
DESTINATION=240.255.0.1/32
|
||||
VTEP=$(ip -4 -o addr show dev "${LAB_UPLINK}" scope global | awk 'NR == 1 {sub("/.*", "", $4); print $4}')
|
||||
[ -n "${VTEP}" ] || { echo "border: no IPv4 on ${LAB_UPLINK}" >&2; exit 1; }
|
||||
ip link add br-public type bridge
|
||||
ip link set br-public address "${GATEWAY_MAC}"
|
||||
ip link add "vxlan-${VNI}" type vxlan id "${VNI}" local "${VTEP}" dstport 4789 nolearning
|
||||
ip link set "vxlan-${VNI}" mtu 1500 master br-public
|
||||
ip link set "vxlan-${VNI}" up
|
||||
ip link add vxlan-public type vxlan id "${VNI}" local "${VTEP}" dstport 4789 nolearning
|
||||
ip link set vxlan-public mtu 1500 master br-public
|
||||
ip link set vxlan-public up
|
||||
ip link set br-public up
|
||||
ip addr add "${GATEWAY}" dev br-public
|
||||
ip link add internet type dummy
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
RELEASE=0.2.0
|
||||
PUBLIC_VNI=1
|
||||
GIT_SERVER=https://git.g3e.fr/
|
||||
REPO=syonad/two
|
||||
n=0
|
||||
|
|
@ -29,6 +30,11 @@ done
|
|||
chmod 0755 deploy.sh bootstrap_kvm.sh
|
||||
bash ./deploy.sh --noup_script -i -u "${LAB_UPLINK}" -t "${RELEASE}"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nftables
|
||||
if [ -f "${LAB_FILES}/scripts/bootstrap_kvm.sh" ]; then
|
||||
bash -c 'FLAGS_TRUE=0; FLAGS_FALSE=1; . ./deploy.sh && . "$1" && kvm_public_segment "${FLAGS_FALSE}" "${FLAGS_TRUE}" br-000000 br-public "$2"' \
|
||||
lab "${LAB_FILES}/scripts/bootstrap_kvm.sh" "${PUBLIC_VNI}"
|
||||
echo "lab: segment public posé par le bootstrap_kvm.sh de l'arbre courant (VNI ${PUBLIC_VNI})"
|
||||
fi
|
||||
for binary in "${LAB_FILES}"/bin/*; do
|
||||
[ -f "${binary}" ] || continue
|
||||
name=$(basename "${binary}")
|
||||
|
|
|
|||
0
test/e2e/topologies/scripts/.gitkeep
Normal file
0
test/e2e/topologies/scripts/.gitkeep
Normal file
Loading…
Add table
Add a link
Reference in a new issue