Documentation ¶
Overview ¶
Package controller deletes pods in a certain state
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultReasons = []string{
"CrashLoopBackOff",
"Error",
}
DefaultReasons is the reaons to delete a pod. only used when containers in pod are in terminated of waiting state
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a struct to hold a lister, deleter, and options
func New ¶
func New(lister PodLister, deleter PodDeleter, options ...Option) (*Controller, error)
New creates a new controller
func (*Controller) Loop ¶
func (c *Controller) Loop() error
Loop will run the controller periodically until stopped
type Option ¶
type Option func(*Controller) error
Option sets options when creating a new controller
func WithDryRun ¶
WithDryRun returns an Option that sets the dryrun flag. When true, pods will not actually be deleted Used when creating a new Controller.
func WithGrace ¶
WithGrace returns an Option that sets the grace period for pod deletions. Pods that have been created less than this time period ago will not be considered for deletion. Used when creating a new Controller.
func WithInterval ¶
WithInterval returns an Option that sets the loop interval. Used when creating a new Controller.
func WithLogger ¶
WithLogger returns an Option that sets the logger. Used when creating a new Controller.
func WithNamespace ¶
WithNamespace returns an Option that sets the namespace. Used when creating a new Controller.
func WithReasons ¶
WithReasons returns an Option that sets the reasons to delete a pod. Default is CrashLoopBackOff Error
func WithSelector ¶
WithSelector returns an Option that sets the label selector used to filter pods when listing them. Used when creating a new Controller.
type PodDeleter ¶
PodDeleter deletes a pod