Documentation ¶
Index ¶
Constants ¶
const ( // EvictionKind represents the kind of evictions object EvictionKind = "Eviction" // EvictionSubresource represents the kind of evictions object as pod's subresource EvictionSubresource = "pods/eviction" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CordonHelper ¶
type CordonHelper struct {
// contains filtered or unexported fields
}
CordonHelper wraps functionality to cordon/uncordon nodes
func NewCordonHelper ¶
func NewCordonHelper(node *corev1.Node, desired DesiredCordonStatus) *CordonHelper
NewCordonHelper returns a new CordonHelper
func NewCordonHelperFromRuntimeObject ¶
func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime.Scheme, gvk schema.GroupVersionKind, desired DesiredCordonStatus) (*CordonHelper, error)
NewCordonHelperFromRuntimeObject returns a new CordonHelper, or an error if given object is not a node or cannot be encoded as JSON
func (*CordonHelper) IsUpdateRequired ¶
func (c *CordonHelper) IsUpdateRequired() bool
IsUpdateRequired returns true if c.node.Spec.Unschedulable matches desired state, or false when it is
func (*CordonHelper) PatchOrReplace ¶
func (c *CordonHelper) PatchOrReplace(clientset kubernetes.Interface) (error, error)
PatchOrReplace uses given clientset to update the node status, either by patching or updating the given node object; it may return error if the object cannot be encoded as JSON, or if either patch or update calls fail; it will also return a second error whenever creating a patch has failed
type DesiredCordonStatus ¶
type DesiredCordonStatus string
const ( CordonNode DesiredCordonStatus = "cordon" UncordonNode DesiredCordonStatus = "uncordon" )
func (DesiredCordonStatus) String ¶
func (n DesiredCordonStatus) String() string
type Helper ¶
type Helper struct { Selector string PodSelector string Client kubernetes.Interface Force bool DryRun bool GracePeriodSeconds int Timeout time.Duration IgnoreAllDaemonSets bool IgnoreDaemonSets []metav1.ObjectMeta DeleteLocalData bool UseEvictions bool // contains filtered or unexported fields }
Helper contains the parameters to control the behaviour of drainer
func (*Helper) CanUseEvictions ¶
CanUseEvictions uses Discovery API to find out if evictions are supported
func (*Helper) EvictOrDeletePod ¶
EvictOrDeletePod will evict pod if policy API is available, otherwise deletes it NOTE: CanUseEvictions must be called prior to this
func (*Helper) EvictPod ¶
EvictPod will evict the give pod, or return an error if it couldn't NOTE: CanUseEvictions must be called prior to this
func (*Helper) GetPodsForDeletion ¶
GetPodsForDeletion lists all pods on a given node, filters those using the default filters, and returns podDeleteList along with any errors. All pods that are ready to be deleted can be obtained with .Pods(), and string with all warning can be obtained with .Warnings()