host port mapping should be more consistent between scheduler and

controller-manager in k8sm:
  - rename host_port_endpoints flag to host-port-endpoints
  - host port mapping strategy in scheduler should be driven by host-port-endpoints flag
  - added host-port-endpoints to known flags
  - docs: scheduler should also be configured with host-port-endpoints
  - task recovery: be explicit about excluding mirror pods
This commit is contained in:
James DeFelice
2016-02-15 19:26:32 +00:00
parent 44d12a1389
commit 8c776b7eb9
25 changed files with 355 additions and 305 deletions

View File

@@ -26,6 +26,8 @@ import (
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/contrib/mesos/pkg/node"
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/meta"
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/podtask/hostport"
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/resources"
"k8s.io/kubernetes/pkg/api"
)
@@ -37,16 +39,18 @@ const (
func fakePodTask(id string, allowedRoles, defaultRoles []string) *T {
t, _ := New(
api.NewDefaultContext(),
"",
Config{
Prototype: &mesos.ExecutorInfo{},
FrameworkRoles: allowedRoles,
DefaultPodRoles: defaultRoles,
HostPortStrategy: hostport.StrategyWildcard,
},
&api.Pod{
ObjectMeta: api.ObjectMeta{
Name: id,
Namespace: api.NamespaceDefault,
},
},
&mesos.ExecutorInfo{},
allowedRoles,
defaultRoles,
)
return t
@@ -219,7 +223,7 @@ func TestAcceptOfferPorts(t *testing.T) {
Resources: []*mesos.Resource{
mutil.NewScalarResource("cpus", t_min_cpu),
mutil.NewScalarResource("mem", t_min_mem),
newPortsResource("*", 1, 1),
resources.NewPorts("*", 1, 1),
},
}
@@ -415,12 +419,3 @@ func newScalarAttribute(name string, val float64) *mesos.Attribute {
Scalar: &mesos.Value_Scalar{Value: proto.Float64(val)},
}
}
func newPortsResource(role string, ports ...uint64) *mesos.Resource {
return &mesos.Resource{
Name: proto.String("ports"),
Type: mesos.Value_RANGES.Enum(),
Ranges: newRanges(ports),
Role: stringPtrTo(role),
}
}