monitor

package
v0.0.0-...-9e50629 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificateInfo

type CertificateInfo struct {
	// Name of the certificate in k8s
	Name string
	// Namespace where the certificate is defined
	Namespace string
	// Expiration defines the timestamp of when the certificate will expire in nanoseconds since the epoch
	Expiration int64
}

CertificateInfo contains the name, namespace and the expiration of a certificate declared in k8s

type CertificateInfoGatherer

type CertificateInfoGatherer interface {
	GatherCertificateInfos(ctx context.Context) ([]CertificateInfo, error)
}

CertificateInfoGatherer collects information about the certificates defined in k8s

func NewKubernetesCertificateInfoGatherer

func NewKubernetesCertificateInfoGatherer(logger *zap.SugaredLogger, clientSet certmanager.Interface, cfg GathererConfig) CertificateInfoGatherer

type CertificateMonitor

type CertificateMonitor struct {
	// contains filtered or unexported fields
}

TODO:doc

func NewCertificateMonitor

func NewCertificateMonitor(logger *zap.SugaredLogger, gatherer CertificateInfoGatherer, notifier alert.Notifier, clock Clock, threshold time.Duration) *CertificateMonitor

func (*CertificateMonitor) CheckCertificates

func (cm *CertificateMonitor) CheckCertificates(ctx context.Context) error

type Clock

type Clock interface {
	Now() int64
}

TODO:doc

type Config

type Config struct {
	// Threshold defines the duration for which a certificate is not considered as close to expiration. For example,
	// if a certificate is valid for the next 20 days but the threshold is set to 30 days, it is considered as close to
	// expiration.
	Threshold time.Duration `yaml:"threshold"`
	// GathererConfig contains the configuration for fetching the certificate info
	GathererConfig GathererConfig `yaml:"gatherer"`
}

Config contains the configuration for the monitor

type GathererConfig

type GathererConfig struct {
	// PageSize defines the page size when calling the list certificate API
	PageSize int64 `yaml:"page_size"`
	// Timeout defines the timeout to fetch a page
	Timeout time.Duration `yaml:"timeout"`
}

GathererConfig contains the configuration for fetching the certificate info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL