Skip to content

Commit 191bec9

Browse files
committed
Move context always to a first agument
Signed-off-by: Ales Raszka <[email protected]>
1 parent 6433a76 commit 191bec9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

controllers/backupcronjob/backupcronjob_controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,14 @@ func (r *BackupCronJobReconciler) createBackupJob(
293293
dwID := workspace.Status.DevWorkspaceId
294294
backUpConfig := dwOperatorConfig.Config.Workspace.BackupCronJob
295295

296-
registryAuthSecret, err := r.handleRegistryAuthSecret(workspace, ctx, dwOperatorConfig, log)
296+
registryAuthSecret, err := r.handleRegistryAuthSecret(ctx, workspace, dwOperatorConfig, log)
297297
if err != nil {
298298
log.Error(err, "Failed to handle registry auth secret for DevWorkspace", "devworkspace", workspace.Name)
299299
return err
300300
}
301301

302302
// Find a PVC with used by the workspace
303-
pvcName, workspacePath, err := r.getWorkspacePVCName(workspace, dwOperatorConfig, ctx, log)
303+
pvcName, workspacePath, err := r.getWorkspacePVCName(ctx, workspace, dwOperatorConfig, log)
304304
if err != nil {
305305
log.Error(err, "Failed to get workspace PVC name", "devworkspace", workspace.Name)
306306
return err
@@ -428,7 +428,7 @@ func (r *BackupCronJobReconciler) createBackupJob(
428428
}
429429

430430
// getWorkspacePVCName determines the PVC name and workspace path based on the storage provisioner used.
431-
func (r *BackupCronJobReconciler) getWorkspacePVCName(workspace *dw.DevWorkspace, dwOperatorConfig *controllerv1alpha1.DevWorkspaceOperatorConfig, ctx context.Context, log logr.Logger) (string, string, error) {
431+
func (r *BackupCronJobReconciler) getWorkspacePVCName(ctx context.Context, workspace *dw.DevWorkspace, dwOperatorConfig *controllerv1alpha1.DevWorkspaceOperatorConfig, log logr.Logger) (string, string, error) {
432432
config, err := wkspConfig.ResolveConfigForWorkspace(workspace, r.Client)
433433

434434
workspaceWithConfig := &common.DevWorkspaceWithConfig{}
@@ -453,8 +453,7 @@ func (r *BackupCronJobReconciler) getWorkspacePVCName(workspace *dw.DevWorkspace
453453
return "", "", nil
454454
}
455455

456-
func (r *BackupCronJobReconciler) handleRegistryAuthSecret(workspace *dw.DevWorkspace,
457-
ctx context.Context,
456+
func (r *BackupCronJobReconciler) handleRegistryAuthSecret(ctx context.Context, workspace *dw.DevWorkspace,
458457
dwOperatorConfig *controllerv1alpha1.DevWorkspaceOperatorConfig, log logr.Logger,
459458
) (*corev1.Secret, error) {
460459
if dwOperatorConfig.Config.Workspace.BackupCronJob.Registry.AuthSecret == "" {
@@ -489,12 +488,12 @@ func (r *BackupCronJobReconciler) handleRegistryAuthSecret(workspace *dw.DevWork
489488
return nil, err
490489
}
491490
log.Info("Successfully retrieved registry auth secret for backup job", "secretName", dwOperatorConfig.Config.Workspace.BackupCronJob.Registry.AuthSecret)
492-
return r.copySecret(workspace, ctx, registryAuthSecret, log)
491+
return r.copySecret(ctx, workspace, registryAuthSecret, log)
493492
}
494493
return nil, nil
495494
}
496495

497-
func (r *BackupCronJobReconciler) copySecret(workspace *dw.DevWorkspace, ctx context.Context, sourceSecret *corev1.Secret, log logr.Logger) (namespaceSecret *corev1.Secret, err error) {
496+
func (r *BackupCronJobReconciler) copySecret(ctx context.Context, workspace *dw.DevWorkspace, sourceSecret *corev1.Secret, log logr.Logger) (namespaceSecret *corev1.Secret, err error) {
498497
existingNamespaceSecret := &corev1.Secret{}
499498
err = r.NonCachingClient.Get(ctx, client.ObjectKey{
500499
Name: constants.DevWorkspaceBackupAuthSecretName,

0 commit comments

Comments
 (0)