Documentation ¶
Index ¶
- Variables
- func DeleteNodeAnnotations(nc v1core.NodeInterface, node string, ks []string) error
- func DeleteNodeLabels(nc v1core.NodeInterface, node string, ks []string) error
- func FilterContainerLinuxNodes(nodes []v1api.Node) []v1api.Node
- func FilterNodesByAnnotation(list []v1api.Node, sel fields.Selector) []v1api.Node
- func FilterNodesByRequirement(nodes []v1api.Node, req *labels.Requirement) []v1api.Node
- func FilterPods(pods []v1api.Pod, filter func(*v1api.Pod) bool) (newpods []v1api.Pod)
- func GetClient(path string) (*kubernetes.Clientset, error)
- func NewRequirementOrDie(key string, op selection.Operator, vals []string) *labels.Requirement
- func NodeAnnotationCondition(selector fields.Selector) watch.ConditionFunc
- func RetryOnConflict(backoff wait.Backoff, fn func() error) error
- func SetNodeAnnotations(nc v1core.NodeInterface, node string, m map[string]string) error
- func SetNodeLabels(nc v1core.NodeInterface, node string, m map[string]string) error
- func Unschedulable(nc v1core.NodeInterface, node string, sched bool) error
- func UpdateNodeRetry(nc v1core.NodeInterface, node string, f func(*v1api.Node)) error
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
var DefaultBackoff = wait.Backoff{ Steps: 4, Duration: 10 * time.Millisecond, Factor: 5.0, Jitter: 0.1, }
DefaultBackoff is the recommended backoff for a conflict where a client may be attempting to make an unrelated modification to a resource under active management by one or more controllers.
var DefaultRetry = wait.Backoff{ Steps: 5, Duration: 10 * time.Millisecond, Factor: 1.0, Jitter: 0.1, }
DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.
Functions ¶
func DeleteNodeAnnotations ¶ added in v0.3.0
func DeleteNodeAnnotations(nc v1core.NodeInterface, node string, ks []string) error
DeleteNodeAnnotations deletes all annotations with keys in ks
func DeleteNodeLabels ¶ added in v0.3.0
func DeleteNodeLabels(nc v1core.NodeInterface, node string, ks []string) error
DeleteNodeLabels deletes all keys in ks
func FilterContainerLinuxNodes ¶ added in v0.3.0
FilterContainerLinuxNodes filters a list of nodes and returns nodes with a Container Linux OSImage, as reported by the node's /etc/os-release.
func FilterNodesByAnnotation ¶
FilterNodesByAnnotation takes a node list and a field selector, and returns a node list that matches the field selector.
func FilterNodesByRequirement ¶ added in v0.3.0
FilterNodesByRequirement filters a list of nodes and returns nodes matching the given label requirement.
func FilterPods ¶
func GetClient ¶ added in v0.3.0
func GetClient(path string) (*kubernetes.Clientset, error)
GetClient returns a Kubernetes client (clientset) from the kubeconfig path or from the in-cluster service account environment.
func NewRequirementOrDie ¶ added in v0.3.0
NewRequirementOrDie wraps a call to NewRequirement and panics if the Requirment cannot be created. It is intended for use in variable initializations only.
func NodeAnnotationCondition ¶
func NodeAnnotationCondition(selector fields.Selector) watch.ConditionFunc
NodeAnnotationCondition returns a condition function that succeeds when a node being watched has an annotation of key equal to value.
func RetryOnConflict ¶
RetryConflict executes the provided function repeatedly, retrying if the server returns a conflicting write. Callers should preserve previous executions if they wish to retry changes. It performs an exponential backoff.
var pod *api.Pod err := RetryOnConflict(DefaultBackoff, func() (err error) { pod, err = c.Pods("mynamespace").UpdateStatus(podStatus) return }) if err != nil { // may be conflict if max retries were hit return err } ...
TODO: Make Backoff an interface?
func SetNodeAnnotations ¶
SetNodeAnnotations sets all keys in m to their respective values in node's annotations.
func SetNodeLabels ¶
SetNodeLabels sets all keys in m to their respective values in node's labels.
func Unschedulable ¶
func Unschedulable(nc v1core.NodeInterface, node string, sched bool) error
Unschedulable marks node as schedulable or unschedulable according to sched.
func UpdateNodeRetry ¶
UpdateNodeRetry calls f to update a node object in Kubernetes. It will attempt to update the node by applying f to it up to DefaultBackoff number of times. f will be called each time since the node object will likely have changed if a retry is necessary.
Types ¶
type VersionInfo ¶
VersionInfo contains CoreOS version and update information.
func GetVersionInfo ¶
func GetVersionInfo() (*VersionInfo, error)
GetVersionInfo returns VersionInfo from the current CoreOS system.
Should probably live in a different package.