-
Notifications
You must be signed in to change notification settings - Fork 260
Generate VethName based on podname and namespace in CNI #143
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
Conversation
cni/network/network.go
Outdated
|
|
||
| k8sPodName := string(podCfg.K8S_POD_NAME) | ||
| if len(k8sPodName) == 0 { | ||
| err = plugin.Errorf("No k8s pod namespace provided.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update log.
cni/network/network.go
Outdated
| k8sPodName := string(podCfg.K8S_POD_NAME) | ||
| if len(k8sPodName) == 0 { | ||
| err = plugin.Errorf("No k8s pod namespace provided.") | ||
| return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return plugin.Errorf(...)?
| errEndpointInUse = fmt.Errorf("Endpoint is already joined to a sandbox") | ||
| errEndpointNotInUse = fmt.Errorf("Endpoint is not joined to a sandbox") | ||
|
|
||
| OptVethName = "vethname" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a const file to add this to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are following the same thing in ipam/api.go
cni/network/network.go
Outdated
| k8sNamespace := string(podCfg.K8S_POD_NAMESPACE) | ||
| if len(k8sNamespace) == 0 { | ||
| err = plugin.Errorf("No k8s pod namespace provided.") | ||
| return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please log here as well
|
|
||
| // Parse network configuration from stdin. | ||
| nwCfg, err = cni.ParseNetworkConfig(args.StdinData) | ||
| if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets log the err here
What this PR does / why we need it:
Generate VethName based on podname and namespace in CNI. The function will generate hash of the key provided and return first 11 characters of hash. The key is "podname.podnamespace" in CNI.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: