When using the bootstrap cert, update the store

Otherwise, the certificate store will return nil the first time a store
cert is accessed. When background rotation is being used, prevents the
client from being nil.
This commit is contained in:
Clayton Coleman 2018-02-04 01:24:56 -05:00
parent 0346145615
commit b81f474554
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3

View File

@ -268,6 +268,13 @@ func getCurrentCertificateOrBootstrap(
return nil, false, fmt.Errorf("unable to parse certificate data: %v", err)
}
bootstrapCert.Leaf = certs[0]
if _, err := store.Update(bootstrapCertificatePEM, bootstrapKeyPEM); err != nil {
utilruntime.HandleError(fmt.Errorf("Unable to set the cert/key pair to the bootstrap certificate: %v", err))
} else {
glog.V(4).Infof("Updated the store to contain the initial bootstrap certificate")
}
return &bootstrapCert, true, nil
}