f-41: vpc: VRF, L3VNI et transit à la création des VPC routées #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 20:21:19 +02:00
commit 3c6852dc18
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 541 additions and 5 deletions

View file

@ -3,6 +3,7 @@ package vpc
import (
"strings"
configuration "git.g3e.fr/syonad/two/internal/config/agent"
"git.g3e.fr/syonad/two/internal/netif"
"git.g3e.fr/syonad/two/internal/netns"
"git.g3e.fr/syonad/two/internal/state"
@ -10,7 +11,7 @@ import (
"github.com/dgraph-io/badger/v4"
)
func CreateVPC(db *badger.DB, name string) error {
func CreateVPC(db *badger.DB, name string, cfg *configuration.Config) error {
if current, err := state.Get(db, "vpc/"+name); err != nil {
return err
} else if current == state.Creating {
@ -48,6 +49,15 @@ func CreateVPC(db *badger.DB, name string) error {
}); err != nil {
return err
}
l3, ok, err := loadL3(db, name, vpcID)
if err != nil {
return err
}
if ok {
if err := createL3(newSystem(), cfg, l3); err != nil {
return err
}
}
return state.Set(db, "vpc/"+name, state.Running)
}
return nil