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

add 1 nic to mce (ovn) #462

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/testing-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
echo ">>>>"

BRANCH=${{ github.event.pull_request.head.ref }} make bootstrap
RELEASE=${RELEASE} make build-edgecluster-compact-2nics
RELEASE=${RELEASE} make build-edgecluster-compact
RELEASE=${RELEASE} make deploy-pipe-edgecluster-compact-ci

- name: verify if the pipe has been successful
Expand Down
81 changes: 56 additions & 25 deletions deploy-edgecluster/render_edgeclusters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ create_edgecluster_definitions() {
grab_api_ingress ${cluster}
export CHANGE_EDGE_MASTER_PUB_INT_M0=$(yq eval ".edgeclusters[${edgeclusternumber}].${cluster}.master0.nic_int_static" ${EDGECLUSTERS_FILE})
export CHANGE_EDGE_MASTER_MGMT_INT_M0=$(yq eval ".edgeclusters[${edgeclusternumber}].${cluster}.master0.nic_ext_dhcp" ${EDGECLUSTERS_FILE})
if [[ ${CHANGE_EDGE_MASTER_PUB_INT_M0} == "null" ]]; then
export CHANGE_EDGE_MASTER_PUB_INT_M0=veth2
echo "New interface for ovn is: veth2"
fi
export DATA_PUB_INT_M0=$(echo "${CHANGE_EDGE_MASTER_PUB_INT_M0}" | base64 -w0)
export CHANGE_BASEDOMAIN=${HUB_BASEDOMAIN}
export IGN_OVERRIDE_API_HOSTS=$(echo -n "${CHANGE_EDGE_API} ${EDGE_API_NAME}" | base64 -w0)
export IGN_CSR_APPROVER_SCRIPT=$(base64 csr_autoapprover.sh -w0)
export IGN_CHANGE_DEF_ROUTE_SCRIPT=$(base64 change_def_route.sh -w0)
export JSON_STRING_CFG_OVERRIDE_INFRAENV='{"ignition":{"version":"3.1.0"},"storage":{"files":[{"path":"/etc/hosts","append":[{"source":"data:text/plain;base64,'${IGN_OVERRIDE_API_HOSTS}'"}]}]}}'
export JSON_STRING_CFG_OVERRIDE_BMH='{"ignition":{"version":"3.2.0"},"systemd":{"units":[{"name":"csr-approver.service","enabled":true,"contents":"[Unit]\nDescription=CSR Approver\nAfter=network.target\n\n[Service]\nUser=root\nType=oneshot\nExecStart=/bin/bash -c /opt/bin/csr-approver.sh\n\n[Install]\nWantedBy=multi-user.target"},{"name":"change-def-route.service","enabled":true,"contents":"[Unit]\nDescription=Change-Default-Route\nAfter=network.target\n\n[Service]\nUser=root\nType=simple\nExecStart=/bin/bash -c \"/opt/bin/change_def_route.sh '${CHANGE_EDGE_MASTER_MGMT_INT_M0}'\"\n\n[Install]\nWantedBy=multi-user.target"},{"name":"crio-wipe.service","mask":true}]},"storage":{"files":[{"path":"/opt/bin/csr-approver.sh","mode":492,"append":[{"source":"data:text/plain;base64,'${IGN_CSR_APPROVER_SCRIPT}'"}]},{"path":"/opt/bin/change_def_route.sh","mode":492,"append":[{"source":"data:text/plain;base64,'${IGN_CHANGE_DEF_ROUTE_SCRIPT}'"}]},{"path":"/var/lib/ovnk/iface_default_hint","mode":492,"override":true,"contents":{"source":"data:text/plain;base64,'${DATA_PUB_INT_M0}'"}}]}}'
export IGN_RUN_VETH_INTERFACES_SCRIPT=$(base64 run_veth_interfaces.sh -w0)
export JSON_STRING_CFG_OVERRIDE_INFRAENV='{"ignition":{"version":"3.1.0"},"systemd":{"units":[{"name":"run-veth-intefaces.service","enabled":true,"contents":"[Unit]\nDescription=veth-interfaces\nAfter=network.target\n\n[Service]\nUser=root\nType=oneshot\nExecStart=/bin/bash -c /opt/bin/run-veth-interfaces.sh\n\n[Install]\nWantedBy=multi-user.target"}]},"storage":{"files":[{"path":"/etc/hosts","append":[{"source":"data:text/plain;base64,'${IGN_OVERRIDE_API_HOSTS}'"}]},{"path":"/opt/bin/run-veth-interfaces.sh","mode":492,"override":true,"contents":{"source":"data:text/plain;base64,'${IGN_RUN_VETH_INTERFACES_SCRIPT}'"}}]}}'
export JSON_STRING_CFG_OVERRIDE_BMH='{"ignition":{"version":"3.2.0"},"systemd":{"units":[{"name":"run-veth-intefaces.service","enabled":true,"contents":"[Unit]\nDescription=veth-interfaces\nAfter=network.target\n\n[Service]\nUser=root\nType=oneshot\nExecStart=/bin/bash -c /opt/bin/run-veth-interfaces.sh\n\n[Install]\nWantedBy=multi-user.target"},{"name":"csr-approver.service","enabled":true,"contents":"[Unit]\nDescription=CSR Approver\nAfter=network.target\n\n[Service]\nUser=root\nType=oneshot\nExecStart=/bin/bash -c /opt/bin/csr-approver.sh\n\n[Install]\nWantedBy=multi-user.target"},{"name":"change-def-route.service","enabled":true,"contents":"[Unit]\nDescription=Change-Default-Route\nAfter=network.target\n\n[Service]\nUser=root\nType=simple\nExecStart=/bin/bash -c \"/opt/bin/change_def_route.sh '${CHANGE_EDGE_MASTER_MGMT_INT_M0}'\"\n\n[Install]\nWantedBy=multi-user.target"},{"name":"crio-wipe.service","mask":true}]},"storage":{"files":[{"path":"/opt/bin/csr-approver.sh","mode":492,"append":[{"source":"data:text/plain;base64,'${IGN_CSR_APPROVER_SCRIPT}'"}]},{"path":"/opt/bin/run-veth-interfaces.sh","mode":492,"override":true,"contents":{"source":"data:text/plain;base64,'${IGN_RUN_VETH_INTERFACES_SCRIPT}'"}},{"path":"/opt/bin/change_def_route.sh","mode":492,"append":[{"source":"data:text/plain;base64,'${IGN_CHANGE_DEF_ROUTE_SCRIPT}'"}]},{"path":"/var/lib/ovnk/iface_default_hint","mode":492,"override":true,"contents":{"source":"data:text/plain;base64,'${DATA_PUB_INT_M0}'"}}]}}'
# Generate the edgecluster definition yaml
cat <<EOF >${OUTPUTDIR}/${cluster}-cluster.yaml
---
Expand Down Expand Up @@ -282,42 +287,68 @@ metadata:
spec:
config:
interfaces:
EOF
echo ">> Checking Number of Interfaces"
echo "Edge-cluster: ${cluster}"
echo "Master: ${master}"
if [[ ${CHANGE_EDGE_MASTER_PUB_INT_MAC} == "null" ]]; then
cat <<EOF >>${OUTPUT}
- name: veth1
type: veth
state: up
mtu: 1500
veth:
peer: veth2
- name: veth2
type: veth
state: up
mtu: 1500
veth:
peer: veth1
ipv4:
enabled: true
address:
- ip: $CHANGE_EDGE_MASTER_PUB_INT_IP
prefix-length: 24

- name: $CHANGE_EDGE_MASTER_MGMT_INT
type: ethernet
state: up
ethernet:
auto-negotiation: true
duplex: full
speed: 10000
mtu: 1500
mac-address: '$CHANGE_EDGE_MASTER_MGMT_INT_MAC'
- name: br-ztp
type: linux-bridge
state: up
bridge:
port:
- name: veth1
- name: $CHANGE_EDGE_MASTER_MGMT_INT
ipv4:
enabled: true
dhcp: true
auto-dns: true
auto-gateway: true
auto-routes: true
mtu: 1500
mac-address: '$CHANGE_EDGE_MASTER_MGMT_INT_MAC'
EOF
echo ">> Checking Number of Interfaces"
echo "Edge-cluster: ${cluster}"
echo "Master: ${master}"
if [[ ${CHANGE_EDGE_MASTER_PUB_INT_MAC} == "null" ]]; then
else
cat <<EOF >>${OUTPUT}
- name: $CHANGE_EDGE_MASTER_MGMT_INT.102
type: vlan
- name: $CHANGE_EDGE_MASTER_MGMT_INT
type: ethernet
state: up
vlan:
base-iface: $CHANGE_EDGE_MASTER_MGMT_INT
id: 102
ethernet:
auto-negotiation: true
duplex: full
speed: 10000
ipv4:
enabled: true
address:
- ip: $CHANGE_EDGE_MASTER_PUB_INT_IP
prefix-length: $CHANGE_EDGE_MASTER_PUB_INT_MASK
dhcp: true
auto-dns: true
auto-gateway: true
auto-routes: true
mtu: 1500
EOF
else
cat <<EOF >>${OUTPUT}
mac-address: '$CHANGE_EDGE_MASTER_MGMT_INT_MAC'

- name: $CHANGE_EDGE_MASTER_PUB_INT
type: ethernet
state: up
Expand Down Expand Up @@ -354,7 +385,7 @@ EOF
EOF
if [[ ${CHANGE_EDGE_MASTER_PUB_INT_MAC} == "null" ]]; then
cat <<EOF >>${OUTPUT}
next-hop-interface: $CHANGE_EDGE_MASTER_MGMT_INT.102
next-hop-interface: veth2
EOF
else
cat <<EOF >>${OUTPUT}
Expand All @@ -367,12 +398,12 @@ EOF
cat <<EOF >>${OUTPUT}
- destination: 0.0.0.0/0
next-hop-address: $CHANGE_EDGE_MASTER_PUB_INT_GW
metric: 101
metric: 501
table-id: 254
EOF
if [[ ${CHANGE_EDGE_MASTER_PUB_INT_MAC} == "null" ]]; then
cat <<EOF >>${OUTPUT}
next-hop-interface: $CHANGE_EDGE_MASTER_MGMT_INT.102
next-hop-interface: veth2
EOF
else
cat <<EOF >>${OUTPUT}
Expand Down
7 changes: 7 additions & 0 deletions deploy-edgecluster/run_veth_interfaces.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
# Set path during systemd execution
export PATH=/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

ip link set dev veth2 up 1>/dev/null 2>&1
sleep 5
ip link set dev veth1 up 1>/dev/null 2>&1