Skip to content

Commit

Permalink
Merge pull request #136 from topolvm/stop-logging-createOrUpdateJob
Browse files Browse the repository at this point in the history
stop logging of createOrUpdateJob
  • Loading branch information
ushitora-anqou authored Oct 9, 2024
2 parents 2de6460 + e612334 commit 6100e49
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions internal/controller/pie/pieprobe_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,15 @@ func (r *PieProbeReconciler) createOrUpdateJob(
pieProbe *piev1alpha1.PieProbe,
nodeName *string,
) error {
logger := log.FromContext(ctx)
logger.Info("createOrUpdateJob")
defer logger.Info("createOrUpdateJob Finished")
_ = log.FromContext(ctx)

cronjob := &batchv1.CronJob{}
cronjob.SetNamespace(pieProbe.GetNamespace())
cronjob.SetName(getCronJobName(kind, nodeName, pieProbe))

storageClass := pieProbe.Spec.MonitoringStorageClass

op, err := ctrl.CreateOrUpdate(ctx, r.client, cronjob, func() error {
_, err := ctrl.CreateOrUpdate(ctx, r.client, cronjob, func() error {
label := map[string]string{
constants.ProbeStorageClassLabelKey: storageClass,
constants.ProbePieProbeLabelKey: pieProbe.GetName(),
Expand Down Expand Up @@ -491,9 +489,7 @@ func (r *PieProbeReconciler) createOrUpdateJob(
if err != nil {
return fmt.Errorf("failed to create CronJob: %s", getCronJobName(kind, nodeName, pieProbe))
}
if op != controllerutil.OperationResultNone {
logger.Info(fmt.Sprintf("CronJob successfully created: %s", getCronJobName(kind, nodeName, pieProbe)))
}

return nil
}

Expand Down

0 comments on commit 6100e49

Please sign in to comment.