Skip removing vnet namespace in Linux CNI Multitenancy (#1841)
merging it since this PR already passes e2e once
This commit is contained in:
Родитель
f619259613
Коммит
2caddd1387
|
@ -513,15 +513,18 @@ func (client *TransparentVlanEndpointClient) DeleteEndpointsImpl(ep *endpoint, g
|
|||
|
||||
log.Printf("[transparent vlan] There are %d routes remaining after deletion", routesLeft)
|
||||
|
||||
if routesLeft <= numDefaultRoutes {
|
||||
// Deletes default arp, default routes, vlan veth; there are two default routes
|
||||
// so when we have <= numDefaultRoutes routes left, no containers use this namespace
|
||||
log.Printf("[transparent vlan] Deleting namespace %s as no containers occupy it", client.vnetNSName)
|
||||
delErr := client.netnsClient.DeleteNamed(client.vnetNSName)
|
||||
if delErr != nil {
|
||||
return errors.Wrap(delErr, "failed to delete namespace")
|
||||
// TODO: revist if this require in future.
|
||||
//nolint gocritic
|
||||
/* if routesLeft <= numDefaultRoutes {
|
||||
// Deletes default arp, default routes, vlan veth; there are two default routes
|
||||
// so when we have <= numDefaultRoutes routes left, no containers use this namespace
|
||||
log.Printf("[transparent vlan] Deleting namespace %s as no containers occupy it", client.vnetNSName)
|
||||
delErr := client.netnsClient.DeleteNamed(client.vnetNSName)
|
||||
if delErr != nil {
|
||||
return errors.Wrap(delErr, "failed to delete namespace")
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -432,33 +432,34 @@ func TestTransparentVlanDeleteEndpoints(t *testing.T) {
|
|||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Delete endpoint fail to delete namespace",
|
||||
client: &TransparentVlanEndpointClient{
|
||||
primaryHostIfName: "eth0",
|
||||
vlanIfName: "eth0.1",
|
||||
vnetVethName: "A1veth0",
|
||||
containerVethName: "B1veth0",
|
||||
vnetNSName: "az_ns_1",
|
||||
netnsClient: &mockNetns{
|
||||
deleteNamed: func(name string) (err error) {
|
||||
return newNetnsErrorMock("netns failure")
|
||||
//nolint gocritic
|
||||
/* {
|
||||
name: "Delete endpoint fail to delete namespace",
|
||||
client: &TransparentVlanEndpointClient{
|
||||
primaryHostIfName: "eth0",
|
||||
vlanIfName: "eth0.1",
|
||||
vnetVethName: "A1veth0",
|
||||
containerVethName: "B1veth0",
|
||||
vnetNSName: "az_ns_1",
|
||||
netnsClient: &mockNetns{
|
||||
deleteNamed: func(name string) (err error) {
|
||||
return newNetnsErrorMock("netns failure")
|
||||
},
|
||||
},
|
||||
netlink: netlink.NewMockNetlink(false, ""),
|
||||
plClient: platform.NewMockExecClient(false),
|
||||
netUtilsClient: networkutils.NewNetworkUtils(nl, plc),
|
||||
netioshim: netio.NewMockNetIO(false, 0),
|
||||
},
|
||||
netlink: netlink.NewMockNetlink(false, ""),
|
||||
plClient: platform.NewMockExecClient(false),
|
||||
netUtilsClient: networkutils.NewNetworkUtils(nl, plc),
|
||||
netioshim: netio.NewMockNetIO(false, 0),
|
||||
},
|
||||
ep: &endpoint{
|
||||
IPAddresses: IPAddresses,
|
||||
},
|
||||
routesLeft: func() (int, error) {
|
||||
return numDefaultRoutes, nil
|
||||
},
|
||||
wantErr: true,
|
||||
wantErrMsg: "failed to delete namespace: netns failure: " + errNetnsMock.Error(),
|
||||
},
|
||||
ep: &endpoint{
|
||||
IPAddresses: IPAddresses,
|
||||
},
|
||||
routesLeft: func() (int, error) {
|
||||
return numDefaultRoutes, nil
|
||||
},
|
||||
wantErr: true,
|
||||
wantErrMsg: "failed to delete namespace: netns failure: " + errNetnsMock.Error(),
|
||||
},*/
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
Загрузка…
Ссылка в новой задаче