Merge pull request #130081 from elizabeth-dev/replace-network-e2e-replicationcontrollers-3

test(network): replace RCs with Deployments in util function CreateServicePods
This commit is contained in:
Kubernetes Prow Robot 2025-02-16 06:00:21 -08:00 committed by GitHub
commit edc1fd24cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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