Skip to content

Commit

Permalink
conntrack log delete operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Ojea committed Oct 19, 2020
1 parent 880baa9 commit e3c1777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/util/conntrack/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/klog/v2:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
"//vendor/k8s.io/utils/net:go_default_library",
],
Expand Down
3 changes: 3 additions & 0 deletions pkg/util/conntrack/conntrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"strings"

v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"k8s.io/utils/exec"
utilnet "k8s.io/utils/net"
)
Expand Down Expand Up @@ -62,10 +63,12 @@ func Exec(execer exec.Interface, parameters ...string) error {
if err != nil {
return fmt.Errorf("error looking for path of conntrack: %v", err)
}
klog.V(4).Infof("Clearing conntrack entries %v", parameters)
output, err := execer.Command(conntrackPath, parameters...).CombinedOutput()
if err != nil {
return fmt.Errorf("conntrack command returned: %q, error message: %s", string(output), err)
}
klog.V(4).Infof("Conntrack entries deleted %s", string(output))
return nil
}

Expand Down

0 comments on commit e3c1777

Please sign in to comment.