Skip to content

Commit

Permalink
Add back empty check & delete to cni plugin. (#33802)
Browse files Browse the repository at this point in the history
  • Loading branch information
bianpengyuan authored Jul 2, 2021
1 parent 284f3ab commit 1a9b489
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cni/cmd/istio-cni/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ func main() {
os.Exit(1)
}
// TODO: implement plugin version
skel.PluginMain(plugin.CmdAdd, nil, nil, version.All, fmt.Sprintf("CNI plugin istio-cni %v", istioversion.Info.Version))
skel.PluginMain(plugin.CmdAdd, plugin.CmdCheck, plugin.CmdDelete, version.All,
fmt.Sprintf("CNI plugin istio-cni %v", istioversion.Info.Version))
}
11 changes: 10 additions & 1 deletion cni/pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"net"
"runtime/debug"
"strconv"
"time"

Expand Down Expand Up @@ -122,7 +123,7 @@ func CmdAdd(args *skel.CmdArgs) (err error) {
// a proper error to the runtime.
defer func() {
if e := recover(); e != nil {
msg := fmt.Sprintf("istio-cni panicked during cmdAdd: %v", e)
msg := fmt.Sprintf("istio-cni panicked during cmdAdd: %v\n%v", e, string(debug.Stack()))
if err != nil {
// If we're recovering and there was also an error, then we need to
// present both.
Expand Down Expand Up @@ -273,3 +274,11 @@ func CmdAdd(args *skel.CmdArgs) (err error) {
}
return types.PrintResult(result, conf.CNIVersion)
}

func CmdCheck(args *skel.CmdArgs) (err error) {
return nil
}

func CmdDelete(args *skel.CmdArgs) (err error) {
return nil
}

0 comments on commit 1a9b489

Please sign in to comment.