From d870686748002322648ccd3f4f710ff1f7b43ffd Mon Sep 17 00:00:00 2001 From: Arnau Verdaguer Date: Mon, 29 Apr 2024 12:53:00 +0200 Subject: [PATCH] Adding support for adoption scenario 1 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 --- Makefile | 40 ++++++++ devsetup/Makefile | 23 +++++ devsetup/scripts/standalone.sh | 10 ++ devsetup/standalone/net_config.j2 | 38 ++++++-- scripts/gen-metallb-config.sh | 6 +- scripts/gen-netatt.sh | 65 +++++++------ scripts/gen-nncp.sh | 155 ++++++++++++++++++------------ 7 files changed, 238 insertions(+), 99 deletions(-) diff --git a/Makefile b/Makefile index e913ced09..78864ae23 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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} @@ -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} @@ -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 diff --git a/devsetup/Makefile b/devsetup/Makefile index 554a6ed11..1cd0aa9e4 100644 --- a/devsetup/Makefile +++ b/devsetup/Makefile @@ -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 @@ -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}' diff --git a/devsetup/scripts/standalone.sh b/devsetup/scripts/standalone.sh index f3b59aa4d..c2d2e2414 100755 --- a/devsetup/scripts/standalone.sh +++ b/devsetup/scripts/standalone.sh @@ -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 diff --git a/devsetup/standalone/net_config.j2 b/devsetup/standalone/net_config.j2 index 4062b6b4b..f58d78962 100644 --- a/devsetup/standalone/net_config.j2 +++ b/devsetup/standalone/net_config.j2 @@ -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 }} diff --git a/scripts/gen-metallb-config.sh b/scripts/gen-metallb-config.sh index 7d2b066c1..cf4798db5 100644 --- a/scripts/gen-metallb-config.sh +++ b/scripts/gen-metallb-config.sh @@ -92,7 +92,7 @@ spec: EOF_CAT if [ -n "$IPV4_ENABLED" ]; then cat >> ${DEPLOY_DIR}/ipaddresspools.yaml <> ${DEPLOY_DIR}/ipaddresspools.yaml <> ${DEPLOY_DIR}/ipaddresspools.yaml <> ${DEPLOY_DIR}/internalapi.yaml <> ${DEPLOY_DIR}/internalapi.yaml <> ${DEPLOY_DIR}/storage.yaml <> ${DEPLOY_DIR}/storage.yaml <> ${DEPLOY_DIR}/tenant.yaml <> ${DEPLOY_DIR}/tenant.yaml <> ${DEPLOY_DIR}/storagemgmt.yaml <> ${DEPLOY_DIR}/storagemgmt.yaml < ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> "${DEPLOY_DIR}/${WORKER}_nncp.yaml" <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <