Interrupt WaitForCertificate if desired kubelet serving cert changes

This commit is contained in:
Jordan Liggitt
2019-05-15 11:47:23 -04:00
parent 8ae998ceb6
commit 739a75fc32
4 changed files with 41 additions and 16 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package renewal
import (
"context"
"crypto"
"crypto/x509"
"crypto/x509/pkix"
@@ -97,7 +98,10 @@ func (r *APIRenewer) Renew(cfg *certutil.Config) (*x509.Certificate, crypto.Sign
fmt.Printf("[certs] Certificate request %q created\n", req.Name)
certData, err := csrutil.WaitForCertificate(r.client.CertificateSigningRequests(), req, watchTimeout)
ctx, cancel := context.WithTimeout(context.Background(), watchTimeout)
defer cancel()
certData, err := csrutil.WaitForCertificate(ctx, r.client.CertificateSigningRequests(), req)
if err != nil {
return nil, nil, errors.Wrap(err, "certificate failed to appear")
}