Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5f4ff9f2
Commit
5f4ff9f2
authored
Oct 05, 2017
by
Mik Vyatskov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust defaults of audit webhook backends
Signed-off-by:
Mik Vyatskov
<
vmik@google.com
>
parent
d2bbeb66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
BUILD
staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook/BUILD
+1
-0
webhook.go
.../src/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook.go
+10
-7
No files found.
staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook/BUILD
View file @
5f4ff9f2
...
...
@@ -41,6 +41,7 @@ go_library(
"//vendor/k8s.io/apiserver/pkg/apis/audit/v1beta1:go_default_library",
"//vendor/k8s.io/apiserver/pkg/audit:go_default_library",
"//vendor/k8s.io/apiserver/pkg/util/webhook:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
...
...
staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook.go
View file @
5f4ff9f2
...
...
@@ -34,6 +34,7 @@ import (
auditv1beta1
"k8s.io/apiserver/pkg/apis/audit/v1beta1"
"k8s.io/apiserver/pkg/audit"
"k8s.io/apiserver/pkg/util/webhook"
"k8s.io/client-go/rest"
)
const
(
...
...
@@ -58,9 +59,10 @@ const (
//
// TODO(ericchiang): Make these value configurable. Maybe through a
// kubeconfig extension?
defaultBatchBufferSize
=
1000
// Buffer up to 1000 events before blocking.
defaultBatchMaxSize
=
100
// Only send 100 events at a time.
defaultBatchMaxWait
=
time
.
Minute
// Send events at least once a minute.
defaultBatchBufferSize
=
10000
// Buffer up to 10000 events before starting discarding.
defaultBatchMaxSize
=
400
// Only send up to 400 events at a time.
defaultBatchMaxWait
=
30
*
time
.
Second
// Send events at least twice a minute.
defaultInitialBackoff
=
10
*
time
.
Second
// Wait at least 10 seconds before retrying.
)
// The plugin name reported in error metrics.
...
...
@@ -100,7 +102,8 @@ func init() {
}
func
loadWebhook
(
configFile
string
,
groupVersion
schema
.
GroupVersion
)
(
*
webhook
.
GenericWebhook
,
error
)
{
return
webhook
.
NewGenericWebhook
(
registry
,
audit
.
Codecs
,
configFile
,
[]
schema
.
GroupVersion
{
groupVersion
},
0
)
return
webhook
.
NewGenericWebhook
(
registry
,
audit
.
Codecs
,
configFile
,
[]
schema
.
GroupVersion
{
groupVersion
},
defaultInitialBackoff
)
}
func
newBlockingWebhook
(
configFile
string
,
groupVersion
schema
.
GroupVersion
)
(
*
blockingBackend
,
error
)
{
...
...
@@ -314,9 +317,9 @@ func (b *batchBackend) sendBatchEvents(events []auditinternal.Event) {
defer
b
.
reqMutex
.
RUnlock
()
defer
runtime
.
HandleCrash
()
err
:=
webhook
.
WithExponentialBackoff
(
0
,
func
()
error
{
return
b
.
w
.
RestClient
.
Post
()
.
Body
(
&
list
)
.
Do
()
.
Error
()
})
err
:=
b
.
w
.
WithExponentialBackoff
(
func
()
rest
.
Result
{
return
b
.
w
.
RestClient
.
Post
()
.
Body
(
&
list
)
.
Do
()
})
.
Error
()
if
err
!=
nil
{
impacted
:=
make
([]
*
auditinternal
.
Event
,
len
(
events
))
for
i
:=
range
events
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment