38 lines
933 B
Go
38 lines
933 B
Go
package controllers
|
|
|
|
import (
|
|
"context"
|
|
formolv1alpha1 "github.com/desmo999r/formol/api/v1alpha1"
|
|
"k8s.io/apimachinery/pkg/api/errors"
|
|
ctrl "sigs.k8s.io/controller-runtime"
|
|
"sigs.k8s.io/controller-runtime/pkg/log"
|
|
)
|
|
|
|
type RestoreSessionReconciler struct {
|
|
Session
|
|
}
|
|
|
|
func (r *RestoreSessionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
|
r.Log = log.FromContext(ctx)
|
|
r.Context = ctx
|
|
|
|
restoreSession := formolv1alpha1.RestoreSession{}
|
|
err := r.Get(r.Context, req.NamespacedName, &restoreSession)
|
|
if err != nil {
|
|
if errors.IsNotFound(err) {
|
|
return ctrl.Result{}, nil
|
|
}
|
|
return ctrl.Result{}, err
|
|
}
|
|
switch restoreSession.Status.SessionState {
|
|
case formolv1alpha1.New:
|
|
}
|
|
return ctrl.Result{}, nil
|
|
}
|
|
|
|
func (r *RestoreSessionReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|
return ctrl.NewControllerManagedBy(mgr).
|
|
For(&formolv1alpha1.RestoreSession{}).
|
|
Complete(r)
|
|
}
|