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

Handle pod deletion when PrevResult has VLAN 0 #2323

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion cmd/routed-eni-cni-plugin/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,13 @@ func tryDelWithPrevResult(driverClient driver.NetworkAPIs, conf *NetConf, k8sArg
return false, nil
}
podVlanID, err := strconv.Atoi(dummyIface.Mac)
if err != nil || podVlanID == 0 {
if err != nil {
return true, errors.Errorf("malformed vlanID in prevResult: %s", dummyIface.Mac)
}
// If VLAN value is 0, return without handling so that normal delete logic can occur.
jdn5126 marked this conversation as resolved.
Show resolved Hide resolved
if podVlanID == 0 {
return false, nil
}
if isNetnsEmpty(netNS) {
log.Infof("Ignoring TeardownPodENI as Netns is empty for SG pod:%s namespace: %s containerID:%s", k8sArgs.K8S_POD_NAME, k8sArgs.K8S_POD_NAMESPACE, k8sArgs.K8S_POD_INFRA_CONTAINER_ID)
return true, nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/routed-eni-cni-plugin/cni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func Test_tryDelWithPrevResult(t *testing.T) {
wantErr: errors.New("malformed vlanID in prevResult: xxx"),
},
{
name: "malformed vlanID in prevResult - 0",
name: "vlanID in prevResult - 0",
fields: fields{},
args: args{
conf: &NetConf{
Expand Down Expand Up @@ -643,7 +643,7 @@ func Test_tryDelWithPrevResult(t *testing.T) {
},
contVethName: "eth0",
},
wantErr: errors.New("malformed vlanID in prevResult: 0"),
want: false,
},
{
name: "confVeth don't exists",
Expand Down