From b7474221c2b3266b4902db6f06e43bc3dd04b6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Sat, 13 Jan 2024 17:31:52 +0100 Subject: [PATCH] IPv6 network attachements - no dual stack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for IPv6 in network attachement definitions. This does not enable dual-stack support. NOTE: Dual stack should be possible by utilizing `ipRanges` in the whearabouts ipam config, but attempts to use `ipRanges` fails with an error indicating the wherabouts version in OCP does not have this feature. Signed-off-by: Harald Jensås --- Makefile | 12 ++++++++ scripts/gen-netatt.sh | 66 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a7c3702..4aa203d 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,8 @@ NETWORK_ISOLATION_IPV6 ?= false NETWORK_MTU ?= 1500 NETWORK_VLAN_START ?= 20 NETWORK_VLAN_STEP ?= 1 +NETWORK_ISOLATION_IPV4_ADDRESS ?= 172.16.1.1/24 +NETWORK_ISOLATION_IPV6_ADDRESS ?= fd00:aaaa::1/64 ifeq ($(NETWORK_ISOLATION_USE_DEFAULT_NETWORK), true) METALLB_POOL ?=192.168.122.80-192.168.122.90 @@ -2010,6 +2012,16 @@ ifeq ($(NETWORK_BGP), true) netattach: export INTERFACE_BGP_1=${NNCP_BGP_1_INTERFACE} netattach: export INTERFACE_BGP_2=${NNCP_BGP_2_INTERFACE} endif +ifeq ($(NETWORK_ISOLATION_IPV4), true) +netattach: export IPV4_ENABLED=true +netattach: export CTLPLANE_IP_ADDRESS_PREFIX=${NNCP_CTLPLANE_IP_ADDRESS_PREFIX} +netattach: export CTLPLANE_IP_ADDRESS_SUFFIX=${NNCP_CTLPLANE_IP_ADDRESS_SUFFIX} +endif +ifeq ($(NETWORK_ISOLATION_IPV6), true) +netattach: export IPV6_ENABLED=true +netattach: export CTLPLANE_IPV6_ADDRESS_PREFIX=${NNCP_CTLPLANE_IPV6_ADDRESS_PREFIX} +netattach: export CTLPLANE_IPV6_ADDRESS_SUFFIX=${NNCP_CTLPLANE_IPV6_ADDRESS_SUFFIX} +endif netattach: export VLAN_START=${NETWORK_VLAN_START} netattach: export VLAN_STEP=${NETWORK_VLAN_STEP} netattach: export CTLPLANE_IP_ADDRESS_PREFIX=${NNCP_CTLPLANE_IP_ADDRESS_PREFIX} diff --git a/scripts/gen-netatt.sh b/scripts/gen-netatt.sh index 2c54cee..66df9df 100644 --- a/scripts/gen-netatt.sh +++ b/scripts/gen-netatt.sh @@ -39,11 +39,27 @@ if [ -z "${VLAN_STEP}" ]; then echo "Please set VLAN_STEP"; exit 1 fi +if [ -z "$IPV4_ENABLED" ] && [ -z "$IPV6_ENABLED" ]; then + echo "Please enable either IPv4 or IPv6 by setting IPV4_ENABLED or IPV6_ENABLED"; exit 1 +fi + +if [ -n "$IPV4_ENABLED" ] && [ -n "$IPV6_ENABLED" ]; then + echo "Dual stack not supported, cannot enable both IPv4 and IPv6"; exit 1 +fi + + echo DEPLOY_DIR ${DEPLOY_DIR} echo INTERFACE ${INTERFACE} echo VLAN_START ${VLAN_START} echo VLAN_STEP ${VLAN_STEP} -echo CTLPLANE_IP_ADDRESS_PREFIX ${CTLPLANE_IP_ADDRESS_PREFIX} +if [ -n "$IPV4_ENABLED" ]; then + echo CTLPLANE_IP_ADDRESS_PREFIX ${CTLPLANE_IP_ADDRESS_PREFIX} + echo CTLPLANE_IP_ADDRESS_SUFFIX ${CTLPLANE_IP_ADDRESS_SUFFIX} +fi +if [ -n "$IPV6_ENABLED" ]; then + echo CTLPLANE_IPV6_ADDRESS_PREFIX ${CTLPLANE_IPV6_ADDRESS_PREFIX} + echo CTLPLANE_IPV6_ADDRESS_SUFFIX ${CTLPLANE_IPV6_ADDRESS_SUFFIX} +fi cat > ${DEPLOY_DIR}/ctlplane.yaml <> ${DEPLOY_DIR}/ctlplane.yaml <> ${DEPLOY_DIR}/ctlplane.yaml <> ${DEPLOY_DIR}/ctlplane.yaml <> ${DEPLOY_DIR}/internalapi.yaml <> ${DEPLOY_DIR}/internalapi.yaml <> ${DEPLOY_DIR}/internalapi.yaml <> ${DEPLOY_DIR}/storage.yaml <> ${DEPLOY_DIR}/storage.yaml <> ${DEPLOY_DIR}/storage.yaml <> ${DEPLOY_DIR}/tenant.yaml <> ${DEPLOY_DIR}/tenant.yaml <> ${DEPLOY_DIR}/tenant.yaml <