Skip to content

Commit 974cc92

Browse files
author
Vadim Rutkovsky
committed
auditloganalyzer: include update requests
1 parent a29dd66 commit 974cc92

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/monitortests/kubeapiserver/auditloganalyzer/handle_excessive_applies.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (s *excessiveApplies) HandleAuditLogEvent(auditEvent *auditv1.Event, beginn
9090
if !ok {
9191
users = map[string]int{}
9292
}
93-
users[auditEvent.User.Username] = users[auditEvent.User.Username] + 1
93+
users[auditEvent.User.Username] += 1
9494
s.namespacesToUserToNumberOfApplies[nsName] = users
9595

9696
obj := auditEvent.ObjectRef

pkg/monitortests/kubeapiserver/auditloganalyzer/handle_invalid_requests.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package auditloganalyzer
22

33
import (
4-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
auditv1 "k8s.io/apiserver/pkg/apis/audit/v1"
6-
"k8s.io/apiserver/pkg/authentication/serviceaccount"
74
"net/http"
85
"strings"
96
"sync"
7+
8+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9+
auditv1 "k8s.io/apiserver/pkg/apis/audit/v1"
10+
"k8s.io/apiserver/pkg/authentication/serviceaccount"
1011
)
1112

1213
type invalidRequests struct {
@@ -76,7 +77,7 @@ func CheckForInvalidMutations() *invalidRequests {
7677

7778
func isApply(auditEvent *auditv1.Event) bool {
7879
// only SSA
79-
if auditEvent.Verb != "patch" {
80+
if auditEvent.Verb != "patch" || auditEvent.Verb == "apply" {
8081
return false
8182
}
8283
// SSA requires a field manager

0 commit comments

Comments
 (0)