Add requirements based scheduling.

This commit is contained in:
Brendan Burns
2014-10-21 17:13:52 -07:00
parent dc7e3d6601
commit 5d4d60783d
10 changed files with 142 additions and 3 deletions

View File

@@ -108,6 +108,10 @@ func init() {
if err := s.Convert(&in.CurrentState, &out.CurrentState, 0); err != nil {
return err
}
if err := s.Convert(&in.NodeSelector, &out.NodeSelector, 0); err != nil {
return err
}
return nil
},
func(in *Pod, out *newer.Pod, s conversion.Scope) error {
@@ -127,6 +131,10 @@ func init() {
if err := s.Convert(&in.CurrentState, &out.CurrentState, 0); err != nil {
return err
}
if err := s.Convert(&in.NodeSelector, &out.NodeSelector, 0); err != nil {
return err
}
return nil
},
@@ -279,6 +287,9 @@ func init() {
if err := s.Convert(&in.ObjectMeta, &out.TypeMeta, 0); err != nil {
return err
}
if err := s.Convert(&in.Labels, &out.Labels, 0); err != nil {
return err
}
out.HostIP = in.HostIP
return s.Convert(&in.NodeResources, &out.NodeResources, 0)
@@ -290,6 +301,9 @@ func init() {
if err := s.Convert(&in.TypeMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := s.Convert(&in.Labels, &out.Labels, 0); err != nil {
return err
}
out.HostIP = in.HostIP
return s.Convert(&in.NodeResources, &out.NodeResources, 0)

View File

@@ -360,6 +360,8 @@ type Pod struct {
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
DesiredState PodState `json:"desiredState,omitempty" yaml:"desiredState,omitempty"`
CurrentState PodState `json:"currentState,omitempty" yaml:"currentState,omitempty"`
// NodeSelector is a selector which must be true for the pod to fit on a node
NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"`
}
// ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get).
@@ -456,6 +458,8 @@ type Minion struct {
HostIP string `json:"hostIP,omitempty" yaml:"hostIP,omitempty"`
// Resources available on the node
NodeResources NodeResources `json:"resources,omitempty" yaml:"resources,omitempty"`
// Labels for the node
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
// MinionList is a list of minions.