Skip to content

Commit

Permalink
more debug cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevcich committed Jan 29, 2024
1 parent b398fbe commit cda5204
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions internal/controller/lustrefilesystem_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ 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 {
log.FromContext(ctx).Info("NOT FOUND")
return ctrl.Result{}, client.IgnoreNotFound(err)
}

Expand Down Expand Up @@ -137,7 +134,6 @@ 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("Reconcile Spec Namespace", "namespace", namespace)
namespacePresent := true

// If the namespace doesn't exist, set a flag so that we can appropriately set the status in the mode loop
Expand All @@ -151,10 +147,8 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req
fs.Status.Namespaces = make(map[string]lusv1beta1.LustreFileSystemNamespaceStatus)
}

// For each mode in the namespace
// For each mode listed for the namespace
for _, mode := range fs.Spec.Namespaces[namespace].Modes {
// log.FromContext(ctx).Info("Processing Spec Namespace Mode", "mode", mode)

// Create the Status Namespace Mode map if empty
if fs.Status.Namespaces[namespace].Modes == nil {
fs.Status.Namespaces[namespace] = lusv1beta1.LustreFileSystemNamespaceStatus{
Expand All @@ -169,7 +163,6 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req

// If the namespace is not present or is not active, continue on and the status will be marked as Pending
if !namespacePresent || ns.Status.Phase != corev1.NamespaceActive {
log.FromContext(ctx).Info("Namespace does not exist or is not active, skipping...", "namespace", namespace)
continue
}

Expand Down Expand Up @@ -200,11 +193,7 @@ func (r *LustreFileSystemReconciler) Reconcile(ctx context.Context, req ctrl.Req

// Remove any resources that are not in the spec
for namespace := range fs.Status.Namespaces {
// log.FromContext(ctx).Info("Reconcile Status Namespace", "namespace", namespace)

for mode := range fs.Status.Namespaces[namespace].Modes {
// log.FromContext(ctx).Info("Processing Status Namespace Mode", "mode", mode)

// Check if the provided namespace and mode are present in the specification
isPresentInSpec := func(namespace string, mode corev1.PersistentVolumeAccessMode) bool {
if ns, found := fs.Spec.Namespaces[namespace]; found {
Expand Down Expand Up @@ -368,6 +357,7 @@ func (r *LustreFileSystemReconciler) deleteAccess(ctx context.Context, fs *lusv1
return nil
}

// For a change with any namespace, we need to go through the list of all the lustrefilesystem resources
func (r *LustreFileSystemReconciler) getLustreFileSystemsHandler(ctx context.Context, o client.Object) []reconcile.Request {
var res []reconcile.Request

Expand Down

0 comments on commit cda5204

Please sign in to comment.