Skip to content

Commit 2dd2187

Browse files
committed
update to handle audit changes
1 parent 866368d commit 2dd2187

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

pkg/cmd/server/kubernetes/master/master_config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
utilflag "k8s.io/apiserver/pkg/util/flag"
4747
auditlog "k8s.io/apiserver/plugin/pkg/audit/log"
4848
auditwebhook "k8s.io/apiserver/plugin/pkg/audit/webhook"
49+
pluginwebhook "k8s.io/apiserver/plugin/pkg/audit/webhook"
4950
kubeclientgoinformers "k8s.io/client-go/informers"
5051
openapicommon "k8s.io/kube-openapi/pkg/common"
5152
kapiserveroptions "k8s.io/kubernetes/cmd/kube-apiserver/app/options"
@@ -819,7 +820,7 @@ func GetAuditConfig(auditConfig configapi.AuditConfig) (audit.Backend, auditpoli
819820

820821
// webhook configuration, only when config file was provided
821822
if len(auditConfig.WebHookKubeConfig) > 0 {
822-
webhook, err := auditwebhook.NewBackend(auditConfig.WebHookKubeConfig, string(auditConfig.WebHookMode), auditv1beta1.SchemeGroupVersion)
823+
webhook, err := auditwebhook.NewBackend(auditConfig.WebHookKubeConfig, string(auditConfig.WebHookMode), auditv1beta1.SchemeGroupVersion, pluginwebhook.NewDefaultBatchBackendConfig())
823824
if err != nil {
824825
glog.Fatalf("Audit webhook initialization failed: %v", err)
825826
}

pkg/cmd/server/kubernetes/master/master_config_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
apiserveroptions "k8s.io/apiserver/pkg/server/options"
1919
"k8s.io/apiserver/pkg/storage/storagebackend"
2020
utilconfig "k8s.io/apiserver/pkg/util/flag"
21+
pluginwebhook "k8s.io/apiserver/plugin/pkg/audit/webhook"
2122
kubeapiserveroptions "k8s.io/kubernetes/cmd/kube-apiserver/app/options"
2223
cmapp "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
2324
"k8s.io/kubernetes/pkg/api/legacyscheme"
@@ -125,12 +126,22 @@ func TestAPIServerDefaults(t *testing.T) {
125126
EnableHttps: true,
126127
HTTPTimeout: time.Duration(5) * time.Second,
127128
},
129+
// we currently overwrite this entire stanza, but we should be trying to collapse onto the upstream
130+
// flag or config mechanism for kube.
128131
Audit: &apiserveroptions.AuditOptions{
129132
LogOptions: apiserveroptions.AuditLogOptions{
130133
Format: "json",
131134
},
132135
WebhookOptions: apiserveroptions.AuditWebhookOptions{
133136
Mode: "batch",
137+
BatchConfig: pluginwebhook.BatchBackendConfig{
138+
BufferSize: 10000,
139+
MaxBatchSize: 400,
140+
MaxBatchWait: time.Duration(30000000000),
141+
ThrottleQPS: 10,
142+
ThrottleBurst: 15,
143+
InitialBackoff: time.Duration(10000000000),
144+
},
134145
},
135146
},
136147
Features: &apiserveroptions.FeatureOptions{

0 commit comments

Comments
 (0)