Inspect zone file and journal before seeding a zone
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful

Fixes #19
This commit is contained in:
2026-09-19 22:33:48 +10:00
parent 8d5a231a78
commit f1d47c8ff7
4 changed files with 491 additions and 9 deletions
+14 -1
View File
@@ -105,9 +105,22 @@ func (r *BindZoneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
if primaryIP == "" {
return r.setPhase(ctx, &zone, "Pending", "PrimaryNoIP", "waiting for primary pod IP")
}
if err := r.Exec.WriteSeedZone(ctx, zone.Namespace, primaryPod, zone.Spec.ZoneName, bind.ZoneFilePath(zone.Spec.ZoneName), primaryIP, 1); err != nil {
// The zone is absent from named's memory, but its database file and
// journal may still be on the PVC from a previous incarnation.
path := bind.ZoneFilePath(zone.Spec.ZoneName)
state, err := r.Exec.ZoneDiskState(ctx, zone.Namespace, primaryPod, path)
if err != nil {
return r.setPhase(ctx, &zone, "Error", "SeedFailed", err.Error())
}
plan := bind.PlanSeed(state)
if err := r.Exec.Quarantine(ctx, zone.Namespace, primaryPod, path, plan); err != nil {
return r.setPhase(ctx, &zone, "Error", "SeedFailed", err.Error())
}
if plan.WriteSeed {
if err := r.Exec.WriteSeedZone(ctx, zone.Namespace, primaryPod, zone.Spec.ZoneName, path, primaryIP, plan.Serial); err != nil {
return r.setPhase(ctx, &zone, "Error", "SeedFailed", err.Error())
}
}
}
if err := r.Exec.AddZone(ctx, zone.Namespace, primaryPod, zone.Spec.ZoneName, zone.Spec.ViewRef, zoneConfig); err != nil {
return r.setPhase(ctx, &zone, "Error", "AddZoneFailed", err.Error())