Skip to content

Commit

Permalink
fix logging and position
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevcich committed Nov 8, 2023
1 parent e1a38d7 commit ae1d029
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions internal/controller/datamovementmanager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (r *NnfDataMovementManagerReconciler) Reconcile(ctx context.Context, req ct
return errorHandler(err, "check if daemonset is ready")
} else if !ready {
manager.Status.Ready = false
log.Info("daemonset not ready")
log.Info("Daemonset not ready")
return ctrl.Result{}, nil
}

Expand Down Expand Up @@ -489,6 +489,29 @@ func (r *NnfDataMovementManagerReconciler) createOrUpdateDaemonSetIfNecessary(ct
return nil
}

func (r *NnfDataMovementManagerReconciler) isDaemonSetReady(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) (bool, error) {
ds := &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: daemonsetName,
Namespace: manager.Namespace,
},
}
if err := r.Get(ctx, client.ObjectKeyFromObject(ds), ds); err != nil {
if apierrors.IsNotFound(err) {
return false, nil

}
return false, err
}

d := ds.Status.DesiredNumberScheduled
if ds.Status.ObservedGeneration != ds.ObjectMeta.Generation || ds.Status.UpdatedNumberScheduled != d || ds.Status.NumberReady != d {
return false, nil
}

return true, nil
}

func setupSSHAuthVolumes(manager *nnfv1alpha1.NnfDataMovementManager, podSpec *corev1.PodSpec) {
mode := int32(0600)
podSpec.Volumes = append(podSpec.Volumes, corev1.Volume{
Expand Down Expand Up @@ -605,26 +628,3 @@ func (r *NnfDataMovementManagerReconciler) SetupWithManager(mgr ctrl.Manager) er
).
Complete(r)
}

func (r *NnfDataMovementManagerReconciler) isDaemonSetReady(ctx context.Context, manager *nnfv1alpha1.NnfDataMovementManager) (bool, error) {
ds := &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: daemonsetName,
Namespace: manager.Namespace,
},
}
if err := r.Get(ctx, client.ObjectKeyFromObject(ds), ds); err != nil {
if apierrors.IsNotFound(err) {
return false, nil

}
return false, err
}

d := ds.Status.DesiredNumberScheduled
if ds.Status.ObservedGeneration != ds.ObjectMeta.Generation || ds.Status.UpdatedNumberScheduled != d || ds.Status.NumberReady != d {
return false, nil
}

return true, nil
}

0 comments on commit ae1d029

Please sign in to comment.