Documentation
¶
Overview ¶
Package backup implements full-platform disaster recovery (spec §3.11, T-66): a leader backs up the raft state, the cluster CA material and the sealed data key to the same S3 object store the volume snapshots use; `zatterad restore` rebuilds a fresh single-node cluster from the latest backup.
Layout under the store prefix:
backups/<ts>/state.pb.enc encrypted (data key) marshaled state Snapshot backups/<ts>/ca.pb.enc encrypted (data key) CA cert + key PEM backups/<ts>/keys.pb ClusterKeyMaterial (data key sealed by passphrase) backups/<ts>/index.json plaintext index (pointers + volume snapshot refs) backups/latest plaintext "<ts>" pointer
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
Version int `json:"version"`
Kind string `json:"kind"`
TimestampUnix int64 `json:"timestamp_unix"`
KeyVersion uint32 `json:"key_version"`
NodeIDs []string `json:"node_ids"`
Volumes []VolumeRef `json:"volumes"`
}
Index is the plaintext manifest of one full backup. It holds no secrets — only object pointers and the volume snapshots to restore.
func Backup ¶
Backup writes a full backup and returns its index. It never mutates cluster state (the caller records a BackupRecord).
func Restore ¶
func Restore(ctx context.Context, in RestoreInput) (*Index, error)
Restore rebuilds a fresh single-node cluster from the latest backup: it unseals the data key with the passphrase, decrypts the state + CA, marks the old nodes DOWN (mesh IPs preserved), and bootstraps a raft store in DataDir so a subsequent `zatterad server` comes up with the restored state. It returns the backup index (whose volume refs the operator restores as workers rejoin).
type Input ¶
type Input struct {
Store *state.Store
ObjectStore volumes.ObjectStore
Sealer secrets.Sealer // built from the cluster data key (state/CA crypto)
// KeyMaterial is the cluster's data key already sealed under the recovery
// passphrase (from state) — stored verbatim so restore unseals with that same
// passphrase. No fresh passphrase is needed at backup time.
KeyMaterial *zatterav1.ClusterKeyMaterial
CACertPEM []byte
CAKeyPEM []byte
Now time.Time
}
Input configures a backup run.
type RestoreInput ¶
type RestoreInput struct {
ObjectStore volumes.ObjectStore
Passphrase string
DataDir string // fresh, empty
NodeID string // the new single-node cluster's id
}
RestoreInput configures a restore into a fresh data dir.
type VolumeRef ¶
type VolumeRef struct {
VolumeID string `json:"volume_id"`
EnvironmentID string `json:"environment_id"`
Name string `json:"name"`
NodeID string `json:"node_id"`
ManifestKey string `json:"manifest_key"` // "" when the volume has no snapshot
}
VolumeRef points at the latest snapshot to restore for a volume.