Skip to content

Commit

Permalink
minor fixes in vpc pod probe e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Nov 4, 2024
1 parent b057e4c commit 22c7d2f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 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 @@ -57,33 +57,34 @@ var _ = framework.SerialDescribe("[group:pod]", func() {

ginkgo.By("Deleting custom 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("Enable 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("Create VPC " + vpcName)
vpcName = "vpc-" + framework.RandomSuffix()
customVPC := framework.MakeVpc(vpcName, "", false, false, nil)
vpcClient.CreateSync(customVPC)
Expand Down

0 comments on commit 22c7d2f

Please sign in to comment.