Skip to content

Commit

Permalink
Add retries to NNCP deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdenny committed Jun 17, 2024
1 parent c937765 commit 7b24d4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ NNCP_CTLPLANE_IPV6_ADDRESS_SUFFIX ?=10
NNCP_GATEWAY_IPV6 ?=fd00:aaaa::1
NNCP_DNS_SERVER_IPV6 ?=fd00:aaaa::1
NNCP_ADDITIONAL_HOST_ROUTES ?=
NNCP_RETRIES ?= 5

# MetalLB
ifeq ($(NETWORK_ISOLATION_USE_DEFAULT_NETWORK), true)
Expand Down Expand Up @@ -667,8 +668,8 @@ endif

OPENSTACK_PREP_DEPS := validate_marketplace
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(INSTALL_CERT_MANAGER)), certmanager)
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_ISOLATION)), nmstate nncp netattach metallb metallb_config)
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_BGP)), nmstate nncp netattach metallb metallb_config)
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_ISOLATION)), nmstate nncp_with_retries netattach metallb metallb_config)
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(NETWORK_BGP)), nmstate nncp_with_retries netattach metallb metallb_config)
OPENSTACK_PREP_DEPS += $(if $(findstring true,$(BMO_SETUP)), crc_bmo_setup)

.PHONY: openstack_prep
Expand Down Expand Up @@ -2154,6 +2155,12 @@ else
oc wait deployments/nmstate-webhook -n ${NAMESPACE} --for condition=Available --timeout=${TIMEOUT}
endif

.PHONY: nncp_with_retries
nncp_with_retries: ## Deploy NNCP with retries
$(eval $(call vars,$@))
bash scripts/retry_make_nncp.sh $(NNCP_RETRIES)


.PHONY: nncp
nncp: export INTERFACE=${NNCP_INTERFACE}
nncp: export BRIDGE_NAME=${NNCP_BRIDGE}
Expand Down
15 changes: 15 additions & 0 deletions scripts/retry_make_nncp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

n=0
retries="${1:-5}" # Number of retries with a default value of 5

while true; do
make nncp && break
make nncp_cleanup
n=$((n+1))
if (( n >= retries )); then
echo "Failed to run 'make nncp' target. Aborting"
exit 1
fi
sleep 10
done

0 comments on commit 7b24d4e

Please sign in to comment.