Skip to content

Commit

Permalink
ci: fix multus installation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jul 23, 2023
1 parent 0d1599f commit 85ca9c1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -690,27 +691,24 @@ 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)
$(call kind_load_image,kube-ovn,$(KUBEVIRT_HANDLER_IMAGE),1)
$(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
Expand All @@ -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
Expand Down
16 changes: 9 additions & 7 deletions test/e2e/iptables-vpc-nat-gw/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 85ca9c1

Please sign in to comment.