mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
test(network): replace RCs with Deployments in util function CreateServicePods
See #119021
This commit is contained in:
parent
4e7e14203d
commit
98d600bef9
@ -44,8 +44,6 @@ import (
|
|||||||
e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment"
|
e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment"
|
||||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||||
e2epodoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
|
e2epodoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
|
||||||
e2erc "k8s.io/kubernetes/test/e2e/framework/rc"
|
|
||||||
testutils "k8s.io/kubernetes/test/utils"
|
|
||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
netutils "k8s.io/utils/net"
|
netutils "k8s.io/utils/net"
|
||||||
"k8s.io/utils/ptr"
|
"k8s.io/utils/ptr"
|
||||||
@ -1025,18 +1023,20 @@ func (j *TestJig) CheckServiceReachability(ctx context.Context, svc *v1.Service,
|
|||||||
|
|
||||||
// CreateServicePods creates a replication controller with the label same as service. Service listens to TCP and UDP.
|
// CreateServicePods creates a replication controller with the label same as service. Service listens to TCP and UDP.
|
||||||
func (j *TestJig) CreateServicePods(ctx context.Context, replica int) error {
|
func (j *TestJig) CreateServicePods(ctx context.Context, replica int) error {
|
||||||
config := testutils.RCConfig{
|
deploymentConfig := e2edeployment.NewDeployment(j.Name,
|
||||||
Client: j.Client,
|
int32(replica),
|
||||||
Name: j.Name,
|
j.Labels,
|
||||||
Image: imageutils.GetE2EImage(imageutils.Agnhost),
|
j.Name,
|
||||||
Command: []string{"/agnhost", "serve-hostname", "--http=false", "--tcp", "--udp"},
|
imageutils.GetE2EImage(imageutils.Agnhost),
|
||||||
Namespace: j.Namespace,
|
appsv1.RecreateDeploymentStrategyType)
|
||||||
Labels: j.Labels,
|
deploymentConfig.Spec.Template.Spec.Containers[0].Command = []string{"/agnhost", "serve-hostname", "--http=false", "--tcp", "--udp"}
|
||||||
PollInterval: 3 * time.Second,
|
|
||||||
Timeout: framework.PodReadyBeforeTimeout,
|
deployment, err := j.Client.AppsV1().Deployments(j.Namespace).Create(ctx, deploymentConfig, metav1.CreateOptions{})
|
||||||
Replicas: replica,
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return e2erc.RunRC(ctx, config)
|
|
||||||
|
return e2edeployment.WaitForDeploymentComplete(j.Client, deployment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSCTPServiceWithPort creates a new SCTP Service with given port based on the
|
// CreateSCTPServiceWithPort creates a new SCTP Service with given port based on the
|
||||||
|
Loading…
Reference in New Issue
Block a user