@@ -30,7 +30,7 @@ import (
30
30
// +kubebuilder:object:root=true
31
31
// +kubebuilder:resource:shortName=fdbbackup
32
32
// +kubebuilder:subresource:status
33
- // +kubebuilder:metadata:annotations="foundationdb.org/release=v2.11 .0"
33
+ // +kubebuilder:metadata:annotations="foundationdb.org/release=v2.12 .0"
34
34
// +kubebuilder:printcolumn:name="Generation",type="integer",JSONPath=".metadata.generation",description="Latest generation of the spec",priority=0
35
35
// +kubebuilder:printcolumn:name="Reconciled",type="integer",JSONPath=".status.generations.reconciled",description="Last reconciled generation of the spec",priority=0
36
36
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
@@ -117,8 +117,30 @@ type FoundationDBBackupSpec struct {
117
117
// +kubebuilder:validation:Enum=split;unified
118
118
// +kubebuilder:default:=split
119
119
ImageType * ImageType `json:"imageType,omitempty"`
120
+
121
+ // BackupType defines the backup type that should be used for the backup. When the BackupType is set to
122
+ // BackupTypePartitionedLog, it's expected that the FoundationDBCluster creates and manages the additional
123
+ // backup worker processes. A migration to a different backup type is not yet supported in the operator.
124
+ // Default: "backup_agent".
125
+ // +kubebuilder:validation:Optional
126
+ // +kubebuilder:validation:Enum=backup_agent;partitioned_log
127
+ // +kubebuilder:default:=backup_agent
128
+ BackupType * BackupType `json:"backupType,omitempty"`
120
129
}
121
130
131
+ // BackupType defines the backup type that should be used for the backup.
132
+ // +kubebuilder:validation:MaxLength=64
133
+ type BackupType string
134
+
135
+ const (
136
+ // BackupTypeDefault refers to the current default backup type with additional backup agents.
137
+ BackupTypeDefault BackupType = "backup_agent"
138
+
139
+ // BackupTypePartitionedLog refers to the new partitioned log backup system, see
140
+ // https://github.com/apple/foundationdb/blob/main/design/backup_v2_partitioned_logs.md.
141
+ BackupTypePartitionedLog BackupType = "partitioned_log"
142
+ )
143
+
122
144
// FoundationDBBackupStatus describes the current status of the backup for a cluster.
123
145
type FoundationDBBackupStatus struct {
124
146
// AgentCount provides the number of agents that are up-to-date, ready,
@@ -279,6 +301,18 @@ type FoundationDBLiveBackupStatus struct {
279
301
type FoundationDBLiveBackupStatusState struct {
280
302
// Running determines whether the backup is currently running.
281
303
Running bool `json:"Running,omitempty"`
304
+
305
+ // Restorable if true, the backup can be restored
306
+ Restorable * bool `json:"Restorable,omitempty"`
307
+
308
+ // LatestRestorablePoint contains information about the latest restorable point if any exists.
309
+ LatestRestorablePoint * LatestRestorablePoint `json:"LatestRestorablePoint,omitempty"`
310
+ }
311
+
312
+ // LatestRestorablePoint contains information about the latest restorable point if any exists.
313
+ type LatestRestorablePoint struct {
314
+ // Version is the version that can be restored to.
315
+ Version * uint64 `json:"Version,omitempty"`
282
316
}
283
317
284
318
// GetDesiredAgentCount determines how many backup agents we should run
@@ -331,11 +365,34 @@ func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
331
365
return reconciled , nil
332
366
}
333
367
368
+ // GetBackupType returns the backup type for the backup.
369
+ func (backup * FoundationDBBackup ) GetBackupType () BackupType {
370
+ if backup .Spec .BackupType != nil {
371
+ return * backup .Spec .BackupType
372
+ }
373
+
374
+ return BackupTypeDefault
375
+ }
376
+
334
377
// GetAllowTagOverride returns the bool value for AllowTagOverride
335
378
func (foundationDBBackupSpec * FoundationDBBackupSpec ) GetAllowTagOverride () bool {
336
379
return ptr .Deref (foundationDBBackupSpec .AllowTagOverride , false )
337
380
}
338
381
382
+ // GetEncryptionKey returns the encryption key path if the current version supports encrypted backups.
383
+ func (backup * FoundationDBBackup ) GetEncryptionKey () (string , error ) {
384
+ fdbVersion , err := ParseFdbVersion (backup .Spec .Version )
385
+ if err != nil {
386
+ return "" , err
387
+ }
388
+
389
+ if ! fdbVersion .SupportsBackupEncryption () {
390
+ return "" , nil
391
+ }
392
+
393
+ return backup .Spec .EncryptionKeyPath , nil
394
+ }
395
+
339
396
// UseUnifiedImage returns true if the unified image should be used.
340
397
func (backup * FoundationDBBackup ) UseUnifiedImage () bool {
341
398
imageType := ImageTypeUnified
0 commit comments