package drain
import "k8s.io/kubernetes/pkg/kubectl/drain"
Index ¶
- Constants
- func CheckEvictionSupport(clientset kubernetes.Interface) (string, error)
- type CordonHelper
- func NewCordonHelper(node *corev1.Node) *CordonHelper
- func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime.Scheme, gvk schema.GroupVersionKind) (*CordonHelper, error)
- func (c *CordonHelper) PatchOrReplace(clientset kubernetes.Interface) (error, error)
- func (c *CordonHelper) UpdateIfRequired(desired bool) bool
- type Helper
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" )
Functions ¶
func CheckEvictionSupport ¶
func CheckEvictionSupport(clientset kubernetes.Interface) (string, error)
CheckEvictionSupport uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return an empty string
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) *CordonHelper
NewCordonHelper returns a new CordonHelper
func NewCordonHelperFromRuntimeObject ¶
func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime.Scheme, gvk schema.GroupVersionKind) (*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) 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
func (*CordonHelper) UpdateIfRequired ¶
func (c *CordonHelper) UpdateIfRequired(desired bool) bool
UpdateIfRequired returns true if c.node.Spec.Unschedulable isn't already set, or false when no change is needed
type Helper ¶
type Helper struct { Client kubernetes.Interface Force bool DryRun bool GracePeriodSeconds int IgnoreAllDaemonSets bool Timeout time.Duration DeleteLocalData bool Selector string PodSelector string ErrOut io.Writer }
Helper contains the parameters to control the behaviour of drainer
func (*Helper) DeletePod ¶
DeletePod will delete the given pod, or return an error if it couldn't
func (*Helper) EvictPod ¶
EvictPod will evict the give pod, or return an error if it couldn't
func (*Helper) GetPodsForDeletion ¶
GetPodsForDeletion receives resource info for a node, and returns those pods as PodDeleteList, or error if it cannot list pods. All pods that are ready to be deleted can be obtained with .Pods(), and string with all warning can be obtained with .Warnings(), and .Errors() for all errors that occurred during deletion.
Source Files ¶
cordon.go drain.go filters.go
- Version
- v1.14.0-beta.1
- Published
- Feb 26, 2019
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 3 minutes ago –
Tools for package owners.