forked from github/multus-cni
Fix error type for NoK8sNetworkError
This fix changes type type for NoK8sNetworkError due to error handling, in #45. Currently NoK8sNetworkError is not pointer type, just a string, hence we never get *NoK8sNetworkError. This fix changes it based @One-ders patch.
This commit is contained in:
committed by
Kuralamudhan Ramakrishnan
parent
82bece6d73
commit
0bdadc7f39
@@ -336,17 +336,19 @@ func cmdDel(args *skel.CmdArgs) error {
|
||||
|
||||
if in.Kubeconfig != "" {
|
||||
podDelegate, r := k8s.GetK8sNetwork(args, in.Kubeconfig)
|
||||
if r != nil && r.Error() == "nonet" {
|
||||
nopodnet = true
|
||||
if !defaultcninetwork {
|
||||
return fmt.Errorf("Multus: Err in getting k8s network from the poc spec, check the pod spec or set delegate for the default network, Refer the README.md: %v", r)
|
||||
if r != nil {
|
||||
if _, ok := r.(*k8s.NoK8sNetworkError); ok {
|
||||
nopodnet = true
|
||||
// no network found from default and annotaed network,
|
||||
// we do nothing to remove network for the pod!
|
||||
if !defaultcninetwork {
|
||||
return fmt.Errorf("Multus: Err in getting k8s network from the poc spec, check the pod spec or set delegate for the default network, Refer the README.md: %v", r)
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("Multus: Err in getting k8s network from pod: %v", r)
|
||||
}
|
||||
}
|
||||
|
||||
if r != nil && !defaultcninetwork {
|
||||
return fmt.Errorf("Multus: Err in getting k8s network from pod: %v", r)
|
||||
}
|
||||
|
||||
if len(podDelegate) != 0 {
|
||||
if in.UseDefault {
|
||||
// In the case that we force the default
|
||||
|
Reference in New Issue
Block a user