Documentation ¶
Index ¶
- func AddLabelToNode(nodeName string, labelName string, labelValue string, ...) error
- func CordonNode(name string, client kubernetes.Interface) error
- func DrainPods(pods []*v1.Pod, client kubernetes.Interface) []error
- func EvictPod(pod *v1.Pod, apiVersion string, client kubernetes.Interface) error
- func EvictPods(pods []*v1.Pod, apiVersion string, client kubernetes.Interface) (evictionErrors []error)
- func GetConfig(kubeconfig string) (*rest.Config, error)
- func NamespaceFlag(cmd *cobra.Command) string
- func NewCLIClientOrDie(kubeConfigFlags *genericclioptions.ConfigFlags) client.Client
- func PatchNode(name string, patches []Patch, client kubernetes.Interface) error
- func PatchPod(name, namespace string, patches []Patch, client kubernetes.Interface) error
- func PodIsDaemonSet(pod *v1.Pod) bool
- func PodIsStatic(pod *v1.Pod) bool
- func StartWatching(client kubernetes.Interface, namespace string, watchFn WatchResourceFunc, ...) cache.Indexer
- func SupportEviction(client kubernetes.Interface) (string, error)
- func UncordonNode(name string, client kubernetes.Interface) error
- func Watch(c cache.Getter, resource string, namespace string, ...) (cache.Indexer, cache.Controller)
- func WatchControllerRevisions(client kubernetes.Interface, namespace string, ...) (cache.Indexer, cache.Controller)
- func WatchDaemonSets(client kubernetes.Interface, namespace string, ...) (cache.Indexer, cache.Controller)
- func WatchNodes(client kubernetes.Interface, _ string, ...) (cache.Indexer, cache.Controller)
- func WatchPods(client kubernetes.Interface, namespace string, ...) (cache.Indexer, cache.Controller)
- type ControllerRevisionLister
- type DaemonSetLister
- type NodeLister
- type Patch
- type PodLister
- type WatchResourceFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLabelToNode ¶
func AddLabelToNode(nodeName string, labelName string, labelValue string, client kubernetes.Interface) error
AddLabelToNode performs a patch operation on a node to add a label to the node
func CordonNode ¶
func CordonNode(name string, client kubernetes.Interface) error
CordonNode performs a patch operation on a node to mark it as unschedulable
func DrainPods ¶
func DrainPods(pods []*v1.Pod, client kubernetes.Interface) []error
DrainPods attempts to delete or evict pods so that the node can be terminated. Will prioritise using Evict if the API server supports it.
func EvictPods ¶
func EvictPods(pods []*v1.Pod, apiVersion string, client kubernetes.Interface) (evictionErrors []error)
EvictPods evicts multiple pods from Kubernetes
func NamespaceFlag ¶
NamespaceFlag gets the --namespace flag from the command
func NewCLIClientOrDie ¶
func NewCLIClientOrDie(kubeConfigFlags *genericclioptions.ConfigFlags) client.Client
NewCLIClientOrDie creates a new controller-runtime client for use with CRDs by wrapping the dynamic.Client
func PatchNode ¶
func PatchNode(name string, patches []Patch, client kubernetes.Interface) error
PatchNode patches a node
func PatchPod ¶
func PatchPod(name, namespace string, patches []Patch, client kubernetes.Interface) error
PatchPod patches a pod
func PodIsDaemonSet ¶
PodIsDaemonSet returns if the pod is a daemonset or not
func PodIsStatic ¶
PodIsStatic returns if the pod is static or not
func StartWatching ¶
func StartWatching(client kubernetes.Interface, namespace string, watchFn WatchResourceFunc, stopCh <-chan struct{}) cache.Indexer
StartWatching starts watching with the watchFn and returns the cache to query from
func SupportEviction ¶
func SupportEviction(client kubernetes.Interface) (string, error)
SupportEviction uses Discovery API to find out if the API server supports the eviction subresource If there is support, it will return its groupVersion; Otherwise, it will return ""
func UncordonNode ¶
func UncordonNode(name string, client kubernetes.Interface) error
UncordonNode performs a patch operation on a node to mark it as schedulable
func Watch ¶
func Watch(c cache.Getter, resource string, namespace string, resourceEventHandler cache.ResourceEventHandler, objType runtime.Object, fieldSelector fields.Selector) (cache.Indexer, cache.Controller)
Watch returns a controller that will watch the specified resource
func WatchControllerRevisions ¶
func WatchControllerRevisions(client kubernetes.Interface, namespace string, resourceEventHandler cache.ResourceEventHandler) (cache.Indexer, cache.Controller)
WatchControllerRevisions watches all daemonsets
func WatchDaemonSets ¶
func WatchDaemonSets(client kubernetes.Interface, namespace string, resourceEventHandler cache.ResourceEventHandler) (cache.Indexer, cache.Controller)
WatchDaemonSets watches all daemonsets
func WatchNodes ¶
func WatchNodes(client kubernetes.Interface, _ string, resourceEventHandler cache.ResourceEventHandler) (cache.Indexer, cache.Controller)
WatchNodes watches all nodes
func WatchPods ¶
func WatchPods(client kubernetes.Interface, namespace string, resourceEventHandler cache.ResourceEventHandler) (cache.Indexer, cache.Controller)
WatchPods watches all pods
Types ¶
type ControllerRevisionLister ¶
type ControllerRevisionLister interface {
List(labels.Selector) ([]*v1.ControllerRevision, error)
}
ControllerRevisionLister defines a type that can list ControllerRevision with a selector
func NewCachedControllerRevisionList ¶
func NewCachedControllerRevisionList(caches ...cache.Indexer) ControllerRevisionLister
NewCachedControllerRevisionList creates a new cachedControllerRevisionList
type DaemonSetLister ¶
DaemonSetLister defines a type that can list DaemonSets with a selector
func NewCachedDaemonSetList ¶
func NewCachedDaemonSetList(caches ...cache.Indexer) DaemonSetLister
NewCachedDaemonSetList creates a new cachedDaemonSetList
type NodeLister ¶
NodeLister defines an object that can list nodes with a label selector
func NewCachedNodeList ¶
func NewCachedNodeList(cache cache.Indexer) NodeLister
NewCachedNodeList creates a new cachedNodeList
type Patch ¶
type Patch struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
Patch describes a JSON Patch used to perform Patch operations on Kubernetes API objects via the API server.
type PodLister ¶
PodLister defines a type that can list pods with a label selector
func NewCachedPodList ¶
NewCachedPodList creates a new cachedPodList
type WatchResourceFunc ¶
type WatchResourceFunc func(kubernetes.Interface, string, cache.ResourceEventHandler) (cache.Indexer, cache.Controller)
WatchResourceFunc defines a function that can setup a cache and controller