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

Quality of life enhancements for CNI delegation code #63

Merged
merged 2 commits into from
Apr 1, 2019
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
Next Next commit
Cosmetical fixes: removing accidentally committed debug logs, adding …
…important disclaimer about DanmNet deletion to README, updating Glide lock file
  • Loading branch information
Levovar committed Mar 19, 2019
commit a518dbbe1aa6ff71363809acaa8e5c18396ac7b4
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,18 @@ Spec:
Validation: True
Events: <none>
```

__BE WARNED: DANM stores pretty important information in DanmNet objects. Under no circumstances shall a DanmNet be deleted, if there are any runnning Pods referencing it!__
__Such action will undoubtedly lead to undefined behaviour!__
#### Generally supported DANM API features
##### Naming container interfaces
Generally speaking, you need to care about how the network interfaces of your Pods are named inside their respective network namespaces.
The hard reality to keep in mind is that you shall always have an interface literally called "eth0" created within all your Kubernetes Pods, because Kubelet will always search for the existence of such an interface at the end of Pod instantiation.
If such an interface does not exist after CNI is invoked, the state of the Pod will be considered "faulty", and it will be re-created in a loop.
If such an interface does not exist after CNI is invoked (also having an IPv4 address), the state of the Pod will be considered "faulty", and it will be re-created in a loop.
To be able to comply with this Kubernetes limitation, DANM supports both explicit, and implicit interface naming schemes for all NetworkTypes!

An interface connected to a DanmNet containing the container_prefix attribute will be always named accordingly. You can use this API to explicitly set descriptive, unique names to NICs connecting to this network.
In case container_prefix is not set in an interface's network descriptor, DANM will automatically name the interface "ethX", where X is a unique integer number corresponding to the sequence number of the network connection (e.g. the first interface defined in the annotation is called "eth0", second interface "eth1" etc.)
In case container_prefix is not set in an interface's network descriptor, DANM automatically names the interface "ethX", where X is a unique integer number corresponding to the sequence number of the network connection (e.g. the first interface defined in the annotation is called "eth0", second interface "eth1" etc.)
DANM even supports the mixing of the networking schemes within the same Pod, and it supports the whole naming scheme for all network backends.
While the feature provides complete control over the name of interfaces, ultimately it is the network administrators' responsibility to:
- make sure exactly one interface is named eth0 in every Pod
Expand Down
15 changes: 13 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions pkg/cnidel/cniconfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package cnidel

import (
"errors"
"log"
"io/ioutil"
"encoding/json"
"github.com/nokia/danm/pkg/danmep"
"io/ioutil"
danmtypes "github.com/nokia/danm/crd/apis/danm/v1"
"github.com/nokia/danm/pkg/danmep"
sriov_utils "github.com/intel/sriov-cni/pkg/utils"
)

Expand Down Expand Up @@ -80,7 +79,6 @@ func getMacvlanCniConfig(netInfo *danmtypes.DanmNet, ipamOptions danmtypes.IpamC
MTU: 1500,
Ipam: ipamOptions,
}
log.Printf("LOFASZ MACVLAN CONFIG %v/n",macvlanConfig)
rawConfig, err := json.Marshal(macvlanConfig)
if err != nil {
return nil, errors.New("Error putting together CNI config for MACVLAN plugin: " + err.Error())
Expand Down
5 changes: 1 addition & 4 deletions pkg/danmep/ep.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ func createContainerIface(ep danmtypes.DanmEp, dnet *danmtypes.DanmNet, device s
log.Println("Could not switch back to default ns during IPVLAN interface creation:" + err.Error())
}
}()
//cns,_ := ns.GetCurrentNS()
cpath := origns.Path()
log.Println("EP NS BASE PATH:" + cpath)
iface, err := netlink.LinkByName(device)
if err != nil {
return errors.New("cannot find host device because:" + err.Error())
Expand Down Expand Up @@ -138,7 +135,7 @@ func sendGratArps(srcAddrIpV4, srcAddrIpV6, ifaceName string) {
err = executeArping(srcAddrIpV6, ifaceName)
}
if err != nil {
log.Println(err.Error())
log.Println("WARNING: sending gARP Reply failed with error:" + err.Error(), " , but we will ignore that for now!")
}
}

Expand Down