From 8214cb4b7057907e043c45258c507f9e4714e82d Mon Sep 17 00:00:00 2001 From: JoshVanL Date: Mon, 18 May 2020 17:44:36 +0100 Subject: [PATCH] Initialise new metrics implementation and pass through new instrumented ACME client Factory Signed-off-by: JoshVanL --- cmd/controller/app/controller.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/controller/app/controller.go b/cmd/controller/app/controller.go index 65129a695..ec32696c0 100644 --- a/cmd/controller/app/controller.go +++ b/cmd/controller/app/controller.go @@ -79,7 +79,7 @@ func Run(opts *options.ControllerOptions, stopCh <-chan struct{}) { go func() { defer wg.Done() - metrics.Default.Start(stopCh) + ctx.Metrics.Start(stopCh) }() var experimentalCertificateControllers = []string{ @@ -225,6 +225,11 @@ func buildControllerContext(ctx context.Context, stopCh <-chan struct{}, opts *o sharedInformerFactory := informers.NewSharedInformerFactoryWithOptions(intcl, time.Second*30, informers.WithNamespace(opts.Namespace)) kubeSharedInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(cl, time.Second*30, kubeinformers.WithNamespace(opts.Namespace)) + + metrics := metrics.New(log) + acmeAccountFactory := accounts.NewDefaultFactory(metrics) + acmeAccountRegistry := accounts.NewDefaultRegistry(acmeAccountFactory) + return &controller.Context{ RootContext: ctx, StopCh: stopCh, @@ -236,6 +241,7 @@ func buildControllerContext(ctx context.Context, stopCh <-chan struct{}, opts *o SharedInformerFactory: sharedInformerFactory, Namespace: opts.Namespace, Clock: clock.RealClock{}, + Metrics: metrics, ACMEOptions: controller.ACMEOptions{ HTTP01SolverImage: opts.ACMEHTTP01SolverImage, HTTP01SolverResourceRequestCPU: HTTP01SolverResourceRequestCPU, @@ -244,7 +250,8 @@ func buildControllerContext(ctx context.Context, stopCh <-chan struct{}, opts *o HTTP01SolverResourceLimitsMemory: HTTP01SolverResourceLimitsMemory, DNS01CheckAuthoritative: !opts.DNS01RecursiveNameserversOnly, DNS01Nameservers: nameservers, - AccountRegistry: accounts.NewDefaultRegistry(), + AccountFactory: acmeAccountFactory, + AccountRegistry: acmeAccountRegistry, }, IssuerOptions: controller.IssuerOptions{ ClusterIssuerAmbientCredentials: opts.ClusterIssuerAmbientCredentials,