Combine RequestAuditConfig with RequestAuditConfigWithLevel
This commit is contained in:
@@ -50,14 +50,14 @@ func TestWebhookLoopback(t *testing.T) {
|
||||
|
||||
// Hook into audit to watch requests
|
||||
config.GenericConfig.AuditBackend = auditSinkFunc(func(events ...*auditinternal.Event) {})
|
||||
config.GenericConfig.AuditPolicyRuleEvaluator = auditPolicyRuleEvaluator(func(attrs authorizer.Attributes) audit.RequestAuditConfigWithLevel {
|
||||
config.GenericConfig.AuditPolicyRuleEvaluator = auditPolicyRuleEvaluator(func(attrs authorizer.Attributes) audit.RequestAuditConfig {
|
||||
if attrs.GetPath() == webhookPath {
|
||||
if attrs.GetUser().GetName() != "system:apiserver" {
|
||||
t.Errorf("expected user %q, got %q", "system:apiserver", attrs.GetUser().GetName())
|
||||
}
|
||||
atomic.AddInt32(&called, 1)
|
||||
}
|
||||
return audit.RequestAuditConfigWithLevel{
|
||||
return audit.RequestAuditConfig{
|
||||
Level: auditinternal.LevelNone,
|
||||
}
|
||||
})
|
||||
@@ -107,9 +107,9 @@ func TestWebhookLoopback(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type auditPolicyRuleEvaluator func(authorizer.Attributes) audit.RequestAuditConfigWithLevel
|
||||
type auditPolicyRuleEvaluator func(authorizer.Attributes) audit.RequestAuditConfig
|
||||
|
||||
func (f auditPolicyRuleEvaluator) EvaluatePolicyRule(attrs authorizer.Attributes) audit.RequestAuditConfigWithLevel {
|
||||
func (f auditPolicyRuleEvaluator) EvaluatePolicyRule(attrs authorizer.Attributes) audit.RequestAuditConfig {
|
||||
return f(attrs)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user