Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor fixes in vpc pod probe e2e test #4682

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions test/e2e/kube-ovn/pod/vpc_pod_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"strconv"
"strings"

"github.com/onsi/ginkgo/v2"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/onsi/ginkgo/v2"

apiv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
"github.com/kubeovn/kube-ovn/pkg/util"
"github.com/kubeovn/kube-ovn/test/e2e/framework"
Expand All @@ -32,17 +33,16 @@ var _ = framework.SerialDescribe("[group:pod]", func() {
var namespaceName, subnetName, podName, vpcName string
var subnet *apiv1.Subnet
var cidr string
var extraSubnetNames []string

ginkgo.BeforeEach(func() {
podClient = f.PodClient()
eventClient = f.EventClient()
subnetClient = f.SubnetClient()
vpcClient = f.VpcClient()
namespaceName = f.Namespace.Name
subnetName = "subnet-" + framework.RandomSuffix()
podName = "pod-" + framework.RandomSuffix()
cidr = framework.RandomCIDR(f.ClusterIPFamily)
vpcClient = f.VpcClient()

ginkgo.By("Creating subnet " + subnetName)
subnet = framework.MakeSubnet(subnetName, "", cidr, "", "", "", nil, nil, []string{namespaceName})
Expand All @@ -55,35 +55,36 @@ var _ = framework.SerialDescribe("[group:pod]", func() {
ginkgo.By("Deleting subnet " + subnetName)
subnetClient.DeleteSync(subnetName)

ginkgo.By("Deleting custom vpc " + vpcName)
ginkgo.By("Deleting VPC " + vpcName)
vpcClient.DeleteSync(vpcName)

for _, subnetName := range extraSubnetNames {
subnetClient.DeleteSync(subnetName)
}
})

framework.ConformanceIt("should support http and tcp readiness probe in custom vpc pod", func() {
f.SkipVersionPriorTo(1, 12, "This feature was introduced in v1.12")

ginkgo.By("Getting kube-ovn-cni daemonset")
daemonSetClient := f.DaemonSetClientNS(framework.KubeOvnNamespace)
originDs := daemonSetClient.Get("kube-ovn-cni")
modifyDs := originDs.DeepCopy()

newArgs := originDs.Spec.Template.Spec.Containers[0].Args
ginkgo.By("Enabling tproxy in kube-ovn-cni daemonset")
modifyDs := originDs.DeepCopy()
newArgs := modifyDs.Spec.Template.Spec.Containers[0].Args
for index, arg := range newArgs {
if arg == "--enable-tproxy=false" {
newArgs = append(newArgs[:index], newArgs[index+1:]...)
}
}
newArgs = append(newArgs, "--enable-tproxy=true")
modifyDs.Spec.Template.Spec.Containers[0].Args = newArgs

daemonSetClient.PatchSync(modifyDs)

custVPCSubnetName := "subnet-" + framework.RandomSuffix()
extraSubnetNames = append(extraSubnetNames, custVPCSubnetName)
ginkgo.DeferCleanup(func() {
ginkgo.By("Deleting subnet " + custVPCSubnetName)
subnetClient.DeleteSync(custVPCSubnetName)
})

ginkgo.By("Create Custom Vpc subnet Pod")
ginkgo.By("Creating VPC " + vpcName)
vpcName = "vpc-" + framework.RandomSuffix()
customVPC := framework.MakeVpc(vpcName, "", false, false, nil)
vpcClient.CreateSync(customVPC)
Expand Down
Loading