controller-runtime: Index | Files

package certwatcher

import ""


Package Files


type CertWatcher Uses

type CertWatcher struct {
    // contains filtered or unexported fields

CertWatcher watches certificate and key files for changes. When either file changes, it reads and parses both and calls an optional callback with the new certificate.

func New Uses

func New(certPath, keyPath string) (*CertWatcher, error)

New returns a new CertWatcher watching the given certificate and key.

func (*CertWatcher) GetCertificate Uses

func (cw *CertWatcher) GetCertificate(_ *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate fetches the currently loaded certificate, which may be nil.

func (*CertWatcher) ReadCertificate Uses

func (cw *CertWatcher) ReadCertificate() error

ReadCertificate reads the certificate and key files from disk, parses them, and updates the current certificate on the watcher. If a callback is set, it is invoked with the new certificate.

func (*CertWatcher) Start Uses

func (cw *CertWatcher) Start(stopCh <-chan struct{}) error

Start starts the watch on the certificate and key files.

func (*CertWatcher) Watch Uses

func (cw *CertWatcher) Watch()

Watch reads events from the watcher's channel and reacts to changes.

Package certwatcher imports 4 packages (graph) and is imported by 2 packages. Updated 2019-07-17. Refresh now. Tools for package owners.