Documentation ¶
Overview ¶
Package drain is used to drain nodes
Package drain is used to drain nodes ¶
Package drain is used to drain nodes ¶
Package drain is used to drain nodes
Index ¶
- Constants
- Variables
- func SupportEviction(clientset kubernetes.Interface) (string, error)
- type Options
- type PodVolumeInfo
- type VolumeAttachmentHandler
- func (v *VolumeAttachmentHandler) AddVolumeAttachment(obj interface{})
- func (v *VolumeAttachmentHandler) AddWorker() chan *storagev1.VolumeAttachment
- func (v *VolumeAttachmentHandler) DeleteWorker(desiredWorker chan *storagev1.VolumeAttachment)
- func (v *VolumeAttachmentHandler) UpdateVolumeAttachment(oldObj, newObj interface{})
Constants ¶
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 = 2 * 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 ¶
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 { DeleteLocalData bool Driver driver.Driver ErrOut io.Writer ForceDeletePods bool GracePeriodSeconds int IgnorePodsWithoutControllers bool IgnoreDaemonsets bool MaxEvictRetries int32 PvDetachTimeout time.Duration PvReattachTimeout time.Duration Out io.Writer Timeout time.Duration // contains filtered or unexported fields }
Options are configurable options while draining a node before deletion
func NewDrainOptions ¶
func NewDrainOptions( client kubernetes.Interface, kubernetesVersion *semver.Version, timeout time.Duration, maxEvictRetries int32, pvDetachTimeout time.Duration, pvReattachTimeout 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, pdbV1beta1Lister policyv1beta1listers.PodDisruptionBudgetLister, pdbV1Lister policyv1listers.PodDisruptionBudgetLister, nodeLister corelisters.NodeLister, volumeAttachmentHandler *VolumeAttachmentHandler, ) *Options
NewDrainOptions creates a new DrainOptions struct and returns a pointer to it
func (*Options) RunCordonOrUncordon ¶
RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for "Unschedulable" is passed as the first arg.
type PodVolumeInfo ¶
type PodVolumeInfo struct {
// contains filtered or unexported fields
}
PodVolumeInfo is the struct used to hold the PersistentVolumeID and volumeID for all the PVs attached to the pod
type VolumeAttachmentHandler ¶
VolumeAttachmentHandler is an handler used to distribute incoming VolumeAttachment requests to all listening workers
func NewVolumeAttachmentHandler ¶
func NewVolumeAttachmentHandler() *VolumeAttachmentHandler
NewVolumeAttachmentHandler returns a new VolumeAttachmentHandler
func (*VolumeAttachmentHandler) AddVolumeAttachment ¶
func (v *VolumeAttachmentHandler) AddVolumeAttachment(obj interface{})
AddVolumeAttachment is the event handler for VolumeAttachment add
func (*VolumeAttachmentHandler) AddWorker ¶
func (v *VolumeAttachmentHandler) AddWorker() chan *storagev1.VolumeAttachment
AddWorker is the method used to add a new worker
func (*VolumeAttachmentHandler) DeleteWorker ¶
func (v *VolumeAttachmentHandler) DeleteWorker(desiredWorker chan *storagev1.VolumeAttachment)
DeleteWorker is the method used to delete an existing worker
func (*VolumeAttachmentHandler) UpdateVolumeAttachment ¶
func (v *VolumeAttachmentHandler) UpdateVolumeAttachment(oldObj, newObj interface{})
UpdateVolumeAttachment is the event handler for VolumeAttachment update