8 Commits

Author SHA1 Message Date
gyurix
77f80dea1b feat: add idempotent route checks and container network routes
continuous-integration/drone/push Build is passing
- Make AddRouteInContainer idempotent by checking existing routes and handling "File exists" errors
- Add loop in firewall reconciler to add routes for containers to reach other networks
- Update iptables checks to include port for better rule distinction
2026-06-16 09:42:47 +02:00
gyurix
246346f8b1 feat(docker, firewall): Add stateful network connection check and optimize NAT rules
continuous-integration/drone/push Build is passing
This adds an IsConnected method to verify if a container is already connected to a network with the expected IP, preventing redundant operations. In reconcileIPs, it skips reconnections if the state is correct. In applyNATRule, MASQUERADE is now applied in the same namespace as DNAT (container or host) for consistent and accurate rule application.
2026-06-15 23:39:58 +02:00
gyurix
27607d1a2e feat: add logging to Docker and iptables operations, fix iptables path
continuous-integration/drone/push Build is passing
- Create /var/log/network-go directory in Dockerfile for log storage
- Add comprehensive logging to Docker client creation, network management, and container operations
- Add logging to iptables rule management (list, delete, etc.)
- Fix iptables executable path resolution in deleteMatchingLinesInContainer to use configured binary path
2026-06-15 17:05:53 +02:00
gyurix
2d6e22b9e6 fix(network-go): handle reconnection gracefully and fix DNAT rule issues
continuous-integration/drone/push Build is passing
- Ignore "endpoint already exists" error in ConnectContainer on re-reconciliation
- Improve iptables comment generation to avoid trailing dashes
- Enhance DNAT rule logic: try multiple selectors and fall back to host rules
- Add missing "-t nat" flag in InsertPreroutingRuleOnInterface
2026-06-15 16:12:08 +02:00
gyurix
6c19e22deb refactor(docker): switch container lookup to use filtered ContainerList
continuous-integration/drone/push Build is passing
Replace ContainerInspect with ContainerList and name filters for exact and prefix matching. This improves efficiency and correctness by leveraging Docker's filtering capabilities, matching the old shell script's grep behavior more accurately. Add regexp import to properly escape container names in filters.
2026-06-15 15:25:38 +02:00
gyurix
aac9b83576 feat(network-go): add fuzzy container name resolution for firewall connections
continuous-integration/drone/push Build is passing
Implement FindContainerName method on DockerAPI that attempts exact match
first, then falls back to prefix-based matching (e.g., extracting prefix
before dash like "service-" in "service-abc") to replicate the old shell
script's `grep $D"-"` behavior. Update firewall orchestrator to use this
resolution before connecting containers to networks, improving robustness
when container names vary from configured selectors.
2026-06-15 14:58:29 +02:00
gyurix
fcda599ec7 added test go implementation
continuous-integration/drone/push Build encountered an error
2026-06-08 17:02:13 +02:00
gyurix
c3de398f35 added network-go project
continuous-integration/drone/push Build encountered an error
2026-06-08 15:34:01 +02:00