drain

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0, BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package drain is used to drain nodes

Package drain is used to drain nodes

Index

Constants

View Source
const (
	// EvictionKind is the kind used for eviction
	EvictionKind = "Eviction"
	// EvictionSubresource is the kind used for evicting pods
	EvictionSubresource = "pods/eviction"

	// DefaultMachineDrainTimeout is the default value for MachineDrainTimeout
	DefaultMachineDrainTimeout = 12 * time.Hour

	// PodsWithoutPVDrainGracePeriod defines the grace period to wait for the pods without PV during machine drain.
	// This is in addition to the maximum terminationGracePeriod amount the pods.
	PodsWithoutPVDrainGracePeriod = 3 * time.Minute

	// Interval is the default Poll interval
	Interval = time.Second * 5

	// PodEvictionRetryInterval is the interval in which to retry eviction for pods
	PodEvictionRetryInterval = time.Second * 20

	// GetPvDetailsRetryInterval is the interval in which to retry getting PV details
	GetPvDetailsRetryInterval = time.Second * 5
	// GetPvDetailsMaxRetries is the number of max retries to get PV details
	GetPvDetailsMaxRetries = 3
	// VolumeDetachPollInterval is the interval in which to recheck if the volume is detached from the node
	VolumeDetachPollInterval = time.Second * 5
)

Variables

View Source
var (
	// DefaultMaxEvictRetries is the default value for MaxEvictRetries
	DefaultMaxEvictRetries = int32(DefaultMachineDrainTimeout.Seconds() / PodEvictionRetryInterval.Seconds())
)

Functions

func SupportEviction

func SupportEviction(clientset kubernetes.Interface) (string, error)

SupportEviction uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return ""

Types

type Options

type Options struct {
	ForceDeletePods              bool
	IgnorePodsWithoutControllers bool
	GracePeriodSeconds           int
	IgnoreDaemonsets             bool
	Timeout                      time.Duration
	MaxEvictRetries              int32
	PvDetachTimeout              time.Duration
	DeleteLocalData              bool

	Out    io.Writer
	ErrOut io.Writer
	Driver driver.Driver
	// contains filtered or unexported fields
}

Options are configurable options while draining a node before deletion

func NewDrainOptions

func NewDrainOptions(
	client kubernetes.Interface,
	timeout time.Duration,
	maxEvictRetries int32,
	pvDetachTimeout time.Duration,
	nodeName string,
	gracePeriodSeconds int,
	forceDeletePods bool,
	ignorePodsWithoutControllers bool,
	ignoreDaemonsets bool,
	deleteLocalData bool,
	out io.Writer,
	errOut io.Writer,
	driver driver.Driver,
	pvcLister corelisters.PersistentVolumeClaimLister,
	pvLister corelisters.PersistentVolumeLister,
) *Options

NewDrainOptions creates a new DrainOptions struct and returns a pointer to it

func (*Options) RunCordonOrUncordon

func (o *Options) RunCordonOrUncordon(desired bool) error

RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for "Unschedulable" is passed as the first arg.

func (*Options) RunDrain

func (o *Options) RunDrain() error

RunDrain runs the 'drain' command

Jump to

Keyboard shortcuts

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