package planer

import "k8s.io/kubernetes/federation/pkg/federation-controller/replicaset/planner"

Index

Types

type Planner

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

Planner decides how many out of the given replicas should be placed in each of the federated clusters.

func NewPlanner

func NewPlanner(preferences *fed_api.FederatedReplicaSetPreferences) *Planner

func (*Planner) Plan

func (p *Planner) Plan(replicasToDistribute int64, availableClusters []string, currentReplicaCount map[string]int64,
	estimatedCapacity map[string]int64, replicaSetKey string) (map[string]int64, map[string]int64)

Distribute the desired number of replicas among the given cluster according to the planner preferences. The function tries its best to assign each cluster the prefered number of replicas, however if sum of MinReplicas for all cluster is bigger thant replicasToDistribute then some cluster will not have all of the replicas assigned. In such case a cluster with higher weight has priority over cluster with lower weight (or with lexicographically smaller name in case of draw). It can also use the current replica count and estimated capacity to provide better planning and adhere to rebalance policy. To avoid prioritization of clusters with smaller lexiconographical names a semi-random string (like replica set name) can be provided. Two maps are returned:

Source Files

planner.go

Version
v1.4.0-beta.5
Published
Sep 15, 2016
Platform
linux/amd64
Imports
4 packages
Last checked
5 seconds ago

Tools for package owners.