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

Tunnel related improvements #949

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ NETWORK_ISOLATION_USE_DEFAULT_NETWORK ?= true
NETWORK_ISOLATION_IPV4 ?= true
NETWORK_ISOLATION_IPV6 ?= false
NETWORK_MTU ?= 1500
# VLAN MTU needs to be 4 bytes less than the NETWORK_MTU when tunneling
NETWORK_VLAN_MTU ?=
NETWORK_VLAN_START ?= 20
NETWORK_VLAN_STEP ?= 1
NETWORK_ISOLATION_IPV4_ADDRESS ?= 172.16.1.1/24
Expand Down Expand Up @@ -379,6 +381,7 @@ BAREMETAL_OS_CONTAINER_IMG ?=

# Dataplane Operator
DATAPLANE_TIMEOUT ?= 30m
DATAPLANE_SAMPLES_DIR ?= ${OPERATOR_BASE_DIR}/openstack-operator/config/samples/dataplane
ifeq ($(NETWORK_BGP), true)
ifeq ($(BGP_OVN_ROUTING), true)
DATAPLANE_KUSTOMIZE_SCENARIO ?= bgp_ovn_cluster
Expand All @@ -401,6 +404,7 @@ DATAPLANE_NETWORKER_IP ?=172.16.1.200
DATAPLANE_SSHD_ALLOWED_RANGES ?=['172.16.1.0/24']
DATAPLANE_DEFAULT_GW ?= 172.16.1.1
endif
DATAPLANE_KUSTOMIZE_DIR ?= ${DATAPLANE_SAMPLES_DIR}/${DATAPLANE_KUSTOMIZE_SCENARIO}
DATAPLANE_TOTAL_NODES ?=1
DATAPLANE_GROWVOLS_ARGS ?=/=8GB /tmp=1GB /home=1GB /var=100%
DATAPLANE_TOTAL_NETWORKER_NODES ?=1
Expand All @@ -417,6 +421,7 @@ DATAPLANE_EXTRA_NOVA_CONFIG_FILE ?= /dev/null
DATAPLANE_SERVER_ROLE ?= compute
DATAPLANE_TLS_ENABLED ?= true
DATAPLANE_NOVA_NFS_PATH ?=
DATAPLANE_SKIP_REPO_SETUP ?=

# Manila
MANILA_IMG ?= quay.io/openstack-k8s-operators/manila-operator-index:${OPENSTACK_K8S_TAG}
Expand Down Expand Up @@ -749,7 +754,7 @@ openstack_deploy_prep: export KIND=OpenStackControlPlane
openstack_deploy_prep: export OVN_NICMAPPING=${OVNCONTROLLER_NMAP}
openstack_deploy_prep: export NEUTRON_CUSTOM_CONF=${DEPLOY_DIR}/neutron-custom-conf.patch
openstack_deploy_prep: export BRIDGE_NAME=${NNCP_BRIDGE}
openstack_deploy_prep: export CTLPLANE_IP_ADDRESS_PREFIX=${NNCP_CTLPLANE_IPV6_ADDRESS_PREFIX}
openstack_deploy_prep: export CTLPLANE_IP_ADDRESS_PREFIX=${NNCP_CTLPLANE_IP_ADDRESS_PREFIX}
ifeq ($(NETWORK_ISOLATION_IPV4), true)
openstack_deploy_prep: export IPV4_ENABLED=true
endif
Expand Down Expand Up @@ -830,6 +835,8 @@ edpm_deploy_prep: export BRANCH=${OPENSTACK_BRANCH}
edpm_deploy_prep: export HASH=${OPENSTACK_COMMIT_HASH}
edpm_deploy_prep: export EDPM_TLS_ENABLED=${DATAPLANE_TLS_ENABLED}
edpm_deploy_prep: export EDPM_NOVA_NFS_PATH=${DATAPLANE_NOVA_NFS_PATH}
edpm_deploy_prep: export EDPM_POST_GEN_SCRIPT=${DATAPLANE_POST_GEN_SCRIPT}
edpm_deploy_prep: export EDPM_SKIP_REPO_SETUP=${DATAPLANE_SKIP_REPO_SETUP}
ifeq ($(NETWORK_BGP), true)
ifeq ($(BGP_OVN_ROUTING), true)
edpm_deploy_prep: export BGP=ovn
Expand All @@ -842,7 +849,7 @@ edpm_deploy_prep: edpm_deploy_cleanup openstack_repo ## prepares the CR to insta
mkdir -p ${DEPLOY_DIR}
cp ${DATAPLANE_EXTRA_NOVA_CONFIG_FILE} ${EDPM_EXTRA_NOVA_CONFIG_FILE}
oc apply -f devsetup/edpm/config/ansible-ee-env.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${OPERATOR_BASE_DIR}/openstack-operator/config/samples/dataplane/${DATAPLANE_KUSTOMIZE_SCENARIO} > ${DEPLOY_DIR}/dataplane.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${DATAPLANE_KUSTOMIZE_DIR} > ${DEPLOY_DIR}/dataplane.yaml
bash scripts/gen-edpm-kustomize.sh
ifeq ($(GENERATE_SSH_KEYS), true)
make edpm_deploy_generate_keys
Expand Down Expand Up @@ -882,7 +889,7 @@ edpm_deploy_baremetal_prep: export EDPM_GROWVOLS_ARGS=${DATAPLANE_GROWVOLS_ARGS}
edpm_deploy_baremetal_prep: export REPO=${OPENSTACK_REPO}
edpm_deploy_baremetal_prep: export BRANCH=${OPENSTACK_BRANCH}
edpm_deploy_baremetal_prep: export HASH=${OPENSTACK_COMMIT_HASH}
edpm_deploy_baremetal_prep: export DATAPLANE_KUSTOMIZE_SCENARIO=baremetal
edpm_deploy_baremetal_prep: export DATAPLANE_KUSTOMIZE_DIR=${DATAPLANE_SAMPLES_DIR}/baremetal
edpm_deploy_baremetal_prep: export EDPM_ROOT_PASSWORD=${BM_ROOT_PASSWORD}
edpm_deploy_baremetal_prep: export EDPM_EXTRA_NOVA_CONFIG_FILE=${DEPLOY_DIR}/25-nova-extra.conf
edpm_deploy_baremetal_prep: export EDPM_SERVER_ROLE=compute
Expand All @@ -891,7 +898,7 @@ edpm_deploy_baremetal_prep: edpm_deploy_cleanup openstack_repo ## prepares the C
mkdir -p ${DEPLOY_DIR}
cp ${DATAPLANE_EXTRA_NOVA_CONFIG_FILE} ${EDPM_EXTRA_NOVA_CONFIG_FILE}
oc apply -f devsetup/edpm/config/ansible-ee-env.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${OPERATOR_BASE_DIR}/openstack-operator/config/samples/dataplane/${DATAPLANE_KUSTOMIZE_SCENARIO} > ${DEPLOY_DIR}/dataplane.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${DATAPLANE_KUSTOMIZE_DIR} > ${DEPLOY_DIR}/dataplane.yaml
bash scripts/gen-edpm-baremetal-kustomize.sh
ifeq ($(GENERATE_SSH_KEYS), true)
make edpm_deploy_generate_keys
Expand Down Expand Up @@ -951,7 +958,7 @@ edpm_deploy_networker_prep: export EDPM_SERVER_ROLE=networker
edpm_deploy_networker_prep: export REPO=${OPENSTACK_REPO}
edpm_deploy_networker_prep: export BRANCH=${OPENSTACK_BRANCH}
edpm_deploy_networker_prep: export HASH=${OPENSTACK_COMMIT_HASH}
edpm_deploy_networker_prep: export DATAPLANE_KUSTOMIZE_SCENARIO=networker
edpm_deploy_networker_prep: export DATAPLANE_KUSTOMIZE_DIR=${DATAPLANE_SAMPLES_DIR}/networker
ifeq ($(NETWORK_BGP), true)
ifeq ($(BGP_OVN_ROUTING), true)
edpm_deploy_networker_prep: export BGP=ovn
Expand All @@ -964,7 +971,7 @@ edpm_deploy_networker_prep: edpm_deploy_networker_cleanup openstack_repo ## prep
$(eval $(call vars,$@,dataplane))
mkdir -p ${DEPLOY_DIR_EDPM_NETWORKER}
oc apply -f devsetup/edpm/config/ansible-ee-env.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${OPERATOR_BASE_DIR}/openstack-operator/config/samples/dataplane/${DATAPLANE_KUSTOMIZE_SCENARIO} > ${DEPLOY_DIR_EDPM_NETWORKER}/dataplane.yaml
oc kustomize --load-restrictor LoadRestrictionsNone ${DATAPLANE_KUSTOMIZE_DIR} > ${DEPLOY_DIR_EDPM_NETWORKER}/dataplane.yaml
bash scripts/gen-edpm-kustomize.sh
ifeq ($(GENERATE_SSH_KEYS), true)
make edpm_deploy_generate_keys
Expand Down Expand Up @@ -2301,6 +2308,7 @@ nncp: export CTLPLANE_IP_ADDRESS_SUFFIX=${NNCP_CTLPLANE_IP_ADDRESS_SUFFIX}
nncp: export DNS_SERVER=${NNCP_DNS_SERVER}
endif
nncp: export INTERFACE_MTU=${NETWORK_MTU}
nncp: export VLAN_MTU=${NETWORK_VLAN_MTU}
nncp: export VLAN_START=${NETWORK_VLAN_START}
nncp: export VLAN_STEP=${NETWORK_VLAN_STEP}
nncp: export STORAGE_MACVLAN=${NETWORK_STORAGE_MACVLAN}
Expand Down
1 change: 1 addition & 0 deletions devsetup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ attach_default_interface_cleanup: export BGP_NIC_2_MAC=${CRC_BGP_NIC_2_MAC}
endif
attach_default_interface_cleanup: export INSTANCE_NAME=${NETWORK_ISOLATION_INSTANCE_NAME}
attach_default_interface_cleanup: export NETWORK_NAME=${NETWORK_ISOLATION_NET_NAME}
attach_default_interface_cleanup: export IP_ADDRESS=${NETWORK_ISOLATION_IP_ADDRESS}
attach_default_interface_cleanup: ## Detach default libvirt network from CRC
bash scripts/interfaces-setup-cleanup.sh

Expand Down
16 changes: 12 additions & 4 deletions devsetup/scripts/interfaces-setup-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ if [ "$EUID" -eq 0 ]; then
exit
fi

MAC_ADDRESS=$(virsh --connect=qemu:///system dumpxml $INSTANCE_NAME | xmllint --xpath "string(/domain/devices/interface/source[@network=\"$NETWORK_NAME\"]/../mac/@address)" -)
MAC_ADDRESS=$(virsh --connect=qemu:///system dumpxml $INSTANCE_NAME | xmllint --xpath "string(/domain/devices/interface/source[@network=\"$NETWORK_NAME\"]/../mac/@address)" - 2>/dev/null)
if [ -n "${MAC_ADDRESS}" ]; then
virsh --connect=qemu:///system detach-interface $INSTANCE_NAME network --mac $MAC_ADDRESS
# First try to remove the DHCP static IP entry by MAC, if it fails try by hostname
if ! virsh --connect=qemu:///system net-update $NETWORK_NAME delete ip-dhcp-host "<host mac='$MAC_ADDRESS'/>" --config --live; then
virsh --connect=qemu:///system net-update $NETWORK_NAME delete ip-dhcp-host "<host name='$INSTANCE_NAME'/>" --config --live
if virsh --connect=qemu:///system net-update $NETWORK_NAME delete ip-dhcp-host "<host mac='$MAC_ADDRESS'/>" --config --live 2>/dev/null; then
DHCP_REMOVED=true
fi
sleep 5
fi

# Without MAC we try to remove it using the host name or IP address
if [ -z "${DHCP_REMOVED}" ]; then
if ! virsh --connect=qemu:///system net-update $NETWORK_NAME delete ip-dhcp-host "<host name='$INSTANCE_NAME'/>" --config --live 2>/dev/null; then
virsh --connect=qemu:///system net-update $NETWORK_NAME delete ip-dhcp-host "<host ip='$IP_ADDRESS'/>" --config --live 2>/dev/null
fi
fi

sleep 5

if [ -n "$BGP" ]; then
# We don't destroy the PCI devices here but before adding them, to avoid having to restart the CRC VM twice

Expand Down
38 changes: 31 additions & 7 deletions scripts/gen-edpm-kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,46 @@ cat <<EOF >>kustomization.yaml
EOF
fi

if [ -z "$EDPM_SKIP_REPO_SETUP" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/services/0
value: repo-setup
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/timesync_ntp_servers
value:
- {hostname: ${EDPM_NTP_SERVER}}
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/neutron_public_interface_name
value: ${EDPM_NETWORK_INTERFACE_NAME}
EOF
fi

if [ -n "$EDPM_REGISTRY_URL" ]; then
cat <<EOF >>kustomization.yaml
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/registry_url
value: ${EDPM_REGISTRY_URL}
EOF
fi

if [ -n "$EDPM_CONTAINER_PREFIX" ]; then
cat <<EOF >>kustomization.yaml
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/image_prefix
value: ${EDPM_CONTAINER_PREFIX}
EOF
fi

if [ -n "$EDPM_CONTAINER_TAG" ]; then
cat <<EOF >>kustomization.yaml
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/image_tag
value: ${EDPM_CONTAINER_TAG}
EOF
fi

cat <<EOF >>kustomization.yaml
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/timesync_ntp_servers
value:
- {hostname: ${EDPM_NTP_SERVER}}
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/neutron_public_interface_name
value: ${EDPM_NETWORK_INTERFACE_NAME}
- op: replace
path: /spec/nodeTemplate/ansible/ansibleVars/edpm_sshd_allowed_ranges
value: ${EDPM_SSHD_ALLOWED_RANGES}
Expand Down Expand Up @@ -222,4 +242,8 @@ fi

kustomization_add_resources

if [ -n "${EDPM_POST_GEN_SCRIPT}" ]; then
. "${EDPM_POST_GEN_SCRIPT}"
fi

popd
13 changes: 12 additions & 1 deletion scripts/gen-nncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ if [ -n "$BGP" ]; then
check_var_set BGP_2_IP_ADDRESS
fi

# Default VLANs MTU to the interface MTU if not defined or empty
[ -n "${VLAN_MTU}" ] || VLAN_MTU="${INTERFACE_MTU}"

echo DEPLOY_DIR ${DEPLOY_DIR}
echo WORKERS ${WORKERS}
echo INTERFACE ${INTERFACE}
echo BRIDGE_NAME ${BRIDGE_NAME}
echo INTERFACE_BGP_1 ${INTERFACE_BGP_1}
echo INTERFACE_BGP_2 ${INTERFACE_BGP_2}
echo INTERFACE_MTU ${INTERFACE_MTU}
echo VLAN_MTU ${VLAN_MTU}
echo VLAN_START ${VLAN_START}
echo VLAN_STEP ${VLAN_STEP}
echo STORAGE_MACVLAN ${STORAGE_MACVLAN}
Expand Down Expand Up @@ -187,6 +191,7 @@ EOF_CAT
cat >> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <<EOF_CAT
- description: internalapi vlan interface
name: ${INTERFACE}.${internalapi_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand Down Expand Up @@ -233,6 +238,7 @@ EOF_CAT
cat >> "${DEPLOY_DIR}/${WORKER}_nncp.yaml" <<EOF_CAT
- description: storage vlan interface
name: ${INTERFACE}.${storage_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand All @@ -249,6 +255,7 @@ EOF_CAT
enabled: false
- description: macvlan interface for storage NW
name: storage
mtu: ${INTERFACE_MTU}
state: up
type: mac-vlan
mac-vlan:
Expand Down Expand Up @@ -295,6 +302,7 @@ EOF_CAT
cat >> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <<EOF_CAT
- description: tenant vlan interface
name: ${INTERFACE}.${tenant_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand Down Expand Up @@ -340,6 +348,7 @@ EOF_CAT
cat >> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <<EOF_CAT
- description: storagemgmt vlan interface
name: ${INTERFACE}.${storagemgmt_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand Down Expand Up @@ -386,6 +395,7 @@ EOF_CAT
cat >> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <<EOF_CAT
- description: Octavia vlan host interface
name: ${INTERFACE}.${octavia_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand All @@ -398,7 +408,7 @@ EOF_CAT
port:
- name: ${INTERFACE}.${octavia_vlan_id}
description: Configuring bridge octbr
mtu: 1500
mtu: ${INTERFACE_MTU}
name: octbr
state: up
type: linux-bridge
Expand All @@ -410,6 +420,7 @@ EOF_CAT
cat >> ${DEPLOY_DIR}/${WORKER}_nncp.yaml <<EOF_CAT
- description: designate vlan interface
name: ${INTERFACE}.${designate_vlan_id}
mtu: ${VLAN_MTU}
state: up
type: vlan
vlan:
Expand Down