Merge pull request #54426 from mikedanese/csr1

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

certs: remove always nil error from New signature

```release-note-none
```
pull/6/head
Kubernetes Submit Queue 2017-10-23 14:36:18 -07:00 committed by GitHub
commit 9b8d70dc42
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 {