Documentation ¶
Index ¶
- Constants
- func Cordon(client typedcorev1.NodeInterface, node *corev1.Node, logger golog.Logger) error
- func DeleteOrEvictPods(client kubernetes.Interface, node *corev1.Node, options *DrainOptions) error
- func Drain(client kubernetes.Interface, nodes []*corev1.Node, options *DrainOptions) (err error)
- func GetNodes(client typedcorev1.NodeInterface, nodes []string, selector string) (out []*corev1.Node, err error)
- func SupportEviction(clientset kubernetes.Interface) (string, error)
- func Uncordon(client typedcorev1.NodeInterface, node *corev1.Node, logger golog.Logger) error
- type DaemonSetFilterOptions
- type DrainOptions
Constants ¶
const ( EvictionKind = "Eviction" EvictionSubresource = "pods/eviction" )
Variables ¶
This section is empty.
Functions ¶
func Cordon ¶
func Cordon(client typedcorev1.NodeInterface, node *corev1.Node, logger golog.Logger) error
Cordon marks a node "Unschedulable". This method is idempotent.
func DeleteOrEvictPods ¶
func DeleteOrEvictPods(client kubernetes.Interface, node *corev1.Node, options *DrainOptions) error
DeleteOrEvictPods deletes or (where supported) evicts pods from the target node and waits until the deletion/eviction completes, Timeout elapses, or an error occurs.
func Drain ¶
func Drain(client kubernetes.Interface, nodes []*corev1.Node, options *DrainOptions) (err error)
Drain nodes in preparation for maintenance.
The given nodes will be marked unschedulable to prevent new pods from arriving. Drain evicts the pods if the APIServer supports eviction (http://kubernetes.io/docs/admin/disruptions/). Otherwise, it will use normal DELETE to delete the pods. Drain evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are DaemonSet-managed pods, Drain will not proceed without IgnoreDaemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then Drain will not delete any pods unless you use Force. Force will also allow deletion to proceed if the managing resource of one or more pods is missing.
Drain waits for graceful termination. You should not operate on the machine until the command completes.
When you are ready to put the nodes back into service, use Uncordon, which will make the nodes schedulable again.
![Workflow](http://kubernetes.io/images/docs/kubectl_drain.svg)
func GetNodes ¶
func GetNodes(client typedcorev1.NodeInterface, nodes []string, selector string) (out []*corev1.Node, err error)
GetNodes looks up the nodes (either given by name as arguments or by the Selector option).
func SupportEviction ¶
func SupportEviction(clientset kubernetes.Interface) (string, error)
SupportEviction uses Discovery API to find out if the server supports the eviction subresource. If supported, it will return its groupVersion; otherwise it will return an empty string.
func Uncordon ¶
func Uncordon(client typedcorev1.NodeInterface, node *corev1.Node, logger golog.Logger) error
Uncordon marks a node "Schedulable". This method is idempotent.
Types ¶
type DaemonSetFilterOptions ¶
type DaemonSetFilterOptions struct {
// contains filtered or unexported fields
}
type DrainOptions ¶
type DrainOptions struct { // Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet. Force bool // Ignore DaemonSet-managed pods. IgnoreDaemonsets bool // Period of time in seconds given to each pod to terminate // gracefully. If negative, the default value specified in the pod // will be used. GracePeriodSeconds int // The length of time to wait before giving up on deletion or // eviction. Zero means infinite. Timeout time.Duration // Continue even if there are pods using emptyDir (local data that // will be deleted when the node is drained). DeleteLocalData bool // Namespace to filter pods on the node. Namespace string // Label selector to filter pods on the node. Selector labels.Selector // Logger allows callers to plug in their preferred logger. Logger golog.Logger }