Documentation ¶
Index ¶
- Constants
- type ContainerdClient
- type HealthChecker
- type KubeletHealthChecker
- func (k *KubeletHealthChecker) Check(ctx context.Context, node *corev1.Node) error
- func (k *KubeletHealthChecker) HasLastInternalIP() bool
- func (*KubeletHealthChecker) Name() string
- func (k *KubeletHealthChecker) RevertToggleKubeletState()
- func (k *KubeletHealthChecker) SetKubeletHealthEndpoint(kubeletHealthEndpoint string)
- func (k *KubeletHealthChecker) ToggleKubeletState() bool
- type Reconciler
Constants ¶
const (
// ControllerName is the name of this controller.
ControllerName = "health-check"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerdClient ¶
type ContainerdClient interface {
Version(context.Context) (containerd.Version, error)
}
ContainerdClient defines the containerd client Interface exported for testing.
type HealthChecker ¶
type HealthChecker interface { // Name returns the name of the healthchecker. Name() string // Check executes the health check. Check(ctx context.Context, node *corev1.Node) error }
HealthChecker can be implemented to run a health check against a node component and fix it if possible.
func NewContainerdHealthChecker ¶
func NewContainerdHealthChecker(client client.Client, containerdClient ContainerdClient, clock clock.Clock, dbus dbus.DBus, recorder record.EventRecorder) HealthChecker
NewContainerdHealthChecker creates a new instance of a containerd health check.
type KubeletHealthChecker ¶
type KubeletHealthChecker struct { // Clock exported for testing. Clock clock.Clock // KubeletReadinessToggles contains an entry for every toggle between NotReady->Ready state. KubeletReadinessToggles []time.Time // NodeReady indicates if the node is ready. Exported for testing. NodeReady bool // contains filtered or unexported fields }
KubeletHealthChecker configures the kubelet healthcheck.
func NewKubeletHealthChecker ¶
func NewKubeletHealthChecker(client client.Client, clock clock.Clock, dbus dbus.DBus, recorder record.EventRecorder, getAddresses func() ([]net.Addr, error)) *KubeletHealthChecker
NewKubeletHealthChecker create an instance of a kubelet health check.
func (*KubeletHealthChecker) HasLastInternalIP ¶
func (k *KubeletHealthChecker) HasLastInternalIP() bool
HasLastInternalIP returns true if the node.InternalIP was stored. Exported for testing.
func (*KubeletHealthChecker) Name ¶
func (*KubeletHealthChecker) Name() string
Name returns the name of this health check.
func (*KubeletHealthChecker) RevertToggleKubeletState ¶
func (k *KubeletHealthChecker) RevertToggleKubeletState()
RevertToggleKubeletState removes the last entry created by ToggleKubeletState().
func (*KubeletHealthChecker) SetKubeletHealthEndpoint ¶
func (k *KubeletHealthChecker) SetKubeletHealthEndpoint(kubeletHealthEndpoint string)
SetKubeletHealthEndpoint set the kubeletHealthEndpoint. Exported for testing.
func (*KubeletHealthChecker) ToggleKubeletState ¶
func (k *KubeletHealthChecker) ToggleKubeletState() bool
ToggleKubeletState should be triggered if the state of the kubelet changed from NotReady -> Ready. It returns true if a reboot of the node should be triggered.
type Reconciler ¶
type Reconciler struct { Client client.Client Recorder record.EventRecorder DBus dbus.DBus HealthCheckers []HealthChecker HealthCheckIntervalSeconds int32 }
Reconciler checks for containerd and kubelet health and restarts them if required.
func (*Reconciler) AddToManager ¶
AddToManager adds Reconciler to the given manager.