Improve "constraint violation" error message.

This commit is contained in:
Jerzy Szczepkowski
2015-02-04 23:41:27 +01:00
parent 63c07ad58b
commit ad4c2ee630
3 changed files with 16 additions and 10 deletions

View File

@@ -17,11 +17,16 @@ limitations under the License.
package constraint
import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
// Allowed returns true if pods is a collection of bound pods
// which can run without conflict on a single minion.
func Allowed(pods []api.BoundPod) bool {
return !PortsConflict(pods)
func Allowed(pods []api.BoundPod) error {
if (PortsConflict(pods)) {
return fmt.Errorf("conflicting ports");
}
return nil;
}