Small commit to start working on the Steps

This commit is contained in:
Jean-Marc ANDRE 2023-02-08 22:40:00 +01:00
parent 53369058b9
commit f3735e1409
2 changed files with 29 additions and 0 deletions

View File

@ -17,10 +17,12 @@ type BackupSessionReconciler struct {
client.Client
Log logr.Logger
Scheme *runtime.Scheme
context.Context
}
func (r *BackupSessionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
r.Log = log.FromContext(ctx)
r.Context = ctx
r.Log.V(0).Info("Enter Reconcile with req", "req", req)
backupSession := formolv1alpha1.BackupSession{}

View File

@ -0,0 +1,27 @@
package controllers
import (
formolv1alpha1 "github.com/desmo999r/formol/api/v1alpha1"
"os"
"sigs.k8s.io/controller-runtime/pkg/client"
)
func (r *BackupSessionReconciler) runInitBackupSteps(target formolv1alpha1.Target) error {
namespace := os.Getenv(formolv1alpha1.POD_NAMESPACE)
for _, container := range target.Containers {
for _, step := range container.Steps {
if step.Finalize != nil && *step.Finalize == true {
continue
}
function := formolv1alpha1.Function{}
if err := r.Get(r.Context, client.ObjectKey{
Namespace: namespace,
Name: step.Name,
}, &function); err != nil {
r.Log.Error(err, "unable to get Function", "Function", step.Name)
return err
}
}
}
return nil
}