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

delete log severity for drop acl when update networkpolicy #1862

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions cmd/daemon/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/http/pprof" // #nosec
"os"
"strings"
"time"

Expand Down Expand Up @@ -92,11 +92,11 @@ func CmdMain() {
}

func mvCNIConf() error {
data, err := ioutil.ReadFile("/kube-ovn/01-kube-ovn.conflist")
data, err := os.ReadFile("/kube-ovn/01-kube-ovn.conflist")
if err != nil {
return err
}
return ioutil.WriteFile("/etc/cni/net.d/01-kube-ovn.conflist", data, 0444)
return os.WriteFile("/etc/cni/net.d/01-kube-ovn.conflist", data, 0444)
}

func Retry(attempts int, sleep int, f func(configuration *daemon.Configuration) error, ctrl *daemon.Configuration) (err error) {
Expand All @@ -114,7 +114,7 @@ func Retry(attempts int, sleep int, f func(configuration *daemon.Configuration)
}

func initChassisAnno(cfg *daemon.Configuration) error {
chassisID, err := ioutil.ReadFile(util.ChassisLoc)
chassisID, err := os.ReadFile(util.ChassisLoc)
if err != nil {
klog.Errorf("read chassis file failed, %v", err)
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/ovnmonitor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ovnmonitor

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"strconv"
"strings"
Expand Down Expand Up @@ -42,7 +42,7 @@ func (e *Exporter) getOvnStatus() map[string]int {
result["ovsdb-server-southbound"] = parseDbStatus(string(output))

// get ovn-northd status
pid, err := ioutil.ReadFile("/var/run/ovn/ovn-northd.pid")
pid, err := os.ReadFile("/var/run/ovn/ovn-northd.pid")
if err != nil {
klog.Errorf("read ovn-northd pid failed, err %v", err)
result["ovn-northd"] = 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ func (c Client) CreateIngressACL(pgName, asIngressName, asExceptName, svcAsName,
if logEnable {
ovnArgs = []string{MayExist, "--type=port-group", "--log", fmt.Sprintf("--severity=%s", "warning"), "acl-add", pgName, "to-lport", util.IngressDefaultDrop, fmt.Sprintf("%s.dst == $%s", ipSuffix, pgAs), "drop"}
} else {
ovnArgs = []string{MayExist, "--type=port-group", fmt.Sprintf("--severity=%s", "warning"), "acl-add", pgName, "to-lport", util.IngressDefaultDrop, fmt.Sprintf("%s.dst == $%s", ipSuffix, pgAs), "drop"}
ovnArgs = []string{MayExist, "--type=port-group", "acl-add", pgName, "to-lport", util.IngressDefaultDrop, fmt.Sprintf("%s.dst == $%s", ipSuffix, pgAs), "drop"}
}

if len(npp) == 0 {
Expand Down Expand Up @@ -1192,7 +1192,7 @@ func (c Client) CreateEgressACL(pgName, asEgressName, asExceptName, protocol str
if logEnable {
ovnArgs = []string{"--", MayExist, "--type=port-group", "--log", fmt.Sprintf("--severity=%s", "warning"), "acl-add", pgName, "from-lport", util.EgressDefaultDrop, fmt.Sprintf("%s.src == $%s", ipSuffix, pgAs), "drop"}
} else {
ovnArgs = []string{"--", MayExist, "--type=port-group", fmt.Sprintf("--severity=%s", "warning"), "acl-add", pgName, "from-lport", util.EgressDefaultDrop, fmt.Sprintf("%s.src == $%s", ipSuffix, pgAs), "drop"}
ovnArgs = []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.EgressDefaultDrop, fmt.Sprintf("%s.src == $%s", ipSuffix, pgAs), "drop"}
}
if len(npp) == 0 {
allowArgs = []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.EgressAllowPriority, fmt.Sprintf("%s.dst == $%s && %s.dst != $%s && %s.src == $%s", ipSuffix, asEgressName, ipSuffix, asExceptName, ipSuffix, pgAs), "allow-related"}
Expand Down