From 20fb0b5eb180fb4cb9be18ab3fc8cd259c7f7bf0 Mon Sep 17 00:00:00 2001 From: Marian Lobur Date: Mon, 9 Jul 2018 10:25:41 +0200 Subject: [PATCH] Fix truncating and buffering backends integration. --- .../k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go | 1 + .../k8s.io/apiserver/plugin/pkg/audit/truncate/truncate.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go b/staging/src/k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go index c821d0a89ea..f50e5ad6d62 100644 --- a/staging/src/k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go +++ b/staging/src/k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go @@ -102,6 +102,7 @@ type bufferedBackend struct { var _ audit.Backend = &bufferedBackend{} // NewBackend returns a buffered audit backend that wraps delegate backend. +// Buffered backend automatically runs and shuts down the delegate backend. func NewBackend(delegate audit.Backend, config BatchConfig) audit.Backend { var throttle flowcontrol.RateLimiter if config.ThrottleEnable { diff --git a/staging/src/k8s.io/apiserver/plugin/pkg/audit/truncate/truncate.go b/staging/src/k8s.io/apiserver/plugin/pkg/audit/truncate/truncate.go index 79e6876cefa..e06f1f2f057 100644 --- a/staging/src/k8s.io/apiserver/plugin/pkg/audit/truncate/truncate.go +++ b/staging/src/k8s.io/apiserver/plugin/pkg/audit/truncate/truncate.go @@ -62,6 +62,7 @@ type backend struct { var _ audit.Backend = &backend{} // NewBackend returns a new truncating backend, using configuration passed in the parameters. +// Truncate backend automatically runs and shut downs the delegate backend. func NewBackend(delegateBackend audit.Backend, config Config, groupVersion schema.GroupVersion) audit.Backend { return &backend{ delegateBackend: delegateBackend, @@ -128,12 +129,11 @@ func truncate(e *auditinternal.Event) *auditinternal.Event { } func (b *backend) Run(stopCh <-chan struct{}) error { - // Nothing to do here - return nil + return b.delegateBackend.Run(stopCh) } func (b *backend) Shutdown() { - // Nothing to do here + b.delegateBackend.Shutdown() } func (b *backend) calcSize(e *auditinternal.Event) (int64, error) {