hacontroller

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

A HAController monitors Pods and their attached PersistentVolumes and removes Pods whose storage is "unhealthy".

In general, the HAController uses two inputs: The Kubernetes API, to get information about Pods and their volumes, and a user provided stream of "failing" volumes. Once it is notified of a failing volume, it will try to delete the currently attached Pod and VolumeAttachment, which triggers Kubernetes to recreate the Pod with healthy volumes.

"Failing" in this context means that the current resource user is not able to write to the volume, i.e. it is safe to attach the volume from another node in ReadWriteOnce scenarios.

Index

Constants

View Source
const (
	// Reason given in case a Pod was deleted because a volume failed (machine readable).
	PodDeleteEventReason = "ForceDeleted"
	// Reason given in case a VolumeAttachment was deleted because a volume failed (machine readable).
	VADeleteEventReason = "ForceDetached"
)

Variables

This section is empty.

Functions

func NewHAController

func NewHAController(name string, kubeClient kubernetes.Interface, pvWithFailingVAUpdates <-chan string, opts ...Option) *haController

Create a new HAController with the given Name, Kubernetes client and channel with "failing" PVs. Can be customized by adding Option(s).

Types

type LeaderElector

type LeaderElector interface {
	IsLeader() bool
}

A type that supports leader election

type Option

type Option func(hac *haController)

Options to pass when creating a new HAController

func WithAttacherName

func WithAttacherName(name string) Option

Only consider VolumeAttachments with the given attacher name.

func WithEventRecorder

func WithEventRecorder(ev record.EventRecorder) Option

Set an EventRecorder that will be notified about Pod and VolumeAttachment deletions

func WithLeaderElector

func WithLeaderElector(el LeaderElector) Option

Use this leader elector to determine if deletions should be submitted to Kubernetes Only the current leader will submit deletions.

func WithPodSelector

func WithPodSelector(opts metav1.ListOptions) Option

Only consider Pods found with the given ListOptions Can be used to set the LabelSelector and FieldSelector for all Pods.

func WithReconcileInterval

func WithReconcileInterval(d time.Duration) Option

Set the maximum duration between two runs of the failing volume attachment cleaner

Jump to

Keyboard shortcuts

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