Documentation ¶
Index ¶
Constants ¶
const ( // DefaultLogCollectorMaxItems defines default maximum size of LogCollector. DefaultLogCollectorMaxItems = 50 // DefaultLogCollectorItemLifetime is the default time after which LogItem will be removed from LogCollector. DefaultLogCollectorItemLifetime = 15 * time.Minute )
const ( // StatusConfigMapName is the name of ConfigMap with status. StatusConfigMapName = "cluster-autorepair-status" // ConfigMapLastUpdatedKey is the name of annotation informing about status ConfigMap last update. ConfigMapLastUpdatedKey = "cluster-autorepair.kubernetes.io/last-updated" )
Variables ¶
This section is empty.
Functions ¶
func DeleteStatusConfigMap ¶
func DeleteStatusConfigMap(kubeClient kube_client.Interface, namespace string) error
DeleteStatusConfigMap deletes status configmap
func WriteStatusConfigMap ¶
func WriteStatusConfigMap(kubeClient kube_client.Interface, namespace string, msg string, logRecorder *LogEventRecorder) (*apiv1.ConfigMap, error)
WriteStatusConfigMap writes updates status ConfigMap with a given message or creates a new ConfigMap if it doesn't exist. If logRecorder is passed and configmap update is successfull logRecorder's internal reference will be updated.
Types ¶
type LogCollector ¶
LogCollector keeps recent log events. It is automatically truncated on each access based on predefined set of conditions.
func NewLogCollector ¶
func NewLogCollector() *LogCollector
NewLogCollector creates new LogCollector.
func (*LogCollector) GetLogs ¶
func (lc *LogCollector) GetLogs() []LogItem
GetLogs returns a copy of messages in log. This is an actual copy, so it will not reflect any future changes in log.
func (*LogCollector) Log ¶
func (lc *LogCollector) Log(msg string, level LogLevel)
Log logs a single provided message in LogCollector.
type LogEventRecorder ¶
type LogEventRecorder struct {
// contains filtered or unexported fields
}
LogEventRecorder records events on some top-level object, to give user (without access to logs) a view of most important CA actions.
func NewStatusMapRecorder ¶
func NewStatusMapRecorder(kubeClient kube_client.Interface, namespace string, recorder record.EventRecorder, active bool) (*LogEventRecorder, error)
NewStatusMapRecorder creates a LogEventRecorder creating events on status configmap. If the configmap doesn't exist it will be created (with 'Initializing' status). If active == false the map will not be created and no events will be recorded.
func (*LogEventRecorder) Event ¶
func (ler *LogEventRecorder) Event(eventtype, reason, message string)
Event record an event on underlying object. This does nothing if the underlying object is not set.
func (*LogEventRecorder) Eventf ¶
func (ler *LogEventRecorder) Eventf(eventtype, reason, message string, args ...interface{})
Eventf record an event on underlying object. This does nothing if the underlying object is not set.