Skip HotAttachEp from CNM createEndpoint (#332)
* Skip HotAttachEp from CNM create endpoint * Address review comments
This commit is contained in:
Родитель
a1f804a912
Коммит
e28f5836d0
|
@ -452,6 +452,7 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error {
|
|||
EnableInfraVnet: enableInfraVnet,
|
||||
PODName: k8sPodName,
|
||||
PODNameSpace: k8sNamespace,
|
||||
SkipHotAttachEp: false, // Hot attach at the time of endpoint creation
|
||||
}
|
||||
|
||||
epPolicies := getPoliciesFromRuntimeCfg(nwCfg)
|
||||
|
|
|
@ -231,6 +231,7 @@ func (plugin *netPlugin) createEndpoint(w http.ResponseWriter, r *http.Request)
|
|||
epInfo := network.EndpointInfo{
|
||||
Id: req.EndpointID,
|
||||
IPAddresses: []net.IPNet{*ipv4Address},
|
||||
SkipHotAttachEp: true, // Skip hot attach endpoint as it's done in Join
|
||||
}
|
||||
|
||||
epInfo.Data = make(map[string]interface{})
|
||||
|
|
|
@ -61,6 +61,7 @@ type EndpointInfo struct {
|
|||
PODNameSpace string
|
||||
Data map[string]interface{}
|
||||
InfraVnetAddressSpace string
|
||||
SkipHotAttachEp bool
|
||||
}
|
||||
|
||||
// RouteInfo contains information about an IP route.
|
||||
|
|
|
@ -94,6 +94,10 @@ func (nw *network) newEndpointImpl(epInfo *EndpointInfo) (*endpoint, error) {
|
|||
}
|
||||
}()
|
||||
|
||||
if epInfo.SkipHotAttachEp {
|
||||
log.Printf("[net] Skipping attaching the endpoint %v to container %v.",
|
||||
hnsResponse.Id, epInfo.ContainerID)
|
||||
} else {
|
||||
// Attach the endpoint.
|
||||
log.Printf("[net] Attaching endpoint %v to container %v.", hnsResponse.Id, epInfo.ContainerID)
|
||||
err = hcsshim.HotAttachEndpoint(epInfo.ContainerID, hnsResponse.Id)
|
||||
|
@ -101,6 +105,7 @@ func (nw *network) newEndpointImpl(epInfo *EndpointInfo) (*endpoint, error) {
|
|||
log.Printf("[net] Failed to attach endpoint: %v.", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Create the endpoint object.
|
||||
ep := &endpoint{
|
||||
|
|
Загрузка…
Ссылка в новой задаче