Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogLevel_None = "LogLevel_None" LogLevel_Error = "LogLevel_Error" LogLevel_Warn = "LogLevel_Warn" LogLevel_Debug = "LogLevel_Debug" LogLevel_Info = "LogLevel_Info" LogLevel_DPanic = "LogLevel_DPanic" )
Variables ¶
View Source
var FilterKubeSystemConfigMap = predicate.SimplePredicate{ Filter: predicate.SimpleEventFilterFunc(func(obj metav1.Object) bool { _, ok := obj.(*v1.ConfigMap) if !ok { return false } return obj.GetNamespace() == "kube-system" }), }
predicate which filters configmaps in kube-system
View Source
var FilterLeaderElectionObject = predicate.SimplePredicate{ Filter: predicate.SimpleEventFilterFunc(func(obj metav1.Object) bool { _, isLeaderElectionObj := obj.GetAnnotations()["control-plane.alpha.kubernetes.io/leader"] return isLeaderElectionObj }), }
predicate which filters objects (configmaps) used for leader election
View Source
var FilterServiceAccountTokenSecret = predicate.SimplePredicate{ Filter: predicate.SimpleEventFilterFunc(func(obj metav1.Object) bool { sec, ok := obj.(*v1.Secret) if !ok { return false } return sec.Type == v1.SecretTypeServiceAccountToken }), }
predicate which filters service account token secrets
Functions ¶
Types ¶
type CustomCounter ¶
type CustomCounter struct { // opts for registering the counter. name must be unique Counter prometheus.CounterOpts // the set of keys for this counter's labels. each label key must have a matching value provided when the counter is incremented LabelKeys []string }
CustomCounter provides options for registering a custom counter with the recorder
type IncrementCustomCounter ¶
type IncrementCustomCounter struct { // name of the counter to increment. if it's not registered, nothing will happen CounterName string // the level of logging to use Level LogLevel // values corresponding to the regstered label keys. must match the label keys in length. LabelValues []string // an error if it occurred Err error }
IncrementCustomCounter provides options for incrementing a custom counter
type Recorder ¶
type Recorder interface { // RecordReconcileResult records the result of a reconcile RecordReconcileResult( ctx context.Context, input resource.ClusterSnapshot, output resource.ClusterSnapshot, success bool, ) // Registers a custom counter metric with the recorder. // If a counter with the given name has already been registered, this function is a no-op. RegisterCustomCounter(counter CustomCounter) // Increments the counter with the given name. // the number of label values for the counter should match exactly the number of label keys provided when registering the counter. IncrementCounter( ctx context.Context, opts IncrementCustomCounter, ) }
the Recorder is used to record statistics about each reconcile. Abstracts concerns like logging, metrics. (tracing can be added to this as well)
func NewRecorder ¶
func NewRecorder( counterOpts prometheus.CounterOpts, inputName string, inputGvks []schema.GroupVersionKind, outputName string, outputGvks []schema.GroupVersionKind, ) Recorder
NOTE: Only one Recorder should be initialized for each unique metric.
func RecorderFromContext ¶
RecorderFromContext returns the recorder stored int the context. if none is available, a no-op recorder is returned
Click to show internal directories.
Click to hide internal directories.