mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 01:40:13 +00:00
support args for newrc funcs
This commit is contained in:
parent
a1f4c2ed21
commit
ea2f6c80d7
@ -246,7 +246,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
numNodes, err := e2enode.TotalRegistered(f.ClientSet)
|
||||
framework.ExpectNoError(err)
|
||||
replicas := int32(numNodes)
|
||||
common.NewRCByName(c, ns, name, replicas, nil)
|
||||
common.NewRCByName(c, ns, name, replicas, nil, nil)
|
||||
err = e2epod.VerifyPods(c, ns, name, true, replicas)
|
||||
framework.ExpectNoError(err, "Each pod should start running and responding")
|
||||
|
||||
@ -313,7 +313,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
numNodes, err := e2enode.TotalRegistered(f.ClientSet)
|
||||
framework.ExpectNoError(err)
|
||||
replicas := int32(numNodes)
|
||||
common.NewRCByName(c, ns, name, replicas, &gracePeriod)
|
||||
common.NewRCByName(c, ns, name, replicas, &gracePeriod, []string{"serve-hostname"})
|
||||
err = e2epod.VerifyPods(c, ns, name, true, replicas)
|
||||
framework.ExpectNoError(err, "Each pod should start running and responding")
|
||||
|
||||
|
@ -134,10 +134,15 @@ func NewSVCByName(c clientset.Interface, ns, name string) error {
|
||||
}
|
||||
|
||||
// NewRCByName creates a replication controller with a selector by name of name.
|
||||
func NewRCByName(c clientset.Interface, ns, name string, replicas int32, gracePeriod *int64) (*v1.ReplicationController, error) {
|
||||
func NewRCByName(c clientset.Interface, ns, name string, replicas int32, gracePeriod *int64, containerArgs []string) (*v1.ReplicationController, error) {
|
||||
ginkgo.By(fmt.Sprintf("creating replication controller %s", name))
|
||||
|
||||
if containerArgs == nil {
|
||||
containerArgs = []string{"serve-hostname"}
|
||||
}
|
||||
|
||||
return c.CoreV1().ReplicationControllers(ns).Create(framework.RcByNamePort(
|
||||
name, replicas, framework.ServeHostnameImage, 9376, v1.ProtocolTCP, map[string]string{}, gracePeriod))
|
||||
name, replicas, framework.ServeHostnameImage, containerArgs, 9376, v1.ProtocolTCP, map[string]string{}, gracePeriod))
|
||||
}
|
||||
|
||||
// RestartNodes restarts specific nodes.
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@ -36,12 +36,13 @@ import (
|
||||
)
|
||||
|
||||
// RcByNamePort returns a ReplicationController with specified name and port
|
||||
func RcByNamePort(name string, replicas int32, image string, port int, protocol v1.Protocol,
|
||||
func RcByNamePort(name string, replicas int32, image string, containerArgs []string, port int, protocol v1.Protocol,
|
||||
labels map[string]string, gracePeriod *int64) *v1.ReplicationController {
|
||||
|
||||
return RcByNameContainer(name, replicas, image, labels, v1.Container{
|
||||
Name: name,
|
||||
Image: image,
|
||||
Args: containerArgs,
|
||||
Ports: []v1.ContainerPort{{ContainerPort: int32(port), Protocol: protocol}},
|
||||
}, gracePeriod)
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func verifyRCs(c clientset.Interface, ns string, names []string) {
|
||||
}
|
||||
|
||||
func createNewRC(c clientset.Interface, ns string, name string) {
|
||||
_, err := common.NewRCByName(c, ns, name, 1, nil)
|
||||
_, err := common.NewRCByName(c, ns, name, 1, nil, nil)
|
||||
framework.ExpectNoError(err)
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
|
||||
numNodes, err := e2enode.TotalRegistered(c)
|
||||
framework.ExpectNoError(err)
|
||||
originalNodeCount = int32(numNodes)
|
||||
common.NewRCByName(c, ns, name, originalNodeCount, nil)
|
||||
common.NewRCByName(c, ns, name, originalNodeCount, nil, nil)
|
||||
err = e2epod.VerifyPods(c, ns, name, true, originalNodeCount)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
@ -147,7 +147,7 @@ var _ = SIGDescribe("Nodes [Disruptive]", func() {
|
||||
numNodes, err := e2enode.TotalRegistered(c)
|
||||
framework.ExpectNoError(err)
|
||||
originalNodeCount = int32(numNodes)
|
||||
common.NewRCByName(c, ns, name, originalNodeCount, nil)
|
||||
common.NewRCByName(c, ns, name, originalNodeCount, nil, nil)
|
||||
err = e2epod.VerifyPods(c, ns, name, true, originalNodeCount)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user