8000 Make ns prepend more explicit. Fix unit test name · nginx/kubernetes-ingress@5d5efce · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d5efce

Browse files
committed
Make ns prepend more explicit. Fix unit test name
1 parent ef3839f commit 5d5efce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

internal/configs/virtualserver.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ func (p *policiesCfg) addWAFConfig(
953953

954954
if waf.ApPolicy != "" {
955955
apPolKey := waf.ApPolicy
956-
if !strings.Contains(apPolKey, "/") {
956+
hasNamepace := strings.Contains(apPolKey, "/")
957+
if !hasNamepace {
957958
apPolKey = fmt.Sprintf("%v/%v", polNamespace, apPolKey)
958959
}
959960

@@ -970,7 +971,8 @@ func (p *policiesCfg) addWAFConfig(
970971
p.WAF.ApSecurityLogEnable = true
971972

972973
logConfKey := waf.SecurityLog.ApLogConf
973-
if !strings.Contains(logConfKey, "/") {
974+
hasNamepace := strings.Contains(logConfKey, "/")
975+
if !hasNamepace {
974976
logConfKey = fmt.Sprintf("%v/%v", polNamespace, logConfKey)
975977
}
976978

internal/k8s/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ func TestGetWAFPoliciesForAppProtectLogConf(t *testing.T) {
21062106
pols: policies,
21072107
key: "ns2/logConf",
21082108
want: []*conf_v1.Policy{logConfNs2},
2109-
msg: "WAF pols that ref apPol which is in another ns",
2109+
msg: "WAF pols that ref logConf which is in another ns",
21102110
},
21112111
{
21122112
pols: policies,

0 commit comments

Comments
 (0)
0