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 ¶
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.