Skip to content

Commit

Permalink
added debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevcich committed Jan 25, 2024
1 parent eb84599 commit e839083
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/controller/lustrefilesystem_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type LustreFileSystemReconciler struct {
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
log.FromContext(ctx).Info("reconciler start")

fs := &lusv1beta1.LustreFileSystem{}
if err := r.Get(ctx, req.NamespacedName, fs); err != nil {
Expand Down Expand Up @@ -130,12 +131,17 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req
// Iterate over the access modes in the specification. For each namespace in that mode
// create a PV/PVC which can be used by pods in the same namespace.
for namespace := range fs.Spec.Namespaces {
log.FromContext(ctx).Info("spec namespace loop start", "namespace", namespace)

if fs.Status.Namespaces == nil {
fs.Status.Namespaces = make(map[string]lusv1beta1.LustreFileSystemNamespaceStatus)
log.FromContext(ctx).Info("spec namespace loop status nil", "namespace", namespace)
} else {
log.FromContext(ctx).Info("spec namespace loop status list", "status.namespaces", fs.Status.Namespaces)
}

for _, mode := range fs.Spec.Namespaces[namespace].Modes {
log.FromContext(ctx).Info("spec namespace loop mode loop", "mode", mode)

if fs.Status.Namespaces[namespace].Modes == nil {
fs.Status.Namespaces[namespace] = lusv1beta1.LustreFileSystemNamespaceStatus{
Expand All @@ -147,6 +153,7 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req
fs.Status.Namespaces[namespace].Modes[mode] = lusv1beta1.LustreFileSystemNamespaceAccessStatus{
State: lusv1beta1.NamespaceAccessPending,
}
log.FromContext(ctx).Info("spec namespace loop mode loop state pending")
}

status := fs.Status.Namespaces[namespace].Modes[mode]
Expand All @@ -170,6 +177,8 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req
Name: pvc.Name,
},
}
} else {
log.FromContext(ctx).Info("spec namespace loop mode loop status is not ready", "state", status.State)
}
}
}
Expand Down

0 comments on commit e839083

Please sign in to comment.