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, pollPeriod time.Duration)
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 Estimator ¶
type Estimator struct { // Specification of monitored resources. Resources []Resource // Percentage offset defining acceptable resource range. AcceptanceOffset int64 // Percentage offset defining recommended resource range. RecommendationOffset int64 }
Estimator is a struct used for estimating accepted and recommended resource requirements.
type EstimatorResult ¶
type EstimatorResult struct { // Recommended range is used for setting new values of resource requirements. RecommendedRange ResourceListPair // Acceptable range specifies which requirements are acceptable and doesn't need to be changed. AcceptableRange ResourceListPair }
EstimatorResult is the result of the resource Estimation, used by Estimator struct.
type KubernetesClient ¶
type KubernetesClient interface { CountNodes() (uint64, error) ContainerResources() (*api.ResourceRequirements, error) UpdateDeployment(resources *api.ResourceRequirements) error Stop() }
KubernetesClient is an object that performs the nanny's requisite interactions with Kubernetes.
func NewKubernetesClient ¶
func NewKubernetesClient(kubeClient kube_client.Interface, namespace, deployment, pod, container string) KubernetesClient
NewKubernetesClient gives a KubernetesClient with the given dependencies.
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. Returned value is a list with acceptable values. First element on that list is the recommended one.
type ResourceListPair ¶
type ResourceListPair struct {
// contains filtered or unexported fields
}
ResourceListPair is a pair of ResourceLists, denoting a range.