node

package
v1.4.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package node provides utilities to create and update nodes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(
	client unversionedcore.NodesGetter,
	hostName string,
	slaveAttrLabels,
	annotations map[string]string,
) (*api.Node, error)

Create creates a new node api object with the given hostname, slave attribute labels and annotations

func CreateOrUpdate

func CreateOrUpdate(
	client unversionedcore.NodesGetter,
	hostname string,
	slaveAttrLabels,
	annotations map[string]string,
) (*api.Node, error)

CreateOrUpdate creates a node api object or updates an existing one

func IsNotSlaveAttributeLabel

func IsNotSlaveAttributeLabel(key, value string) bool

IsNotSlaveAttributeLabel returns true iff the given label is not derived from a slave attribute

func IsSlaveAttributeLabel

func IsSlaveAttributeLabel(key, value string) bool

IsSlaveAttributeLabel returns true iff the given label is derived from a slave attribute

func IsUpToDate

func IsUpToDate(n *api.Node, labels map[string]string) bool

IsUpToDate returns true iff the node's slave labels match the given attributes labels

func NewRegistrator

func NewRegistrator(client unversionedcore.NodesGetter, lookupNode LookupFunc) *clientRegistrator

func SlaveAttributesToLabels

func SlaveAttributesToLabels(attrs []*mesos.Attribute) map[string]string

SlaveAttributesToLabels converts slave attributes into string key/value labels

func Update

func Update(
	client unversionedcore.NodesGetter,
	hostname string,
	slaveAttrLabels,
	annotations map[string]string,
) (n *api.Node, err error)

Update updates an existing node api object by looking up the given hostname. The updated node merges the given slave attribute labels and annotations with the found api object.

Types

type LookupFunc

type LookupFunc func(hostName string) *api.Node

type Registrator

type Registrator interface {
	// Register checks whether the node is registered with the given labels. If it
	// is not, it is created or updated on the apiserver. If an the node was up-to-date,
	// false is returned.
	Register(hostName string, labels map[string]string) (bool, error)

	// Start the registration loop and return immediately.
	Run(terminate <-chan struct{}) error
}

type StatusUpdater

type StatusUpdater struct {
	// contains filtered or unexported fields
}

func NewStatusUpdater

func NewStatusUpdater(client *clientset.Clientset, relistPeriod time.Duration, nowFunc func() time.Time) *StatusUpdater

func (*StatusUpdater) Run

func (u *StatusUpdater) Run(terminate <-chan struct{}) error

Jump to

Keyboard shortcuts

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