Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 network attachements - no dual stack #689

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
66 changes: 65 additions & 1 deletion scripts/gen-netatt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF_CAT
apiVersion: k8s.cni.cncf.io/v1
Expand All @@ -62,9 +78,21 @@ spec:
"master": "${BRIDGE_NAME}",
"ipam": {
"type": "whereabouts",
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/ctlplane.yaml <<EOF_CAT
"range": "${CTLPLANE_IP_ADDRESS_PREFIX}.0/24",
"range_start": "${CTLPLANE_IP_ADDRESS_PREFIX}.30",
"range_end": "${CTLPLANE_IP_ADDRESS_PREFIX}.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/ctlplane.yaml <<EOF_CAT
"range": "${CTLPLANE_IPV6_ADDRESS_PREFIX}0/64",
"range_start": "${CTLPLANE_IPV6_ADDRESS_PREFIX}30",
"range_end": "${CTLPLANE_IPV6_ADDRESS_PREFIX}70"
EOF_CAT
fi
cat >> ${DEPLOY_DIR}/ctlplane.yaml <<EOF_CAT
}
}
EOF_CAT
Expand All @@ -86,9 +114,21 @@ spec:
"master": "${INTERFACE}.${VLAN_START}",
"ipam": {
"type": "whereabouts",
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/internalapi.yaml <<EOF_CAT
"range": "172.17.0.0/24",
"range_start": "172.17.0.30",
"range_end": "172.17.0.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/internalapi.yaml <<EOF_CAT
"range": "fd00:bbbb::/64",
"range_start": "fd00:bbbb::30",
"range_end": "fd00:bbbb::70"
EOF_CAT
fi
cat >> ${DEPLOY_DIR}/internalapi.yaml <<EOF_CAT
}
}
EOF_CAT
Expand All @@ -110,9 +150,21 @@ spec:
"master": "${INTERFACE}.$((${VLAN_START}+${VLAN_STEP}))",
"ipam": {
"type": "whereabouts",
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/storage.yaml <<EOF_CAT
"range": "172.18.0.0/24",
"range_start": "172.18.0.30",
"range_end": "172.18.0.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/storage.yaml <<EOF_CAT
"range": "fd00:cccc::/64",
"range_start": "fd00:cccc::30",
"range_end": "fd00:cccc::70"
EOF_CAT
fi
cat >> ${DEPLOY_DIR}/storage.yaml <<EOF_CAT
}
}
EOF_CAT
Expand All @@ -134,9 +186,21 @@ spec:
"master": "${INTERFACE}.$((${VLAN_START}+$((${VLAN_STEP}*2))))",
"ipam": {
"type": "whereabouts",
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/tenant.yaml <<EOF_CAT
"range": "172.19.0.0/24",
"range_start": "172.19.0.30",
"range_end": "172.19.0.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/tenant.yaml <<EOF_CAT
"range": "fd00:dddd::/64",
"range_start": "fd00:dddd::30",
"range_end": "fd00:dddd::70"
EOF_CAT
fi
cat >> ${DEPLOY_DIR}/tenant.yaml <<EOF_CAT
}
}
EOF_CAT
Expand Down