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.

Kubernetes-commit: b81f4745546340f08abd3f877c585aac9581d0f0
This commit is contained in:
Clayton Coleman 2018-02-04 01:24:56 -05:00 committed by Kubernetes Publisher
parent 58d111d352
commit b30485cc03

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
}