From c9ac06a0dbddbab3cd923918d3f2e38e55f3b422 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 25 Mar 2021 16:48:08 +0000 Subject: [PATCH] Reconcile has a new signature Signed-off-by: Richard Wall --- internal/controllers/certificaterequest_controller.go | 3 +-- internal/controllers/certificaterequest_controller_test.go | 2 +- internal/controllers/issuer_controller.go | 3 +-- internal/controllers/issuer_controller_test.go | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/controllers/certificaterequest_controller.go b/internal/controllers/certificaterequest_controller.go index 44234f3..0e23c77 100644 --- a/internal/controllers/certificaterequest_controller.go +++ b/internal/controllers/certificaterequest_controller.go @@ -58,8 +58,7 @@ type CertificateRequestReconciler struct { // +kubebuilder:rbac:groups=cert-manager.io,resources=certificaterequests/status,verbs=get;update;patch // +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch -func (r *CertificateRequestReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) { - ctx := context.Background() +func (r *CertificateRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) { log := r.Log.WithValues("certificaterequest", req.NamespacedName) // Get the CertificateRequest diff --git a/internal/controllers/certificaterequest_controller_test.go b/internal/controllers/certificaterequest_controller_test.go index 0350da2..5856bd8 100644 --- a/internal/controllers/certificaterequest_controller_test.go +++ b/internal/controllers/certificaterequest_controller_test.go @@ -437,7 +437,7 @@ func TestCertificateRequestReconcile(t *testing.T) { ClusterResourceNamespace: tc.clusterResourceNamespace, SignerBuilder: tc.signerBuilder, } - result, err := controller.Reconcile(reconcile.Request{NamespacedName: tc.name}) + result, err := controller.Reconcile(context.TODO(), reconcile.Request{NamespacedName: tc.name}) if tc.expectedError != nil { assertErrorIs(t, tc.expectedError, err) } else { diff --git a/internal/controllers/issuer_controller.go b/internal/controllers/issuer_controller.go index 51adaa6..e7a08bb 100644 --- a/internal/controllers/issuer_controller.go +++ b/internal/controllers/issuer_controller.go @@ -65,8 +65,7 @@ func (r *IssuerReconciler) newIssuer() (runtime.Object, error) { return r.Scheme.New(issuerGVK) } -func (r *IssuerReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) { - ctx := context.Background() +func (r *IssuerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) { log := r.Log.WithValues("issuer", req.NamespacedName) issuer, err := r.newIssuer() diff --git a/internal/controllers/issuer_controller_test.go b/internal/controllers/issuer_controller_test.go index 7b3d432..d6e6feb 100644 --- a/internal/controllers/issuer_controller_test.go +++ b/internal/controllers/issuer_controller_test.go @@ -239,7 +239,7 @@ func TestIssuerReconcile(t *testing.T) { HealthCheckerBuilder: tc.healthCheckerBuilder, ClusterResourceNamespace: tc.clusterResourceNamespace, } - result, err := controller.Reconcile(reconcile.Request{NamespacedName: tc.name}) + result, err := controller.Reconcile(context.TODO(), reconcile.Request{NamespacedName: tc.name}) if tc.expectedError != nil { assertErrorIs(t, tc.expectedError, err) } else {