Compare commits
No commits in common. "477022347d6e35b44aa71cdbf5cd4f7e48441391" and "db8e6fdf61054ad6eaf98190eaf69bd8057d3c3a" have entirely different histories.
477022347d
...
db8e6fdf61
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ import (
|
|||||||
|
|
||||||
// BackupSessionSpec defines the desired state of BackupSession
|
// BackupSessionSpec defines the desired state of BackupSession
|
||||||
type BackupSessionSpec struct {
|
type BackupSessionSpec struct {
|
||||||
Ref corev1.ObjectReference `json:"ref"`
|
Ref string `json:"ref"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BackupSessionStatus defines the observed state of BackupSession
|
// BackupSessionStatus defines the observed state of BackupSession
|
||||||
@ -46,7 +45,7 @@ type BackupSessionStatus struct {
|
|||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
// +kubebuilder:resource:shortName="bs"
|
// +kubebuilder:resource:shortName="bs"
|
||||||
// +kubebuilder:subresource:status
|
// +kubebuilder:subresource:status
|
||||||
// +kubebuilder:printcolumn:name="Ref",type=string,JSONPath=`.spec.ref.name`
|
// +kubebuilder:printcolumn:name="Ref",type=string,JSONPath=`.spec.ref`
|
||||||
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`
|
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`
|
||||||
// +kubebuilder:printcolumn:name="Started",type=string,format=date-time,JSONPath=`.status.startTime`
|
// +kubebuilder:printcolumn:name="Started",type=string,format=date-time,JSONPath=`.status.startTime`
|
||||||
// +kubebuilder:printcolumn:name="Keep",type=string,JSONPath=`.status.keep`
|
// +kubebuilder:printcolumn:name="Keep",type=string,JSONPath=`.status.keep`
|
||||||
|
|||||||
@ -10,7 +10,6 @@ const (
|
|||||||
New SessionState = "New"
|
New SessionState = "New"
|
||||||
Init SessionState = "Initializing"
|
Init SessionState = "Initializing"
|
||||||
Running SessionState = "Running"
|
Running SessionState = "Running"
|
||||||
Waiting SessionState = "Waiting"
|
|
||||||
Finalize SessionState = "Finalizing"
|
Finalize SessionState = "Finalizing"
|
||||||
Success SessionState = "Success"
|
Success SessionState = "Success"
|
||||||
Failure SessionState = "Failure"
|
Failure SessionState = "Failure"
|
||||||
|
|||||||
@ -17,30 +17,26 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
//"k8s.io/apimachinery/pkg/types"
|
//"k8s.io/apimachinery/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BackupSessionRef struct {
|
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||||
// +optional
|
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||||
Ref corev1.ObjectReference `json:"ref,omitempty"`
|
|
||||||
// +optional
|
|
||||||
Spec BackupSessionSpec `json:"spec,omitempty"`
|
|
||||||
// +optional
|
|
||||||
Status BackupSessionStatus `json:"status,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestoreSessionSpec defines the desired state of RestoreSession
|
// RestoreSessionSpec defines the desired state of RestoreSession
|
||||||
type RestoreSessionSpec struct {
|
type RestoreSessionSpec struct {
|
||||||
BackupSessionRef `json:"backupSession"`
|
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||||
//Ref string `json:"backupSessionRef"`
|
// Important: Run "make" to regenerate code after modifying this file
|
||||||
// +optional
|
|
||||||
//Targets []TargetStatus `json:"target,omitempty"`
|
Ref string `json:"backupSessionRef"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestoreSessionStatus defines the observed state of RestoreSession
|
// RestoreSessionStatus defines the observed state of RestoreSession
|
||||||
type RestoreSessionStatus struct {
|
type RestoreSessionStatus struct {
|
||||||
|
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||||
|
// Important: Run "make" to regenerate code after modifying this file
|
||||||
|
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||||
// +optional
|
// +optional
|
||||||
SessionState `json:"state,omitempty"`
|
SessionState `json:"state,omitempty"`
|
||||||
// +optional
|
// +optional
|
||||||
|
|||||||
@ -207,28 +207,9 @@ func (in *BackupSessionList) DeepCopyObject() runtime.Object {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BackupSessionRef) DeepCopyInto(out *BackupSessionRef) {
|
|
||||||
*out = *in
|
|
||||||
out.Ref = in.Ref
|
|
||||||
out.Spec = in.Spec
|
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSessionRef.
|
|
||||||
func (in *BackupSessionRef) DeepCopy() *BackupSessionRef {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BackupSessionRef)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *BackupSessionSpec) DeepCopyInto(out *BackupSessionSpec) {
|
func (in *BackupSessionSpec) DeepCopyInto(out *BackupSessionSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
out.Ref = in.Ref
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSessionSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSessionSpec.
|
||||||
@ -455,7 +436,7 @@ func (in *RestoreSession) DeepCopyInto(out *RestoreSession) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
out.Spec = in.Spec
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +493,6 @@ func (in *RestoreSessionList) DeepCopyObject() runtime.Object {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *RestoreSessionSpec) DeepCopyInto(out *RestoreSessionSpec) {
|
func (in *RestoreSessionSpec) DeepCopyInto(out *RestoreSessionSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
in.BackupSessionRef.DeepCopyInto(&out.BackupSessionRef)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreSessionSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreSessionSpec.
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func (r *BackupSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
|||||||
backupConf := &formolv1alpha1.BackupConfiguration{}
|
backupConf := &formolv1alpha1.BackupConfiguration{}
|
||||||
if err := r.Get(ctx, client.ObjectKey{
|
if err := r.Get(ctx, client.ObjectKey{
|
||||||
Namespace: backupSession.Namespace,
|
Namespace: backupSession.Namespace,
|
||||||
Name: backupSession.Spec.Ref.Name,
|
Name: backupSession.Spec.Ref,
|
||||||
}, backupConf); err != nil {
|
}, backupConf); err != nil {
|
||||||
log.Error(err, "unable to get backupConfiguration")
|
log.Error(err, "unable to get backupConfiguration")
|
||||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||||
@ -281,7 +281,7 @@ func (r *BackupSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
|||||||
monthlyBackups.Counter = backupConf.Spec.Keep.Monthly
|
monthlyBackups.Counter = backupConf.Spec.Keep.Monthly
|
||||||
yearlyBackups.Counter = backupConf.Spec.Keep.Yearly
|
yearlyBackups.Counter = backupConf.Spec.Keep.Yearly
|
||||||
for _, session := range backupSessionList.Items {
|
for _, session := range backupSessionList.Items {
|
||||||
if session.Spec.Ref.Name != backupConf.Name {
|
if session.Spec.Ref != backupConf.Name {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
deleteSession := true
|
deleteSession := true
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
//corev1 "k8s.io/api/core/v1"
|
//corev1 "k8s.io/api/core/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
)
|
)
|
||||||
@ -30,9 +29,7 @@ var _ = Describe("Testing BackupSession controller", func() {
|
|||||||
Namespace: TestNamespace,
|
Namespace: TestNamespace,
|
||||||
},
|
},
|
||||||
Spec: formolv1alpha1.BackupSessionSpec{
|
Spec: formolv1alpha1.BackupSessionSpec{
|
||||||
Ref: corev1.ObjectReference{
|
Ref: TestBackupConfName,
|
||||||
Name: TestBackupConfName,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import (
|
|||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
@ -61,31 +60,20 @@ func (r *RestoreSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||||||
log.Error(err, "unable to get restoresession")
|
log.Error(err, "unable to get restoresession")
|
||||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||||
}
|
}
|
||||||
log.V(1).Info("got restoresession", "restoreSession", restoreSession)
|
|
||||||
// Get the BackupSession the RestoreSession references
|
// Get the BackupSession the RestoreSession references
|
||||||
backupSession := &formolv1alpha1.BackupSession{}
|
backupSession := &formolv1alpha1.BackupSession{}
|
||||||
if err := r.Get(ctx, client.ObjectKey{
|
if err := r.Get(ctx, client.ObjectKey{
|
||||||
Namespace: restoreSession.Namespace,
|
Namespace: restoreSession.Namespace,
|
||||||
Name: restoreSession.Spec.BackupSessionRef.Ref.Name,
|
Name: restoreSession.Spec.Ref}, backupSession); err != nil {
|
||||||
}, backupSession); err != nil {
|
|
||||||
if errors.IsNotFound(err) {
|
|
||||||
backupSession = &formolv1alpha1.BackupSession{
|
|
||||||
Spec: restoreSession.Spec.BackupSessionRef.Spec,
|
|
||||||
Status: restoreSession.Spec.BackupSessionRef.Status,
|
|
||||||
}
|
|
||||||
log.V(1).Info("generated backupsession", "backupsession", backupSession)
|
|
||||||
} else {
|
|
||||||
log.Error(err, "unable to get backupsession", "restoresession", restoreSession.Spec)
|
log.Error(err, "unable to get backupsession", "restoresession", restoreSession.Spec)
|
||||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Get the BackupConfiguration linked to the BackupSession
|
// Get the BackupConfiguration linked to the BackupSession
|
||||||
backupConf := &formolv1alpha1.BackupConfiguration{}
|
backupConf := &formolv1alpha1.BackupConfiguration{}
|
||||||
if err := r.Get(ctx, client.ObjectKey{
|
if err := r.Get(ctx, client.ObjectKey{
|
||||||
Namespace: backupSession.Spec.Ref.Namespace,
|
Namespace: backupSession.Namespace,
|
||||||
Name: backupSession.Spec.Ref.Name,
|
Name: backupSession.Spec.Ref}, backupConf); err != nil {
|
||||||
}, backupConf); err != nil {
|
log.Error(err, "unable to get backupConfiguration")
|
||||||
log.Error(err, "unable to get backupConfiguration", "name", backupSession.Spec.Ref, "namespace", backupSession.Namespace)
|
|
||||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,9 +229,12 @@ func (r *RestoreSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var snapshotId string
|
||||||
for _, targetStatus := range backupSession.Status.Targets {
|
for _, targetStatus := range backupSession.Status.Targets {
|
||||||
if targetStatus.Name == target.Name && targetStatus.Kind == target.Kind {
|
if targetStatus.Name == target.Name && targetStatus.Kind == target.Kind {
|
||||||
snapshotId := targetStatus.SnapshotId
|
snapshotId = targetStatus.SnapshotId
|
||||||
|
}
|
||||||
|
}
|
||||||
restoreSessionEnv := []corev1.EnvVar{
|
restoreSessionEnv := []corev1.EnvVar{
|
||||||
corev1.EnvVar{
|
corev1.EnvVar{
|
||||||
Name: formolv1alpha1.TARGET_NAME,
|
Name: formolv1alpha1.TARGET_NAME,
|
||||||
@ -284,9 +275,6 @@ func (r *RestoreSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
startNextTask := func() (*formolv1alpha1.TargetStatus, error) {
|
startNextTask := func() (*formolv1alpha1.TargetStatus, error) {
|
||||||
nextTarget := len(restoreSession.Status.Targets)
|
nextTarget := len(restoreSession.Status.Targets)
|
||||||
@ -345,7 +333,7 @@ func (r *RestoreSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case formolv1alpha1.Running:
|
case formolv1alpha1.Running:
|
||||||
currentTargetStatus := &restoreSession.Status.Targets[len(restoreSession.Status.Targets)-1]
|
currentTargetStatus := restoreSession.Status.Targets[len(restoreSession.Status.Targets)-1]
|
||||||
switch currentTargetStatus.SessionState {
|
switch currentTargetStatus.SessionState {
|
||||||
case formolv1alpha1.Failure:
|
case formolv1alpha1.Failure:
|
||||||
log.V(0).Info("last restore task failed. Stop here", "target", currentTargetStatus.Name)
|
log.V(0).Info("last restore task failed. Stop here", "target", currentTargetStatus.Name)
|
||||||
@ -357,32 +345,6 @@ func (r *RestoreSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
|
|||||||
case formolv1alpha1.Running:
|
case formolv1alpha1.Running:
|
||||||
log.V(0).Info("task is still running", "target", currentTargetStatus.Name)
|
log.V(0).Info("task is still running", "target", currentTargetStatus.Name)
|
||||||
return ctrl.Result{}, nil
|
return ctrl.Result{}, nil
|
||||||
case formolv1alpha1.Waiting:
|
|
||||||
target := backupConf.Spec.Targets[len(restoreSession.Status.Targets)-1]
|
|
||||||
if target.Kind == formolv1alpha1.SidecarKind {
|
|
||||||
deployment := &appsv1.Deployment{}
|
|
||||||
if err := r.Get(context.Background(), client.ObjectKey{
|
|
||||||
Namespace: restoreSession.Namespace,
|
|
||||||
Name: target.Name,
|
|
||||||
}, deployment); err != nil {
|
|
||||||
log.Error(err, "unable to get deployment")
|
|
||||||
return ctrl.Result{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if deployment.Status.ReadyReplicas == *deployment.Spec.Replicas {
|
|
||||||
log.V(0).Info("The deployment is ready. We can resume the backup")
|
|
||||||
currentTargetStatus.SessionState = formolv1alpha1.Finalize
|
|
||||||
if err := r.Status().Update(ctx, restoreSession); err != nil {
|
|
||||||
log.Error(err, "unable to update restoresession")
|
|
||||||
return ctrl.Result{}, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.V(0).Info("Waiting for the sidecar to come back")
|
|
||||||
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.V(0).Info("not a SidecarKind. Ignoring Waiting")
|
|
||||||
}
|
|
||||||
case formolv1alpha1.Success:
|
case formolv1alpha1.Success:
|
||||||
_ = endTask()
|
_ = endTask()
|
||||||
log.V(0).Info("last task was a success. start a new one", "target", currentTargetStatus)
|
log.V(0).Info("last task was a success. start a new one", "target", currentTargetStatus)
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import (
|
|||||||
formolv1alpha1 "github.com/desmo999r/formol/api/v1alpha1"
|
formolv1alpha1 "github.com/desmo999r/formol/api/v1alpha1"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
)
|
)
|
||||||
@ -29,11 +28,7 @@ var _ = Describe("Testing RestoreSession controller", func() {
|
|||||||
Namespace: TestNamespace,
|
Namespace: TestNamespace,
|
||||||
},
|
},
|
||||||
Spec: formolv1alpha1.RestoreSessionSpec{
|
Spec: formolv1alpha1.RestoreSessionSpec{
|
||||||
BackupSessionRef: formolv1alpha1.BackupSessionRef{
|
Ref: TestBackupSessionName,
|
||||||
Ref: corev1.ObjectReference{
|
|
||||||
Name: TestBackupSessionName,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -218,10 +218,7 @@ var (
|
|||||||
Namespace: TestNamespace,
|
Namespace: TestNamespace,
|
||||||
},
|
},
|
||||||
Spec: formolv1alpha1.BackupSessionSpec{
|
Spec: formolv1alpha1.BackupSessionSpec{
|
||||||
Ref: corev1.ObjectReference{
|
Ref: TestBackupConfName,
|
||||||
Name: TestBackupConfName,
|
|
||||||
Namespace: TestNamespace,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -75,16 +75,6 @@ spec:
|
|||||||
---
|
---
|
||||||
apiVersion: formol.desmojim.fr/v1alpha1
|
apiVersion: formol.desmojim.fr/v1alpha1
|
||||||
kind: Function
|
kind: Function
|
||||||
metadata:
|
|
||||||
name: restore-pg
|
|
||||||
namespace: demo
|
|
||||||
spec:
|
|
||||||
name: restore-pg
|
|
||||||
image: desmo999r/formolcli:latest
|
|
||||||
args: ["postgres", "restore", "--hostname", $(PGHOST), "--database", $(PGDATABASE), "--username", $(PGUSER), "--password", $(PGPASSWD), "--file", "/output/backup-pg.sql"]
|
|
||||||
---
|
|
||||||
apiVersion: formol.desmojim.fr/v1alpha1
|
|
||||||
kind: Function
|
|
||||||
metadata:
|
metadata:
|
||||||
name: backup-pg
|
name: backup-pg
|
||||||
namespace: demo
|
namespace: demo
|
||||||
@ -92,21 +82,3 @@ spec:
|
|||||||
name: backup-pg
|
name: backup-pg
|
||||||
image: desmo999r/formolcli:latest
|
image: desmo999r/formolcli:latest
|
||||||
args: ["postgres", "backup", "--hostname", $(PGHOST), "--database", $(PGDATABASE), "--username", $(PGUSER), "--password", $(PGPASSWD), "--file", "/output/backup-pg.sql"]
|
args: ["postgres", "backup", "--hostname", $(PGHOST), "--database", $(PGDATABASE), "--username", $(PGUSER), "--password", $(PGPASSWD), "--file", "/output/backup-pg.sql"]
|
||||||
---
|
|
||||||
apiVersion: formol.desmojim.fr/v1alpha1
|
|
||||||
kind: Function
|
|
||||||
metadata:
|
|
||||||
name: maintenance-off
|
|
||||||
namespace: demo
|
|
||||||
spec:
|
|
||||||
name: maintenance-off
|
|
||||||
command: ["/bin/bash", "-c", "echo $(date +%Y/%m/%d-%H:%M:%S) maintenance-off >> /data/logs.txt"]
|
|
||||||
---
|
|
||||||
apiVersion: formol.desmojim.fr/v1alpha1
|
|
||||||
kind: Function
|
|
||||||
metadata:
|
|
||||||
name: maintenance-on
|
|
||||||
namespace: demo
|
|
||||||
spec:
|
|
||||||
name: maintenance-on
|
|
||||||
command: ["/bin/bash", "-c", "echo $(date +%Y/%m/%d-%H:%M:%S) maintenance-on >> /data/logs.txt"]
|
|
||||||
|
|||||||
@ -11,10 +11,6 @@ spec:
|
|||||||
- kind: Sidecar
|
- kind: Sidecar
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
name: nginx-deployment
|
name: nginx-deployment
|
||||||
steps:
|
|
||||||
- name: maintenance-on
|
|
||||||
- name: maintenance-off
|
|
||||||
finalize: true
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: demo-data
|
- name: demo-data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
apiVersion: formol.desmojim.fr/v1alpha1
|
|
||||||
kind: RestoreSession
|
|
||||||
metadata:
|
|
||||||
namespace: demo
|
|
||||||
name: restore-demo
|
|
||||||
spec:
|
|
||||||
backupSession:
|
|
||||||
ref:
|
|
||||||
name: backupsession-backup-demo-1619904678
|
|
||||||
namespace: demo
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user