Skip to content

Commit

Permalink
Improve logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
inelpandzic committed Apr 7, 2024
1 parent 53e9816 commit 11e7484
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/psmdb/v1/psmdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ func (cr *PerconaServerMongoDB) MongosNamespacedName() types.NamespacedName {
}

func (cr *PerconaServerMongoDB) CanBackup(ctx context.Context) error {
logf.FromContext(ctx).Info("checking if backup is allowed", "backup", cr.Name)
logf.FromContext(ctx).V(1).Info("checking if backup is allowed", "backup", cr.Name)

if cr.Spec.Unmanaged {
return errors.Errorf("backups are not allowed on unmanaged clusters")
Expand Down
22 changes: 11 additions & 11 deletions pkg/controller/perconaservermongodbbackup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ func (b *Backup) Start(ctx context.Context, k8sclient client.Client, cluster *ap
compLevel = &l
}

bcp := &ctrl.BackupCmd{
Name: name,
Type: cr.Spec.Type,
Compression: cr.Spec.Compression,
CompressionLevel: compLevel,
}
log.Info("Sending backup command", "backup", bcp)
err = b.pbm.SendCmd(ctx, ctrl.Cmd{
Cmd: ctrl.CmdBackup,
Backup: bcp,
})
cmd := ctrl.Cmd{
Cmd: ctrl.CmdBackup,
Backup: &ctrl.BackupCmd{
Name: name,
Type: cr.Spec.Type,
Compression: cr.Spec.Compression,
CompressionLevel: compLevel,
},
}
log.Info("Sending backup command", "backupCmd", cmd)
err = b.pbm.SendCmd(ctx, cmd)
if err != nil {
return status, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/psmdb/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewRestoreJob(cr *api.PerconaServerMongoDBRestore) Job {
// in given cluster and namespace
func HasActiveJobs(ctx context.Context, newPBMFunc NewPBMFunc, cl client.Client, cluster *api.PerconaServerMongoDB, current Job, allowLock ...LockHeaderPredicate) (bool, error) {
l := log.FromContext(ctx)
l.Info("Checking for active jobs", "currentJob", current)
l.V(1).Info("Checking for active jobs", "currentJob", current)

bcps := &api.PerconaServerMongoDBBackupList{}
err := cl.List(ctx,
Expand Down

0 comments on commit 11e7484

Please sign in to comment.