Restore OnlineKind

This commit is contained in:
Jean-Marc ANDRE 2023-03-23 22:19:13 +01:00
parent 7e007bfd44
commit b2d80d66ae
6 changed files with 28 additions and 18 deletions

View File

@ -40,10 +40,11 @@ type TargetStatus struct {
TargetName string `json:"targetName"`
TargetKind `json:"targetKind"`
SessionState `json:"state"`
SnapshotId string `json:"snapshotId"`
StartTime *metav1.Time `json:"startTime"`
Duration *metav1.Duration `json:"duration,omitempty"`
Try int `json:"try"`
// +optional
SnapshotId string `json:"snapshotId,omitempty"`
StartTime *metav1.Time `json:"startTime"`
Duration *metav1.Duration `json:"duration,omitempty"`
Try int `json:"try"`
}
// BackupSessionSpec defines the desired state of BackupSession

View File

@ -1,6 +1,7 @@
package v1alpha1
const (
RESTORECONTAINER_NAME string = "formol-restore"
// the name of the sidecar container
SIDECARCONTAINER_NAME string = "formol"
// the name of the container we backup when there are more than 1 container in the pod

View File

@ -27,7 +27,7 @@ type BackupSessionRef struct {
// RestoreSessionSpec defines the desired state of RestoreSession
type RestoreSessionSpec struct {
BackupSessionRef `json:"backupSessionRef"`
BackupSessionRef `json:"backupSession"`
}
// RestoreSessionStatus defines the observed state of RestoreSession

View File

@ -350,6 +350,11 @@ func (r *BackupConfigurationReconciler) createRBACSidecar(sa corev1.ServiceAccou
Name: FORMOL_SIDECAR_ROLE,
},
Rules: []rbacv1.PolicyRule{
rbacv1.PolicyRule{
Verbs: []string{"get", "list", "update"},
APIGroups: []string{"apps"},
Resources: []string{"deployments"},
},
rbacv1.PolicyRule{
Verbs: []string{"get", "list", "watch"},
APIGroups: []string{"formol.desmojim.fr"},

View File

@ -58,7 +58,7 @@ func (r *RestoreSessionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
if err := r.Get(r.Context, client.ObjectKey{
Namespace: backupSession.Spec.Ref.Namespace,
Name: backupSession.Spec.Ref.Name,
}, &restoreSession); err != nil {
}, &backupConf); err != nil {
r.Log.Error(err, "unable to get BackupConfiguration")
return ctrl.Result{}, err
}

View File

@ -10,21 +10,24 @@ spec:
name: backup-demo
namespace: demo
status:
keep: monthly
startTime: "2021-05-01T22:15:28Z"
keep: ""
startTime: "2023-03-20T20:47:08Z"
state: Success
target:
- duration: 17.952754232s
kind: Sidecar
name: nginx-deployment
snapshotId: f411315c
startTime: "2021-05-01T22:15:34Z"
- backupType: Online
duration: 3.189468146s
snapshotId: 4730eaad
startTime: "2023-03-20T20:47:08Z"
state: Success
targetKind: Deployment
targetName: apache-deployment
try: 1
- duration: 25.46747271s
kind: Job
name: backup-pg
snapshotId: ca673e5a
startTime: "2021-05-01T22:15:55Z"
- backupType: Job
duration: 7.509060051s
snapshotId: 4ddc5da1
startTime: "2023-03-20T20:47:08Z"
state: Success
targetKind: StatefulSet
targetName: postgres-demo
try: 1