nanny

package
v0.0.0-...-4d07825 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package nanny implements logic to poll the k8s apiserver for cluster status, and update a deployment based on that status.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PollAPIServer

func PollAPIServer(k8s KubernetesClient, est ResourceEstimator, contName string, pollPeriod time.Duration, threshold uint64)

PollAPIServer periodically counts the number of nodes, estimates the expected ResourceRequirements, compares them to the actual ResourceRequirements, and updates the deployment with the expected ResourceRequirements if necessary.

Types

type ExponentialEstimator

type ExponentialEstimator struct {
	Resources   []Resource
	ScaleFactor float64
}

ExponentialEstimator estimates the amount of resources in the way that prevents from frequent updates but may end up with larger resource usage than actually needed (though no more than ScaleFactor).

type KubernetesClient

type KubernetesClient interface {
	CountNodes() (uint64, error)
	ContainerResources() (*api.ResourceRequirements, error)
	UpdateDeployment(resources *api.ResourceRequirements) error
}

KubernetesClient is an object that performs the nanny's requisite interactions with Kubernetes.

func NewKubernetesClient

func NewKubernetesClient(namespace, deployment, pod, container string, clientset *client.Clientset) KubernetesClient

NewKubernetesClient gives a KubernetesClient with the given dependencies.

type LinearEstimator

type LinearEstimator struct {
	Resources []Resource
}

LinearEstimator estimates the amount of resources as r = base + extra*nodes.

type Resource

type Resource struct {
	Base, ExtraPerNode resource.Quantity
	Name               api.ResourceName
}

Resource defines the name of a resource, the quantity, and the marginal value.

type ResourceEstimator

type ResourceEstimator interface {
	// contains filtered or unexported methods
}

ResourceEstimator estimates ResourceRequirements for a given criteria.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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