Skip to content

Commit

Permalink
Adding support for adoption scenario 1
Browse files Browse the repository at this point in the history
Dataplane adoption docs supports doing the adoption
while wallaby environment uses different subnets than
next generation. This commit enables Makefiles in order to
prepare the environment with different subnets between
environments.

Related: OSPRH-5881
  • Loading branch information
averdagu committed May 15, 2024
1 parent 131b7f1 commit d870686
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 99 deletions.
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ CLEANUP_DIR_CMD ?= rm -Rf
# be also cloned from OPENSTACK_REPO/OPENSTACK_BRANCH.
CHECKOUT_FROM_OPENSTACK_REF ?= false

ADOPTED_SCENARIO ?=false

# network general configuration
ifeq ($(ADOPTED_SCENARIO), false)
NETWORK_INTERNALAPI_ADDRESS_PREFIX ?= 172.17.0
NETWORK_STORAGE_ADDRESS_PREFIX ?= 172.18.0
NETWORK_TENANT_ADDRESS_PREFIX ?= 172.19.0
NETWORK_STORAGEMGMT_ADDRESS_PREFIX ?= 172.20.0
NETWORK_DESIGNATE_ADDRESS_PREFIX ?= 172.28.0
else
NETWORK_INTERNALAPI_ADDRESS_PREFIX ?= 172.17.1
NETWORK_STORAGE_ADDRESS_PREFIX ?= 172.18.1
NETWORK_TENANT_ADDRESS_PREFIX ?= 172.19.1
NETWORK_STORAGEMGMT_ADDRESS_PREFIX ?= 172.20.1
NETWORK_DESIGNATE_ADDRESS_PREFIX ?= 172.28.1
INTERNALAPI_HOST_ROUTES ?= 172.17.0.0/24
STORAGE_HOST_ROUTES ?= 172.18.0.0/24
TENANT_HOST_ROUTES ?= 172.19.0.0/24
STORAGEMGMT_HOST_ROUTES ?= 172.20.0.0/24
endif
# network isolation
NETWORK_ISOLATION ?= true
NETWORK_ISOLATION_USE_DEFAULT_NETWORK ?= true
Expand Down Expand Up @@ -2211,6 +2231,16 @@ endif
.PHONY: nncp
nncp: export INTERFACE=${NNCP_INTERFACE}
nncp: export BRIDGE_NAME=${NNCP_BRIDGE}
nncp: export ADOPTION_CASE_A=${ADOPTED_SCENARIO}
nncp: export INTERNALAPI_PREFIX=${NETWORK_INTERNALAPI_ADDRESS_PREFIX}
nncp: export NNCP_INTERNALAPI_HOST_ROUTES=${INTERNALAPI_HOST_ROUTES}
nncp: export STORAGE_PREFIX=${NETWORK_STORAGE_ADDRESS_PREFIX}
nncp: export NNCP_STORAGE_HOST_ROUTES=${STORAGE_HOST_ROUTES}
nncp: export STORAGEMGMT_PREFIX=${NETWORK_STORAGEMGMT_ADDRESS_PREFIX}
nncp: export NNCP_STORAGEMGMT_HOST_ROUTES=${STORAGEMGMT_HOST_ROUTES}
nncp: export TENANT_PREFIX=${NETWORK_TENANT_ADDRESS_PREFIX}
nncp: export NNCP_TENANT_HOST_ROUTES=${TENANT_HOST_ROUTES}
nncp: export DESIGNATE_PREFIX=${NETWORK_DESIGNATE_ADDRESS_PREFIX}
ifeq ($(NETWORK_BGP), true)
nncp: export BGP=enabled
nncp: export INTERFACE_BGP_1=${NNCP_BGP_1_INTERFACE}
Expand Down Expand Up @@ -2272,6 +2302,11 @@ 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 INTERNALAPI_PREFIX=${NETWORK_INTERNALAPI_ADDRESS_PREFIX}
netattach: export STORAGE_PREFIX=${NETWORK_STORAGE_ADDRESS_PREFIX}
netattach: export STORAGEMGMT_PREFIX=${NETWORK_STORAGEMGMT_ADDRESS_PREFIX}
netattach: export TENANT_PREFIX=${NETWORK_TENANT_ADDRESS_PREFIX}
netattach: export DESIGNATE_PREFIX=${NETWORK_DESIGNATE_ADDRESS_PREFIX}
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 Expand Up @@ -2318,6 +2353,11 @@ endif
metallb_config: export NAMESPACE=metallb-system
metallb_config: export CTLPLANE_METALLB_POOL=${METALLB_POOL}
metallb_config: export CTLPLANE_METALLB_IPV6_POOL=${METALLB_IPV6_POOL}
metallb_config: export INTERNALAPI_PREFIX=${NETWORK_INTERNALAPI_ADDRESS_PREFIX}
metallb_config: export STORAGE_PREFIX=${NETWORK_STORAGE_ADDRESS_PREFIX}
metallb_config: export STORAGEMGMT_PREFIX=${NETWORK_STORAGEMGMT_ADDRESS_PREFIX}
metallb_config: export TENANT_PREFIX=${NETWORK_TENANT_ADDRESS_PREFIX}
metallb_config: export DESIGNATE_PREFIX=${NETWORK_DESIGNATE_ADDRESS_PREFIX}
ifeq ($(NETWORK_ISOLATION_IPV4), true)
metallb_config: export IPV4_ENABLED=true
endif
Expand Down
23 changes: 23 additions & 0 deletions devsetup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ TIMEOUT ?= 300s

OCP_NETWORK_NAME ?=crc
NETWORK_ISOLATION_USE_DEFAULT_NETWORK ?= true
ADOPTED_SCENARIO ?= false

ifeq ($(ADOPTED_SCENARIO), true)
ADOPTED_INTERNALAPI_NETWORK ?= 172.17.1.0/24
ADOPTED_STORAGE_NETWORK ?= 172.18.1.0/24
ADOPTED_EXTERNAL_NETWORK ?= 172.21.1.0/24
ADOPTED_STORAGEMGMT_NETWORK ?= 172.20.1.0/24
ADOPTED_TENANT_NETWORK ?= 172.20.1.0/24
endif
STANDALONE_INTERNALAPI_NET_PREFIX ?= 172.17.0
STANDALONE_STORAGE_NET_PREFIX ?= 172.18.0
STANDALONE_EXTERNAL_NET_PREFFIX ?= 172.21.0
STANDALONE_STORAGEMGMT_NET_PREFIX ?= 172.20.0
STANDALONE_TENANT_NET_PREFIX ?= 172.19.0

ifeq ($(NETWORK_ISOLATION_USE_DEFAULT_NETWORK), true)
NETWORK_ISOLATION_NET_NAME ?= default
Expand Down Expand Up @@ -433,6 +447,15 @@ standalone_deploy: export COMPUTE_DHCP_AGENT_ENABLED=${EDPM_COMPUTE_DHCP_AGENT_E
standalone_deploy: export STANDALONE=true
standalone_deploy: export INTERFACE_MTU=${NETWORK_MTU}
standalone_deploy: export EDPM_COMPUTE_NETWORK = ${NETWORK_ISOLATION_NET_NAME}
standalone_deploy: export ADOPTION_SCENARIO_A = ${ADOPTED_SCENARIO}
standalone_deploy: export NETWORK_INTERNAL_PREFIX = ${STANDALONE_INTERNALAPI_NET_PREFIX}
standalone_deploy: export NETWORK_STORAGE_PREFIX = ${STANDALONE_STORAGE_NET_PREFIX}
standalone_deploy: export NETWORK_STORAGE_MGMT_PREFIX = ${STANDALONE_STORAGEMGMT_NET_PREFIX}
standalone_deploy: export NETWORK_TENANT_PREFIX = ${STANDALONE_TENANT_NET_PREFIX}
standalone_deploy: export ADOPTED_INTERNAL_NET = ${ADOPTED_INTERNALAPI_NETWORK}
standalone_deploy: export ADOPTED_STORAGE_NET = ${ADOPTED_STORAGE_NETWORK}
standalone_deploy: export ADOPTED_STORAGE_MGMT_NET = ${ADOPTED_STORAGEMGMT_NETWORK}
standalone_deploy: export ADOPTED_TENANT_NET = ${ADOPTED_TENANT_NETWORK}
standalone_deploy:
$(eval $(call vars))
scripts/standalone.sh ${EDPM_COMPUTE_SUFFIX} ${STANDALONE_COMPUTE_DRIVER} '${EDPM_COMPUTE_ADDITIONAL_NETWORKS}' '${EDPM_COMPUTE_ADDITIONAL_HOST_ROUTES}'
Expand Down
10 changes: 10 additions & 0 deletions devsetup/scripts/standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ dns_server: ${PRIMARY_RESOLV_CONF_ENTRY}
compute_driver: ${COMPUTE_DRIVER}
sriov_agent: ${EDPM_COMPUTE_SRIOV_ENABLED}
dhcp_agent: ${EDPM_COMPUTE_DHCP_AGENT_ENABLED}
# Adoption related stuff
adoption_scenario: ${ADOPTION_SCENARIO_A}
adopted_internal_net: ${ADOPTED_INTERNAL_NET}
adopted_storage_net: ${ADOPTED_STORAGE_NET}
adopted_storage_mgmt_net: ${ADOPTED_STORAGE_MGMT_NET}
adopted_tenant_net: ${ADOPTED_TENANT_NET}
standalone_internal_prefix: ${NETWORK_INTERNAL_PREFIX}
standalone_storage_prefix: ${NETWORK_STORAGE_PREFIX}
standalone_storage_mgmt_prefix: ${NETWORK_STORAGE_MGMT_PREFIX}
standalone_tenant_prefix: ${NETWORK_TENANT_PREFIX}
EOF

jinja2_render standalone/network_data.j2 "${J2_VARS_FILE}" > ${MY_TMP_DIR}/network_data.yaml
Expand Down
38 changes: 31 additions & 7 deletions devsetup/standalone/net_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,56 @@ network_config:
mtu: {{ interface_mtu }}
vlan_id: 20
addresses:
- ip_netmask: 172.17.0.{{ ip_address_suffix }}/24
- ip_netmask: 172.17.0.2/32
- ip_netmask: {{ standalone_internal_prefix }}.{{ ip_address_suffix }}/24
- ip_netmask: {{ standalone_internal_prefix }}.2/32
{% if adoption_scenario|default(false) %}
routes:
- ip_netmask: {{ adopted_internal_net }}
next_hop: {{ standalone_internal_prefix }}.{{ ip_address_suffix }}
{% else %}
routes: []
{% endif %}
# storage
- type: vlan
mtu: {{ interface_mtu }}
vlan_id: 21
addresses:
- ip_netmask: 172.18.0.{{ ip_address_suffix }}/24
- ip_netmask: 172.18.0.2/32
- ip_netmask: {{ standalone_storage_prefix }}.{{ ip_address_suffix }}/24
- ip_netmask: {{ standalone_storage_prefix }}.2/32
{% if adoption_scenario|default(false) %}
routes:
- ip_netmask: {{ adopted_storage_net }}
next_hop: {{ standalone_storage_prefix }}.{{ ip_address_suffix }}
{% else %}
routes: []
{% endif %}
# storage_mgmt
- type: vlan
mtu: {{ interface_mtu }}
vlan_id: 23
addresses:
- ip_netmask: 172.20.0.{{ ip_address_suffix }}/24
- ip_netmask: 172.20.0.2/32
- ip_netmask: {{ standalone_storage_mgmt_prefix }}.{{ ip_address_suffix }}/24
- ip_netmask: {{ standalone_storage_mgmt_prefix }}.2/32
{% if adoption_scenario|default(false) %}
routes:
- ip_netmask: {{ adopted_storage_mgmt_net }}
next_hop: {{ standalone_storage_mgmt_prefix }}.{{ ip_address_suffix }}
{% else %}
routes: []
{% endif %}
# tenant
- type: vlan
mtu: {{ interface_mtu }}
vlan_id: 22
addresses:
- ip_netmask: 172.19.0.{{ ip_address_suffix }}/24
- ip_netmask: {{ standalone_tenant_prefix }}.{{ ip_address_suffix }}/24
{% if adoption_scenario|default(false) %}
routes:
- ip_netmask: {{ adopted_tenant_net }}
next_hop: {{ standalone_tenant_prefix }}.{{ ip_address_suffix }}
{% else %}
routes: []
{% endif %}
{%- for network in additional_networks if network.standalone_config %}
{%- set net = network.standalone_config %}
- type: {{ net.type }}
Expand Down
6 changes: 3 additions & 3 deletions scripts/gen-metallb-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ spec:
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/ipaddresspools.yaml <<EOF_CAT
- 172.17.0.80-172.17.0.90
- ${INTERNALAPI_PREFIX}.80-${INTERNALAPI_PREFIX}.90
EOF_CAT
fi
if [ -n "$IPV6_ENABLED" ]; then
Expand All @@ -112,7 +112,7 @@ spec:
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/ipaddresspools.yaml <<EOF_CAT
- 172.18.0.80-172.18.0.90
- ${STORAGE_PREFIX}.80-${STORAGE_PREFIX}.90
EOF_CAT
fi
if [ -n "$IPV6_ENABLED" ]; then
Expand All @@ -132,7 +132,7 @@ spec:
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/ipaddresspools.yaml <<EOF_CAT
- 172.19.0.80-172.19.0.90
- ${TENANT_PREFIX}.80-${TENANT_PREFIX}.90
EOF_CAT
fi
if [ -n "$IPV6_ENABLED" ]; then
Expand Down
65 changes: 35 additions & 30 deletions scripts/gen-netatt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,22 @@
# under the License.
set -ex

if [ -z "${DEPLOY_DIR}" ]; then
echo "Please set DEPLOY_DIR"; exit 1
fi
function check_var_setted () {
if [[ ! -v $1 ]]; then
echo "Please set $1"; exit 1
fi
}

check_var_setted DEPLOY_DIR

if [ ! -d ${DEPLOY_DIR} ]; then
mkdir -p ${DEPLOY_DIR}
fi

if [ -z "${INTERFACE}" ]; then
echo "Please set INTERFACE"; exit 1
fi

if [ -z "${BRIDGE_NAME}" ]; then
echo "Please set BRIDGE_NAME"; exit 1
fi

if [ -z "${VLAN_START}" ]; then
echo "Please set VLAN_START"; exit 1
fi

if [ -z "${VLAN_STEP}" ]; then
echo "Please set VLAN_STEP"; exit 1
fi
check_var_setted INTERFACE
check_var_setted BRIDGE_NAME
check_var_setted VLAN_START
check_var_setted VLAN_STEP

if [ -z "$IPV4_ENABLED" ] && [ -z "$IPV6_ENABLED" ]; then
echo "Please enable either IPv4 or IPv6 by setting IPV4_ENABLED or IPV6_ENABLED"; exit 1
Expand All @@ -47,6 +40,13 @@ if [ -n "$IPV4_ENABLED" ] && [ -n "$IPV6_ENABLED" ]; then
echo "Dual stack not supported, cannot enable both IPv4 and IPv6"; exit 1
fi

if [ -n "$IPV4_ENABLED" ]; then
check_var_setted INTERNALAPI_PREFIX
check_var_setted STORAGE_PREFIX
check_var_setted STORAGEMGMT_PREFIX
check_var_setted TENANT_PREFIX
check_var_setted DESIGNATE_PREFIX
fi

echo DEPLOY_DIR ${DEPLOY_DIR}
echo INTERFACE ${INTERFACE}
Expand All @@ -55,6 +55,11 @@ echo VLAN_STEP ${VLAN_STEP}
if [ -n "$IPV4_ENABLED" ]; then
echo CTLPLANE_IP_ADDRESS_PREFIX ${CTLPLANE_IP_ADDRESS_PREFIX}
echo CTLPLANE_IP_ADDRESS_SUFFIX ${CTLPLANE_IP_ADDRESS_SUFFIX}
echo "INTERNALAPI_PREFIX ${INTERNALAPI_PREFIX}"
echo "STORAGE_PREFIX ${STORAGE_PREFIX}"
echo "STORAGEMGMT_PREFIX ${STORAGEMGMT_PREFIX}"
echo "TENANT_PREFIX ${TENANT_PREFIX}"
echo "DESIGNATE_PREFIX ${DESIGNATE_PREFIX}"
fi
if [ -n "$IPV6_ENABLED" ]; then
echo CTLPLANE_IPV6_ADDRESS_PREFIX ${CTLPLANE_IPV6_ADDRESS_PREFIX}
Expand Down Expand Up @@ -117,9 +122,9 @@ spec:
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"
"range": "${INTERNALAPI_PREFIX}.0/24",
"range_start": "${INTERNALAPI_PREFIX}.30",
"range_end": "${INTERNALAPI_PREFIX}.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/internalapi.yaml <<EOF_CAT
Expand Down Expand Up @@ -153,9 +158,9 @@ spec:
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"
"range": "${STORAGE_PREFIX}.0/24",
"range_start": "${STORAGE_PREFIX}.30",
"range_end": "${STORAGE_PREFIX}.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/storage.yaml <<EOF_CAT
Expand Down Expand Up @@ -189,9 +194,9 @@ spec:
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"
"range": "${TENANT_PREFIX}.0/24",
"range_start": "${TENANT_PREFIX}.30",
"range_end": "${TENANT_PREFIX}.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/tenant.yaml <<EOF_CAT
Expand Down Expand Up @@ -244,9 +249,9 @@ spec:
EOF_CAT
if [ -n "$IPV4_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/storagemgmt.yaml <<EOF_CAT
"range": "172.20.0.0/24",
"range_start": "172.20.0.30",
"range_end": "172.20.0.70"
"range": "${STORAGEMGMT_PREFIX}.0/24",
"range_start": "${STORAGEMGMT_PREFIX}.30",
"range_end": "${STORAGEMGMT_PREFIX}.70"
EOF_CAT
elif [ -n "$IPV6_ENABLED" ]; then
cat >> ${DEPLOY_DIR}/storagemgmt.yaml <<EOF_CAT
Expand Down
Loading

0 comments on commit d870686

Please sign in to comment.