types

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToAPICondition

func ConvertToAPICondition(condition Condition) corev1.NodeCondition

ConvertToAPICondition converts the internal node condition to corev1.NodeCondition.

func ConvertToAPIConditionStatus

func ConvertToAPIConditionStatus(status ConditionStatus) corev1.ConditionStatus

ConvertToAPIConditionStatus converts the internal node condition status to corev1.ConditionStatus.

func ConvertToAPIEventType

func ConvertToAPIEventType(severity Severity) string

ConvertToAPIEventType converts the internal severity to event type.

func ConvertToAPITimestamp

func ConvertToAPITimestamp(timestamp time.Time) metav1.Time

ConvertToAPITimestamp converts the timestamp to metav1.Time.

Types

type CommandLineOptions

type CommandLineOptions interface {
	SetFlags(*pflag.FlagSet)
}

type Condition

type Condition struct {
	// Type is the condition type. It should describe the condition of node in problem. For example
	// KernelDeadlock, OutOfResource etc.
	Type string `json:"type"`
	// Status indicates whether the node is in the condition or not.
	Status ConditionStatus `json:"status"`
	// Transition is the time when the node transits to this condition.
	Transition time.Time `json:"transition"`
	// Reason is a short reason of why node goes into this condition.
	Reason string `json:"reason"`
	// Message is a human readable message of why node goes into this condition.
	Message string `json:"message"`
	// Source is the name of the problem daemon.
	Source string `json:"source"`
}

Condition is the node condition used internally by problem detector.

type ConditionStatus

type ConditionStatus string

ConditionStatus is the status of the condition.

const (
	// True means the condition status is true.
	True ConditionStatus = "True"
	// False means the condition status is false.
	False ConditionStatus = "False"
	// Unknown means the condition status is unknown.
	Unknown ConditionStatus = "Unknown"
)

type Exporter

type Exporter interface {
	// Export problems to the control plane.
	ExportProblems(*Status)
}

Exporter exports machine health data to certain control plane.

type ExporterHandler

type ExporterHandler struct {
	// CreateExporterOrDie initializes an exporter, panic if error occurs.
	CreateExporterOrDie func(CommandLineOptions) Exporter
	// CmdOptionDescription explains how to configure the exporter from command line arguments.
	Options CommandLineOptions
}

ExporterHandler represents the initialization handler for a type of exporter.

type ExporterType

type ExporterType string

ExporterType is the type of the exporter.

type Monitor

type Monitor interface {
	// Start starts the monitor.
	// The Status channel is used to report problems. If the Monitor does not report any
	// problem (i.e. metrics reporting only), the channel should be set to nil.
	Start() (<-chan *Status, error)
	// Stop stops the monitor.
	Stop()
}

Monitor monitors the system and reports problems and metrics according to the rules.

type ProblemDaemonConfigPathMap

type ProblemDaemonConfigPathMap map[ProblemDaemonType]*[]string

ProblemDaemonConfigPathMap represents configurations on all types of problem daemons: 1) Each key represents a type of problem daemon. 2) Each value represents the config file paths to that type of problem daemon.

type ProblemDaemonHandler

type ProblemDaemonHandler struct {
	// CreateProblemDaemonOrDie initializes a problem daemon, panic if error occurs.
	CreateProblemDaemonOrDie func(string) Monitor
	// CmdOptionDescription explains how to configure the problem daemon from command line arguments.
	CmdOptionDescription string
}

ProblemDaemonHandler represents the initialization handler for a type problem daemon.

type ProblemDaemonType

type ProblemDaemonType string

ProblemDaemonType is the type of the problem daemon. One type of problem daemon may be used to initialize multiple problem daemon instances.

type Severity

type Severity string

Severity is the severity of the problem event. Now we only have 2 severity levels: Info and Warn, which are corresponding to the current kubernetes event types. We may want to add more severity levels in the future.

const (
	// Info is translated to a normal event.
	Info Severity = "info"
	// Warn is translated to a warning event.
	Warn Severity = "warn"
)

type Status

type Status struct {
	// Conditions are the permanent node conditions. The problem daemon should always report the
	// newest node conditions in this field.
	Conditions []Condition `json:"conditions"`
}

Status is the status other problem daemons should report to node problem detector.

type Type

type Type string

Type is the type of the problem.

const (
	// Temp means the problem is temporary, only need to report an event.
	Temp Type = "temporary"
	// Perm means the problem is permanent, need to change the node condition.
	Perm Type = "permanent"
)

Jump to

Keyboard shortcuts

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