Skip to content

Controller · manager

Etcd backup controllers

The etcd backup lane has two controllers. etcdbackuppolicy schedules and prunes the snapshots of one EtcdBackupPolicy. etcdsnapshot takes each new EtcdSnapshot once, encrypts it to your age keys and stores it in the sink.

Reconciles
EtcdBackupPolicy (etcdbackuppolicy) and EtcdSnapshot (etcdsnapshot). Both with a generation predicate.
Approval
None. A snapshot is a read. It changes no machine.
Talks to
The Talos API of a healthy control plane, and the sink: an S3 bucket or the backup volume of the manager.
Keys
The operator holds only the public age recipients. It can write a backup, but it can never read one.
Requeue
At the next schedule time, or 30 seconds while the sink is not ready or a snapshot runs.
Metric
pk_metal_etcd_backup_last_success_timestamp_seconds for each cluster.
Controller Kind Relation Why a change starts a pass
etcdbackuppolicy EtcdBackupPolicy For, generation or annotation You changed the policy, or asked for a snapshot now.
etcdbackuppolicy EtcdSnapshot Watches, label os.platform-kit.org/etcd-backup-policy A snapshot ended.
etcdsnapshot EtcdSnapshot For, generation A new snapshot record.
The policy loop: check the sink, prune by retention, summarize, set BackedUp, schedule the next snapshot.Read the policy and the cluster1Ready = FalseClusterNotFoundBuild the sink, parse recipients2Ready = FalseSinkUnavailable, SinkRefused, RecipientsInvalidPrune by retentionobject first, then the record3Summarize, set BackedUp4Schedule a snapshot if dueone at a time5next pass: the next schedule time
  1. Read the policy and its TalosCluster.
  2. Build the sink and parse the age recipients. Set Ready.
  3. Delete snapshots that the retention no longer keeps. Delete the stored object first. Delete the record after it. The newest verified snapshot always stays.
  4. Write the summary, newest first. Set BackedUp. It turns False when the newest verified snapshot is older than twice the interval.
  5. If the interval passed, the policy is not suspended and no snapshot runs, create a new EtcdSnapshot.
  1. Read the snapshot. Act only while it is in progress.
  2. If status.takenAt is set but the end was never recorded, the stream stopped halfway. Delete the partial object and fail the snapshot. The next schedule tries again.
  3. Pick a healthy etcd member. Prefer a follower, so that the leader is not slowed. Wait up to 10 minutes.
  4. Record the start. Stream the snapshot through age encryption into the sink. The limit is 30 minutes.
  5. Read the object back and check it. Set Complete and Verified.
No backup on its own disk
A pvc sink is refused for the cluster that the operator runs on. That volume lives on the etcd that it backs up. Use an S3 sink for that cluster.
One stream for each policy
A slow sink does not pile up streams from the same etcd.
Failures stay
The lane keeps the last 3 failed snapshots for a person to read.
Object or field When Field manager
EtcdSnapshot objects (create, delete) Schedule and retention manager
Stored snapshot objects in the sink Each snapshot the manager process
Policy status: Ready, BackedUp, summary, lastScheduleTime When it changed manager (status update)
Snapshot status: Complete, Verified, takenAt, location When it changed manager (status update)
Object Condition Reasons
Policy Ready SinkReady, SinkUnavailable, SinkRefused, RecipientsInvalid, ClusterNotFound
Policy BackedUp SnapshotRecent, NoSnapshot, BackupTooOld
Snapshot Complete Taking, Stored, SnapshotFailed
Snapshot Verified Intact, Damaged, ReadBackFailed
You see Cause Do this
Ready=False, SinkRefused A pvc sink for the cluster of the operator. Use an S3 sink.
BackedUp=False, BackupTooOld Snapshots fail or the sink is down. Read the failed snapshots. See pk-metal backup.
Etcd lost its data All members lost etcd. Use etcd unhealthy or quorum lost.
API groupResourcesVerbsScope
os.platform-kit.orgetcdbackuppoliciesgetlistwatchcluster
os.platform-kit.orgetcdbackuppolicies/statusupdatecluster
os.platform-kit.orgetcdsnapshotsgetlistwatchcreatedeletecluster
os.platform-kit.orgetcdsnapshots/statusupdatecluster
os.platform-kit.orgtalosclusterstalosnodesgetlistwatchcluster
coresecretsgetlistwatchnamespace pk-metal