move test specific functions from rc_util.go

This commit is contained in:
SataQiu
2019-10-29 13:04:59 +08:00
parent 59e7a4f474
commit 24f374a395
7 changed files with 224 additions and 233 deletions

View File

@@ -146,7 +146,7 @@ func NewRCByName(c clientset.Interface, ns, name string, replicas int32, gracePe
containerArgs = []string{"serve-hostname"}
}
return c.CoreV1().ReplicationControllers(ns).Create(framework.RcByNamePort(
return c.CoreV1().ReplicationControllers(ns).Create(rcByNamePort(
name, replicas, framework.ServeHostnameImage, containerArgs, 9376, v1.ProtocolTCP, map[string]string{}, gracePeriod))
}
@@ -194,3 +194,15 @@ func RestartNodes(c clientset.Interface, nodes []v1.Node) error {
}
return nil
}
// rcByNamePort returns a ReplicationController with specified name and port
func rcByNamePort(name string, replicas int32, image string, containerArgs []string, port int, protocol v1.Protocol,
labels map[string]string, gracePeriod *int64) *v1.ReplicationController {
return framework.RcByNameContainer(name, replicas, image, labels, v1.Container{
Name: name,
Image: image,
Args: containerArgs,
Ports: []v1.ContainerPort{{ContainerPort: int32(port), Protocol: protocol}},
}, gracePeriod)
}