Skip to content

Commit

Permalink
fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
aojea committed Apr 20, 2024
1 parent 64559b2 commit ae5908f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ linters:
- staticcheck
- stylecheck
- typecheck

issues:
exclude-rules:
# metrics use the names of the kernel variables using snake case format
- path: pkg/networkpolicy/metrics.go
linters:
- stylecheck
6 changes: 3 additions & 3 deletions pkg/networkpolicy/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (c *Controller) Run(ctx context.Context) error {
func (c *Controller) syncNFTablesRules(ctx context.Context) {
rule := fmt.Sprintf("ct state new queue to %d", c.config.QueueID)
if c.config.FailOpen {
rule = rule + " bypass"
rule += " bypass"
}
table := &knftables.Table{
Comment: knftables.PtrTo("rules for kubernetes NetworkPolicy"),
Expand Down Expand Up @@ -455,10 +455,10 @@ func (c *Controller) acceptPacket(p packet) bool {

msg := fmt.Sprintf("checking packet %s:", p.String())
if srcPod != nil {
msg = msg + fmt.Sprintf(" SrcPod (%s/%s): %d NetworkPolicy", srcPod.Name, srcPod.Namespace, len(srcPodNetworkPolices))
msg += fmt.Sprintf(" SrcPod (%s/%s): %d NetworkPolicy", srcPod.Name, srcPod.Namespace, len(srcPodNetworkPolices))
}
if dstPod != nil {
msg = msg + fmt.Sprintf(" DstPod (%s/%s): %d NetworkPolicy", dstPod.Name, dstPod.Namespace, len(dstPodNetworkPolices))
msg += fmt.Sprintf(" DstPod (%s/%s): %d NetworkPolicy", dstPod.Name, dstPod.Namespace, len(dstPodNetworkPolices))
}
klog.V(2).Infof("%s", msg)

Expand Down

0 comments on commit ae5908f

Please sign in to comment.