certs: remove always nil error from New signature

pull/6/head
Mike Danese 2017-10-23 11:31:10 -07:00
parent 1213f9112b
commit 1181a88cf2
6 changed files with 7 additions and 19 deletions

View File

@ -77,14 +77,11 @@ func Run(s *GKECertificatesController) error {
return err
}
controller, err := certificates.NewCertificateController(
controller := certificates.NewCertificateController(
client,
sharedInformers.Certificates().V1beta1().CertificateSigningRequests(),
signer.handle,
)
if err != nil {
return err
}
sharedInformers.Start(nil)
controller.Run(5, nil) // runs forever

View File

@ -59,16 +59,10 @@ func startCSRApprovingController(ctx ControllerContext) (bool, error) {
return false, nil
}
approver, err := approver.NewCSRApprovingController(
approver := approver.NewCSRApprovingController(
ctx.ClientBuilder.ClientOrDie("certificate-controller"),
ctx.InformerFactory.Certificates().V1beta1().CertificateSigningRequests(),
)
if err != nil {
// TODO this is failing consistently in test-cmd and local-up-cluster.sh. Fix them and make it consistent with all others which
// cause a crash loop
glog.Errorf("Failed to start certificate controller: %v", err)
return false, nil
}
go approver.Run(1, ctx.Stop)
return true, nil

View File

@ -44,7 +44,7 @@ type sarApprover struct {
recognizers []csrRecognizer
}
func NewCSRApprovingController(client clientset.Interface, csrInformer certificatesinformers.CertificateSigningRequestInformer) (*certificates.CertificateController, error) {
func NewCSRApprovingController(client clientset.Interface, csrInformer certificatesinformers.CertificateSigningRequestInformer) *certificates.CertificateController {
approver := &sarApprover{
client: client,
recognizers: recognizers(),

View File

@ -53,7 +53,7 @@ func NewCertificateController(
kubeClient clientset.Interface,
csrInformer certificatesinformers.CertificateSigningRequestInformer,
handler func(*certificates.CertificateSigningRequest) error,
) (*CertificateController, error) {
) *CertificateController {
// Send events to the apiserver
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(glog.Infof)
@ -98,7 +98,7 @@ func NewCertificateController(
cc.csrLister = csrInformer.Lister()
cc.csrsSynced = csrInformer.Informer().HasSynced
cc.handler = handler
return cc, nil
return cc
}
// Run the main goroutine responsible for watching and syncing jobs.

View File

@ -54,14 +54,11 @@ func TestCertificateController(t *testing.T) {
return nil
}
controller, err := NewCertificateController(
controller := NewCertificateController(
client,
informerFactory.Certificates().V1beta1().CertificateSigningRequests(),
handler,
)
if err != nil {
t.Fatalf("error creating controller: %v", err)
}
controller.csrsSynced = func() bool { return true }
stopCh := make(chan struct{})

View File

@ -50,7 +50,7 @@ func NewCSRSigningController(
client,
csrInformer,
signer.handle,
)
), nil
}
type cfsslSigner struct {