From 85ca9c1e7bce243d06f6e2cdcd645e0a1a3e472f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Sun, 23 Jul 2023 11:57:02 +0800 Subject: [PATCH] ci: fix multus installation --- .github/workflows/build-x86-image.yaml | 5 +---- .gitignore | 1 + Makefile | 16 +++++++--------- test/e2e/iptables-vpc-nat-gw/e2e_test.go | 16 +++++++++------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-x86-image.yaml b/.github/workflows/build-x86-image.yaml index 57153079bfb..9b387ed20fd 100644 --- a/.github/workflows/build-x86-image.yaml +++ b/.github/workflows/build-x86-image.yaml @@ -2026,10 +2026,7 @@ jobs: sudo cp -r /root/.kube/ ~/.kube/ sudo chown -R $(id -un). ~/.kube/ - - name: Install Kube-OVN - run: make kind-install - - - name: Install vpc-nat-gw + - name: Install Kube-OVN with VPC NAT gateway enabled run: make kind-install-vpc-nat-gw - name: Run E2E diff --git a/.gitignore b/.gitignore index f1e3c517a58..99218d88a69 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .vscode/* .DS_Store dist/images/test-server +dist/images/kube-ovn dist/images/kube-ovn-cmd dist/images/kube-ovn-webhook dist/windows/kube-ovn.exe diff --git a/Makefile b/Makefile index 48de41df51b..2765549fc7d 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,9 @@ CONTROL_PLANE_TAINTS = node-role.kubernetes.io/master node-role.kubernetes.io/co CHART_UPGRADE_RESTART_OVS=$(shell echo $${CHART_UPGRADE_RESTART_OVS:-false}) -MULTUS_IMAGE = ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick -MULTUS_YAML = https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml +MULTUS_VERSION = v4.0.2 +MULTUS_IMAGE = ghcr.io/k8snetworkplumbingwg/multus-cni:$(MULTUS_VERSION)-thick +MULTUS_YAML = https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/$(MULTUS_VERSION)/deployments/multus-daemonset-thick.yml KUBEVIRT_VERSION = v0.59.2 KUBEVIRT_OPERATOR_IMAGE = quay.io/kubevirt/virt-operator:$(KUBEVIRT_VERSION) @@ -690,17 +691,17 @@ kind-install-underlay-logical-gateway-dual: kind-disable-hairpin kind-load-image .PHONY: kind-install-multus kind-install-multus: $(call kind_load_image,kube-ovn,$(MULTUS_IMAGE),1) - kubectl apply -f "$(MULTUS_YAML)" + curl -s "$(MULTUS_YAML)" | sed 's/:snapshot-thick/:$(MULTUS_VERSION)-thick/g' | kubectl apply -f - kubectl -n kube-system rollout status ds kube-multus-ds .PHONY: kind-install-vpc-nat-gw -kind-install-vpc-nat-gw: kind-load-image kind-untaint-control-plane +kind-install-vpc-nat-gw: $(call kind_load_image,kube-ovn,$(VPC_NAT_GW_IMG)) @$(MAKE) ENABLE_NAT_GW=true CNI_CONFIG_PRIORITY=10 kind-install @$(MAKE) kind-install-multus .PHONY: kind-install-kubevirt -kind-install-kubevirt: kind-load-image kind-untaint-control-plane +kind-install-kubevirt: kind-install $(call kind_load_image,kube-ovn,$(KUBEVIRT_OPERATOR_IMAGE),1) $(call kind_load_image,kube-ovn,$(KUBEVIRT_API_IMAGE),1) $(call kind_load_image,kube-ovn,$(KUBEVIRT_CONTROLLER_IMAGE),1) @@ -708,9 +709,6 @@ kind-install-kubevirt: kind-load-image kind-untaint-control-plane $(call kind_load_image,kube-ovn,$(KUBEVIRT_LAUNCHER_IMAGE),1) $(call kind_load_image,kube-ovn,$(KUBEVIRT_TEST_IMAGE),1) - sed 's/VERSION=.*/VERSION=$(VERSION)/' dist/images/install.sh | bash - kubectl describe no - kubectl apply -f "$(KUBEVIRT_OPERATOR_YAML)" kubectl apply -f "$(KUBEVIRT_CR_YAML)" kubectl rollout status deployment/virt-operator -n kubevirt --timeout 120s @@ -723,7 +721,7 @@ kind-install-kubevirt: kind-load-image kind-untaint-control-plane kubectl patch vm testvm --type=merge --patch '{"spec":{"running":true}}' .PHONY: kind-install-lb-svc -kind-install-lb-svc: kind-load-image kind-untaint-control-plane +kind-install-lb-svc: $(call kind_load_image,kube-ovn,$(VPC_NAT_GW_IMG)) @$(MAKE) ENABLE_LB_SVC=true CNI_CONFIG_PRIORITY=10 kind-install @$(MAKE) kind-install-multus diff --git a/test/e2e/iptables-vpc-nat-gw/e2e_test.go b/test/e2e/iptables-vpc-nat-gw/e2e_test.go index 91e3a11f799..b0f4d66c096 100644 --- a/test/e2e/iptables-vpc-nat-gw/e2e_test.go +++ b/test/e2e/iptables-vpc-nat-gw/e2e_test.go @@ -158,15 +158,15 @@ func setupVpcNatGwTestEnvironment( _, err := f.ClientSet.CoreV1().ConfigMaps(framework.KubeOvnNamespace).Get(context.Background(), vpcNatGWConfigMapName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get ConfigMap") - ginkgo.By("Creating custom vpc") + ginkgo.By("Creating custom vpc " + vpcName) vpc := framework.MakeVpc(vpcName, lanIp, false, false, nil) _ = vpcClient.CreateSync(vpc) - ginkgo.By("Creating custom overlay subnet") + ginkgo.By("Creating custom overlay subnet " + overlaySubnetName) overlaySubnet := framework.MakeSubnet(overlaySubnetName, "", overlaySubnetV4Cidr, overlaySubnetV4Gw, vpcName, "", nil, nil, nil) _ = subnetClient.CreateSync(overlaySubnet) - ginkgo.By("Creating custom vpc nat gw") + ginkgo.By("Creating custom vpc nat gw " + vpcNatGwName) vpcNatGw := framework.MakeVpcNatGateway(vpcNatGwName, vpcName, overlaySubnetName, lanIp, externalNetworkName, natGwQosPolicy) _ = vpcNatGwClient.CreateSync(vpcNatGw, f.ClientSet) } @@ -230,7 +230,7 @@ var _ = framework.Describe("[group:iptables-vpc-nat-gw]", func() { overlaySubnetName = "overlay-subnet-" + framework.RandomSuffix() net2AttachDefName = "net2-ovn-vpc-external-network-" + framework.RandomSuffix() - net2SubnetProvider = net2AttachDefName + ".kube-system" + net2SubnetProvider = fmt.Sprintf("%s.%s", net2AttachDefName, framework.KubeOvnNamespace) net2OverlaySubnetName = "net2-overlay-subnet-" + framework.RandomSuffix() net2VpcNatGwName = "net2-gw-" + framework.RandomSuffix() net2VpcName = "net2-vpc-" + framework.RandomSuffix() @@ -610,7 +610,7 @@ func newVPCQoSParamsInit() *qosParams { vpc2PodName: "qos-vpc2-pod-" + framework.RandomSuffix(), attachDefName: "qos-ovn-vpc-external-network-" + framework.RandomSuffix(), } - qosParames.subnetProvider = qosParames.attachDefName + ".kube-system" + qosParames.subnetProvider = fmt.Sprintf("%s.%s", qosParames.attachDefName, framework.KubeOvnNamespace) return qosParames } @@ -1078,7 +1078,7 @@ var _ = framework.Describe("[group:qos-policy]", func() { vpcQosParams.vpc2PodName = "qos-vpc2-pod-" + framework.RandomSuffix() vpcQosParams.attachDefName = "qos-ovn-vpc-external-network-" + framework.RandomSuffix() - vpcQosParams.subnetProvider = vpcQosParams.attachDefName + ".kube-system" + vpcQosParams.subnetProvider = fmt.Sprintf("%s.%s", vpcQosParams.attachDefName, framework.KubeOvnNamespace) containerID = "" cs = f.ClientSet @@ -1286,8 +1286,10 @@ var _ = framework.Describe("[group:qos-policy]", func() { ginkgo.By("Deleting overlay subnet " + vpcQosParams.vpc1SubnetName) subnetClient.DeleteSync(vpcQosParams.vpc1SubnetName) - vpcNatGw2PodName := util.GenNatGwPodName(vpcQosParams.vpcNat2GwName) + ginkgo.By("Getting overlay subnet " + vpcQosParams.vpc2SubnetName) overlaySubnet2 := subnetClient.Get(vpcQosParams.vpc2SubnetName) + + vpcNatGw2PodName := util.GenNatGwPodName(vpcQosParams.vpcNat2GwName) eth0IpName = ovs.PodNameToPortName(vpcNatGw2PodName, framework.KubeOvnNamespace, overlaySubnet2.Spec.Provider) net1IpName = ovs.PodNameToPortName(vpcNatGw2PodName, framework.KubeOvnNamespace, macvlanSubnet.Spec.Provider) ginkgo.By("Deleting vpc nat gw eth0 ip " + eth0IpName)