External IPAM authority: NetBox driver, ownership, reconcile
Every address Rollcall hands out is registered in the configured authority first; addresses others hold there are skipped. Rollcall's records carry the tag `rollcall` and the machine ID in the `rollcall_machine` custom field; only those are changed or deleted. Releases trigger a reconcile that also runs periodically. dns_name per address feeds the site's DNS sync. Delegated prefixes can be listed and imported as subnets. `rollcall ipam`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8465c235a
commit
2706fd65e7
14 files changed
+1068
-6
No files matched your search
@@ -34,6 +34,9 @@ type App struct {
|
||||
netMu sync.RWMutex
|
||||
racks map[string]RackController
|
||||
subnets []Subnet
|
||||
|
||||
ipam ipamProvider // nil = built-in IPAM only
|
||||
ipamSt *ipamState
|
||||
}
|
||||
|
||||
type apiError struct {
|
||||
@@ -194,6 +197,10 @@ func (a *App) routes() http.Handler {
|
||||
mux.HandleFunc("GET /api/v1/ips", a.adminAuth(a.handleIPs))
|
||||
mux.HandleFunc("POST /api/v1/ips", a.adminAuth(a.handleIPs))
|
||||
mux.HandleFunc("DELETE /api/v1/ips/{ip}", a.adminAuth(a.handleIPDelete))
|
||||
mux.HandleFunc("GET /api/v1/ipam", a.adminAuth(a.handleIPAM))
|
||||
mux.HandleFunc("POST /api/v1/ipam/sync", a.adminAuth(a.handleIPAMSync))
|
||||
mux.HandleFunc("GET /api/v1/ipam/prefixes", a.adminAuth(a.handleIPAMPrefixes))
|
||||
mux.HandleFunc("POST /api/v1/ipam/prefixes", a.adminAuth(a.handleIPAMPrefixes))
|
||||
mux.HandleFunc("GET /api/v1/layouts", a.adminAuth(a.handleLayouts))
|
||||
mux.HandleFunc("POST /api/v1/layouts", a.adminAuth(a.handleLayouts))
|
||||
mux.HandleFunc("DELETE /api/v1/layouts/{name}", a.adminAuth(a.handleLayoutDelete))
|
||||
@@ -571,6 +578,7 @@ func (a *App) handleDelete(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
a.removePXE(m)
|
||||
defer a.kickIPAM()
|
||||
if err := a.store.Delete(r.Context(), m.ID); err != nil {
|
||||
fail(w, 500, err)
|
||||
return
|
||||
@@ -675,6 +683,9 @@ func serve(cfgPath string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("rack controllers: %w", err)
|
||||
}
|
||||
if err := app.startIPAM(); err != nil {
|
||||
return fmt.Errorf("ipam: %w", err)
|
||||
}
|
||||
handler := app.routes()
|
||||
if cfg.TLSListen != "" {
|
||||
names := append([]string{}, cfg.TLSNames...)
|
||||
|
||||
Reference in new issue
Block a user