Skip to content

Commit

Permalink
refactor kubevirt vm e2e (#3914)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian authored and zbb88888 committed Apr 16, 2024
1 parent b56864b commit 41dfa54
Show file tree
Hide file tree
Showing 16 changed files with 379 additions and 158 deletions.
101 changes: 4 additions & 97 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,10 @@ jobs:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
E2E_IP_FAMILY: ${{ matrix.ip-family }}
E2E_NETWORK_MODE: ${{ matrix.mode }}
run: make kube-ovn-conformance-e2e
run: |
make kube-ovn-conformance-e2e
make kind-install-kubevirt
make kube-ovn-kubevirt-e2e
- name: kubectl ko log
if: failure()
Expand Down Expand Up @@ -1261,101 +1264,6 @@ jobs:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
run: make kube-ovn-lb-svc-conformance-e2e

kubevirt-e2e:
name: Kubevirt VM E2E
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: jlumbroso/[email protected]
with:
android: true
dotnet: true
haskell: true
docker-images: false
large-packages: false
tool-cache: false
swap-storage: false

- uses: actions/checkout@v4

- name: Create the default branch directory
if: (github.base_ref || github.ref_name) != github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: (github.base_ref || github.ref_name) != github.event.repository.default_branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 1
path: test/e2e/source

- name: Export E2E directory
run: |
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
echo "E2E_DIR=." >> "$GITHUB_ENV"
else
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
fi
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION || '' }}
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
cache: false

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Install kind
uses: helm/[email protected]
with:
version: ${{ env.KIND_VERSION }}
install_only: true

- name: Install ginkgo
working-directory: ${{ env.E2E_DIR }}
run: go install -v -mod=mod github.com/onsi/ginkgo/v2/ginkgo

- name: Download kube-ovn image
uses: actions/download-artifact@v4
with:
name: kube-ovn

- name: Load images
run: |
docker load -i kube-ovn.tar
- name: Create kind cluster
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN and KubeVirt
run: make kind-install-kubevirt

- name: Run E2E
working-directory: ${{ env.E2E_DIR }}
env:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
run: make kube-ovn-kubevirt-e2e

webhook-e2e:
name: Webhook E2E
needs:
Expand Down Expand Up @@ -2103,7 +2011,6 @@ jobs:
- no-np-test
- cilium-chaining-e2e
- kube-ovn-ha-e2e
- kubevirt-e2e
- kube-ovn-submariner-conformance-e2e
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scheduled-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ jobs:
run: |
version=$(grep -E '^VERSION="v([0-9]+\.){2}[0-9]+"$' dist/images/install.sh | head -n1 | awk -F= '{print $2}' | tr -d '"')
docker pull kubeovn/kube-ovn:$version
VERSION=$version make kind-install
VERSION=$version make kind-install-kubevirt
- name: Run E2E
Expand Down
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif

CONTROL_PLANE_TAINTS = node-role.kubernetes.io/master node-role.kubernetes.io/control-plane

FRR_VERSION = 8.5.4
FRR_VERSION = 9.0.2
FRR_IMAGE = quay.io/frrouting/frr:$(FRR_VERSION)

CLAB_IMAGE = ghcr.io/srl-labs/clab:0.54.2
Expand All @@ -46,10 +46,8 @@ KUBEVIRT_API_IMAGE = quay.io/kubevirt/virt-api:$(KUBEVIRT_VERSION)
KUBEVIRT_CONTROLLER_IMAGE = quay.io/kubevirt/virt-controller:$(KUBEVIRT_VERSION)
KUBEVIRT_HANDLER_IMAGE = quay.io/kubevirt/virt-handler:$(KUBEVIRT_VERSION)
KUBEVIRT_LAUNCHER_IMAGE = quay.io/kubevirt/virt-launcher:$(KUBEVIRT_VERSION)
KUBEVIRT_TEST_IMAGE = quay.io/kubevirt/cirros-container-disk-demo
KUBEVIRT_OPERATOR_YAML = https://github.com/kubevirt/kubevirt/releases/download/$(KUBEVIRT_VERSION)/kubevirt-operator.yaml
KUBEVIRT_CR_YAML = https://github.com/kubevirt/kubevirt/releases/download/$(KUBEVIRT_VERSION)/kubevirt-cr.yaml
KUBEVIRT_TEST_YAML = https://kubevirt.io/labs/manifests/vm.yaml

CILIUM_VERSION = 1.15.3
CILIUM_IMAGE_REPO = quay.io/cilium
Expand Down Expand Up @@ -744,7 +742,7 @@ kind-install-metallb: kind-install
--version $(METALLB_VERSION) \
--namespace metallb-system \
--create-namespace \
--set frr.image.tag=$(FRR_VERSION)
--set speaker.frr.image.tag=$(FRR_VERSION)
$(call kubectl_wait_exist_and_ready,metallb-system,deployment,metallb-controller)
$(call kubectl_wait_exist_and_ready,metallb-system,daemonset,metallb-speaker)
@metallb_pool=$(shell echo $(KIND_IPV4_SUBNET) | sed 's/.[^.]\+$$/.201/')-$(shell echo $(KIND_IPV4_SUBNET) | sed 's/.[^.]\+$$/.250/') \
Expand All @@ -758,26 +756,23 @@ kind-install-vpc-nat-gw:
@$(MAKE) kind-install-multus

.PHONY: kind-install-kubevirt
kind-install-kubevirt: kind-install
kind-install-kubevirt:
$(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)

kubectl apply -f "$(KUBEVIRT_OPERATOR_YAML)"
kubectl apply -f "$(KUBEVIRT_CR_YAML)"
kubectl -n kubevirt patch kubevirt kubevirt --type=merge --patch '{"spec":{"configuration":{"developerConfiguration":{"useEmulation":true}}}}'
kubectl -n kubevirt scale deploy virt-operator --replicas=1
kubectl -n kubevirt patch kubevirt kubevirt --type=merge --patch \
'{"spec":{"configuration":{"developerConfiguration":{"useEmulation":true}},"infra":{"replicas":1}}}'
$(call kubectl_wait_exist_and_ready,kubevirt,deployment,virt-operator)
$(call kubectl_wait_exist_and_ready,kubevirt,deployment,virt-api)
$(call kubectl_wait_exist_and_ready,kubevirt,deployment,virt-controller)
$(call kubectl_wait_exist_and_ready,kubevirt,daemonset,virt-handler)

kubectl apply -f "$(KUBEVIRT_TEST_YAML)"
kubectl patch vm testvm --type=merge --patch '{"spec":{"running":true}}'
kubectl wait vm testvm --for=condition=Ready --timeout=2m

.PHONY: kind-install-lb-svc
kind-install-lb-svc:
$(call kind_load_image,kube-ovn,$(VPC_NAT_GW_IMG))
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ require (
k8s.io/pod-security-admission v0.29.3
k8s.io/sample-controller v0.29.3
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
kubevirt.io/api v1.1.1
kubevirt.io/client-go v1.1.1
sigs.k8s.io/controller-runtime v0.17.3
)
Expand Down Expand Up @@ -115,8 +116,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
Expand All @@ -127,7 +127,6 @@ require (
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
Expand Down Expand Up @@ -272,7 +271,6 @@ require (
k8s.io/kubelet v0.29.3 // indirect
k8s.io/legacy-cloud-providers v0.0.0 // indirect
k8s.io/mount-utils v0.0.0 // indirect
kubevirt.io/api v1.1.1 // indirect
kubevirt.io/containerized-data-importer-api v1.58.1 // indirect
kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect
Expand Down Expand Up @@ -317,5 +315,5 @@ replace (
k8s.io/mount-utils => k8s.io/mount-utils v0.29.3
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.29.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.29.3
kubevirt.io/client-go => github.com/kubeovn/kubevirt-client-go v0.0.0-20240218040151-07ffb2d68c98
kubevirt.io/client-go => github.com/kubeovn/kubevirt-client-go v0.0.0-20240412101643-286960f75418
)
11 changes: 4 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1147,12 +1147,10 @@ github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo=
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU=
github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U=
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk=
Expand Down Expand Up @@ -1262,6 +1260,7 @@ github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhO
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
Expand Down Expand Up @@ -1316,8 +1315,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=
github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -1660,8 +1657,8 @@ github.com/kubeovn/go-iptables v0.0.0-20230322103850-8619a8ab3dca h1:fTMjoho2et9
github.com/kubeovn/go-iptables v0.0.0-20230322103850-8619a8ab3dca/go.mod h1:jY1XeGzkx8ASNJ+SqQSxTESNXARkjvt+I6IJOTnzIjw=
github.com/kubeovn/gonetworkmanager/v2 v2.0.0-20230905082151-e28c4d73a589 h1:y9exo1hjCsq7jsGUzt11kxhTiEGrGSQ0ZqibAiZk2PQ=
github.com/kubeovn/gonetworkmanager/v2 v2.0.0-20230905082151-e28c4d73a589/go.mod h1:49upX+/hUyppWIqu58cumojyIwXdkA8k6reA/mQlKuI=
github.com/kubeovn/kubevirt-client-go v0.0.0-20240218040151-07ffb2d68c98 h1:dep4cdkNcs/vcwtVxWjdtkR8VDldyjwwDlCfR/mJWkQ=
github.com/kubeovn/kubevirt-client-go v0.0.0-20240218040151-07ffb2d68c98/go.mod h1:JPGTNzDyfVd42ABNw1lTkFEQOlxTxEAkTKa8RW7Xmp0=
github.com/kubeovn/kubevirt-client-go v0.0.0-20240412101643-286960f75418 h1:eBEuGzPw1L72Sv8xhcUMKw62JahyJV2Ag+OUgqelzu8=
github.com/kubeovn/kubevirt-client-go v0.0.0-20240412101643-286960f75418/go.mod h1:esE8jyUJZGyG7S9wm7tcma1h2Rx48C6at68mHhizWnQ=
github.com/kubeovn/libovsdb v0.0.0-20240218023647-f0bc3ce57fcd h1:GhgvSBFKEkVNgDq8IslC04NVuoznreZH/Imz/cr6bhs=
github.com/kubeovn/libovsdb v0.0.0-20240218023647-f0bc3ce57fcd/go.mod h1:pTnlGt1JZrncr6pJn/Fhnp3FFTMQRaTVxiSKBLVGa5s=
github.com/kubeovn/netlink v0.0.0-20240218024530-d3ada5dae96f h1:3hH6U+CRilak3SxAX9YykAXxxAY25GTEJANLlJNE2jU=
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ func (c *Controller) reconcileAllocateSubnets(cachedPod, pod *v1.Pod, needAlloca
pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, podNet.ProviderName)] = "true"

if vmKey != "" {
pod.Annotations[fmt.Sprintf(util.VMTemplate, podNet.ProviderName)] = vmName
pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, podNet.ProviderName)] = vmName
if err := c.changeVMSubnet(vmName, namespace, podNet.ProviderName, subnet.Name); err != nil {
klog.Errorf("vm %s change subnet to %s failed: %v", vmKey, subnet.Name, err)
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions pkg/daemon/controller_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ func (c *Controller) handlePod(key string) error {
}

podName := pod.Name
if pod.Annotations[fmt.Sprintf(util.VMTemplate, util.OvnProvider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMTemplate, util.OvnProvider)]
if pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)]
}

// set default nic bandwidth
Expand Down Expand Up @@ -561,8 +561,8 @@ func (c *Controller) handlePod(key string) error {
}
for _, multiNet := range attachNets {
provider := fmt.Sprintf("%s.%s.%s", multiNet.Name, multiNet.Namespace, util.OvnProvider)
if pod.Annotations[fmt.Sprintf(util.VMTemplate, provider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMTemplate, provider)]
if pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, provider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, provider)]
}
if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" {
ifaceID = ovs.PodNameToPortName(podName, pod.Namespace, provider)
Expand Down
8 changes: 4 additions & 4 deletions pkg/daemon/controller_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ func (c *Controller) handlePod(key string) error {
}

podName := pod.Name
if pod.Annotations[fmt.Sprintf(util.VMTemplate, util.OvnProvider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMTemplate, util.OvnProvider)]
if pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)]
}

// set default nic bandwidth
Expand All @@ -184,8 +184,8 @@ func (c *Controller) handlePod(key string) error {
}
for _, multiNet := range attachNets {
provider := fmt.Sprintf("%s.%s.%s", multiNet.Name, multiNet.Namespace, util.OvnProvider)
if pod.Annotations[fmt.Sprintf(util.VMTemplate, provider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMTemplate, provider)]
if pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, provider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, provider)]
}
if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" {
ifaceID = ovs.PodNameToPortName(podName, pod.Namespace, provider)
Expand Down
4 changes: 2 additions & 2 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
loss = pod.Annotations[fmt.Sprintf(util.NetemQosLossAnnotationTemplate, podRequest.Provider)]
jitter = pod.Annotations[fmt.Sprintf(util.NetemQosJitterAnnotationTemplate, podRequest.Provider)]
providerNetwork = pod.Annotations[fmt.Sprintf(util.ProviderNetworkTemplate, podRequest.Provider)]
vmName = pod.Annotations[fmt.Sprintf(util.VMTemplate, podRequest.Provider)]
vmName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, podRequest.Provider)]
ipAddr, err = util.GetIPAddrWithMask(ip, cidr)
if err != nil {
errMsg := fmt.Errorf("failed to get ip address with mask, %v", err)
Expand Down Expand Up @@ -486,7 +486,7 @@ func (csh cniServerHandler) handleDel(req *restful.Request, resp *restful.Respon
default:
nicType = pod.Annotations[fmt.Sprintf(util.PodNicAnnotationTemplate, podRequest.Provider)]
}
vmName := pod.Annotations[fmt.Sprintf(util.VMTemplate, podRequest.Provider)]
vmName := pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, podRequest.Provider)]
if vmName != "" {
podRequest.PodName = vmName
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
VipAnnotation = "ovn.kubernetes.io/vip"
AAPsAnnotation = "ovn.kubernetes.io/aaps"
ChassisAnnotation = "ovn.kubernetes.io/chassis"
VMAnnotation = "ovn.kubernetes.io/virtualmachine"

ExternalIPAnnotation = "ovn.kubernetes.io/external_ip"
ExternalMacAnnotation = "ovn.kubernetes.io/external_mac"
Expand Down Expand Up @@ -85,7 +86,7 @@ const (
ProviderNetworkMtuTemplate = "%s.provider-network.kubernetes.io/mtu"
MirrorControlAnnotationTemplate = "%s.kubernetes.io/mirror"
PodNicAnnotationTemplate = "%s.kubernetes.io/pod_nic_type"
VMTemplate = "%s.kubernetes.io/virtualmachine"
VMAnnotationTemplate = "%s.kubernetes.io/virtualmachine"

ExcludeIpsAnnotation = "ovn.kubernetes.io/exclude_ips"

Expand Down
Loading

0 comments on commit 41dfa54

Please sign in to comment.