Move Policy test helpers into their own file

Since types.go should always be equal to latest API types.go, this
makes future cut and paste refactors easier.
This commit is contained in:
Clayton Coleman
2014-10-07 10:24:40 -04:00
parent e294cef9d4
commit 363d6554ae
2 changed files with 41 additions and 21 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package api
import (
"strings"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
@@ -195,26 +194,6 @@ const (
PullIfNotPresent PullPolicy = "PullIfNotPresent"
)
func IsPullAlways(p PullPolicy) bool {
// Default to pull always
if len(p) == 0 {
return true
}
return pullPoliciesEqual(p, PullAlways)
}
func IsPullNever(p PullPolicy) bool {
return pullPoliciesEqual(p, PullNever)
}
func IsPullIfNotPresent(p PullPolicy) bool {
return pullPoliciesEqual(p, PullIfNotPresent)
}
func pullPoliciesEqual(p1, p2 PullPolicy) bool {
return strings.ToLower(string(p1)) == strings.ToLower(string(p2))
}
// Container represents a single container that is expected to be run on the host.
type Container struct {
// Required: This must be a DNS_LABEL. Each container in a pod must