From 5aee38858b0011d61ffc6868ebf6f490134858de Mon Sep 17 00:00:00 2001 From: Max Shaposhnyk Date: Mon, 20 May 2024 19:24:20 +0300 Subject: [PATCH] Fixups Signed-off-by: Max Shaposhnyk --- controllers/imagerepository_controller.go | 6 +++--- controllers/imagerepository_controller_test.go | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/imagerepository_controller.go b/controllers/imagerepository_controller.go index f83217b..414307b 100644 --- a/controllers/imagerepository_controller.go +++ b/controllers/imagerepository_controller.go @@ -388,7 +388,7 @@ func (r *ImageRepositoryReconciler) ProvisionImageRepositoryAccess(ctx context.C } secretName := getSecretName(imageRepository, isPullOnly) - if err := r.EnsureSecret(ctx, imageRepository, secretName, isPullOnly, robotAccount, quayImageURL); err != nil { + if err := r.EnsureSecret(ctx, imageRepository, secretName, robotAccount, quayImageURL, isPullOnly); err != nil { return nil, err } @@ -451,7 +451,7 @@ func (r *ImageRepositoryReconciler) RegenerateImageRepositoryAccessToken(ctx con if isPullOnly { secretName = imageRepository.Status.Credentials.PullSecretName } - if err := r.EnsureSecret(ctx, imageRepository, secretName, isPullOnly, robotAccount, quayImageURL); err != nil { + if err := r.EnsureSecret(ctx, imageRepository, secretName, robotAccount, quayImageURL, isPullOnly); err != nil { return err } return nil @@ -535,7 +535,7 @@ func (r *ImageRepositoryReconciler) ChangeImageRepositoryVisibility(ctx context. return err } -func (r *ImageRepositoryReconciler) EnsureSecret(ctx context.Context, imageRepository *imagerepositoryv1alpha1.ImageRepository, secretName string, isPull bool, robotAccount *quay.RobotAccount, imageURL string) error { +func (r *ImageRepositoryReconciler) EnsureSecret(ctx context.Context, imageRepository *imagerepositoryv1alpha1.ImageRepository, secretName string, robotAccount *quay.RobotAccount, imageURL string, isPull bool) error { log := ctrllog.FromContext(ctx).WithValues("RemoteSecretName", secretName) secret := &corev1.Secret{} diff --git a/controllers/imagerepository_controller_test.go b/controllers/imagerepository_controller_test.go index f7030b4..e526b2f 100644 --- a/controllers/imagerepository_controller_test.go +++ b/controllers/imagerepository_controller_test.go @@ -155,7 +155,6 @@ var _ = Describe("Image repository controller", func() { regenerateToken := true imageRepository.Spec.Credentials = &imagerepositoryv1alpha1.ImageCredentials{RegenerateToken: ®enerateToken} Expect(k8sClient.Update(ctx, imageRepository)).To(Succeed()) - //defer deleteSecret(uploadSecretKey) Eventually(func() bool { return isRegenerateRobotAccountTokenInvoked }, timeout, interval).Should(BeTrue()) Eventually(func() bool {