k8sutil

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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 FilterPods

func FilterPods(pods []v1api.Pod, filter func(*v1api.Pod) bool) (newpods []v1api.Pod)

func InClusterClient

func InClusterClient() (*kubernetes.Clientset, error)

InClusterClient gets a kubernetes client with an in-cluster configuration.

func NodeLabelCondition

func NodeLabelCondition(key, value string) watch.ConditionFunc

NodeLabelCondition returns a condition function that succeeds when a node being watched has a label of key equal to value.

func RetryOnConflict

func RetryOnConflict(backoff wait.Backoff, fn func() error) error

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

func SetNodeAnnotations(nc v1core.NodeInterface, node string, m map[string]string) error

SetNodeAnnotations sets all keys in m to their respective values in node's annotations.

func SetNodeLabels

func SetNodeLabels(nc v1core.NodeInterface, node string, m map[string]string) error

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.

Types

type VersionInfo

type VersionInfo struct {
	Name    string
	ID      string
	Group   string
	Version string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL