refactor: convert default_hook.sh to golang agent #831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The network hook system has been refactored from a bash script to a two-tier architecture:
Note: Some specialized environments (like EKS and OpenShift) may still need custom scripts for specific network configurations.
Execution Flow
At each hook point:
Hook Points
There are 5 hook points:
CALICOVPP_HOOK_BEFORE_IF_READCALICOVPP_HOOK_BEFORE_VPP_RUNCALICOVPP_HOOK_VPP_RUNNINGCALICOVPP_HOOK_VPP_DONE_OKCALICOVPP_HOOK_VPP_ERROREDOptional User Hook Scripts
All default to empty (no scripts by default):
To add custom logic, set the env var:
Native Go Hooks
The
NetworkManagerHookGo module automatically handles:1. System Detection
2. DNS Management (NetworkManager)
dns=noneto/etc/NetworkManager/NetworkManager.confbefore VPP starts inBEFORE_VPP_RUNVPP_DONE_OK/VPP_ERRORED3. Network Service Restart
VPP_RUNNING) and after VPP stops (VPP_DONE_OK/VPP_ERRORED)4. AWS Network File Handling
dynamic IPinterfaces that becomeunmanagedon AWS EC2 instancesBEFORE_VPP_RUNunmanagedwhile VPP runs inVPP_RUNNINGVPP_DONE_OK/VPP_ERRORED