Skip to content

Commit 0e178f9

Browse files
jdefJames DeFelice
authored andcommitted
rename to sharedLimitWriter
1 parent a423005 commit 0e178f9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pkg/kubelet/dockershim/docker_legacy_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func (d *dockerService) GetContainerLogs(_ context.Context, pod *v1.Pod, contain
8181
if logOptions.LimitBytes != nil {
8282
// stdout and stderr share the total write limit
8383
max := *logOptions.LimitBytes
84-
stderr = limitedWriter(stderr, &max)
85-
stdout = limitedWriter(stdout, &max)
84+
stderr = sharedLimitWriter(stderr, &max)
85+
stdout = sharedLimitWriter(stdout, &max)
8686
}
8787
sopts := libdocker.StreamOptions{
8888
OutputStream: stdout,

pkg/kubelet/dockershim/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ func (w sharedWriteLimiter) Write(p []byte) (int, error) {
426426
return n, err
427427
}
428428

429-
func limitedWriter(w io.Writer, limit *int64) io.Writer {
429+
func sharedLimitWriter(w io.Writer, limit *int64) io.Writer {
430430
if w == nil {
431431
return nil
432432
}

pkg/kubelet/dockershim/helpers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func TestLimitedWriter(t *testing.T) {
389389
} {
390390
t.Run(name, func(t *testing.T) {
391391
limit := tc.limit
392-
w := limitedWriter(&tc.w, &limit)
392+
w := sharedLimitWriter(&tc.w, &limit)
393393
n, err := w.Write([]byte(tc.toWrite))
394394
if int64(n) > max(0, tc.limit) {
395395
t.Fatalf("bytes written (%d) exceeds limit (%d)", n, tc.limit)
@@ -421,8 +421,8 @@ func TestLimitedWriter(t *testing.T) {
421421
var (
422422
b1, b2 bytes.Buffer
423423
limit = int64(10)
424-
w1 = limitedWriter(&b1, &limit)
425-
w2 = limitedWriter(&b2, &limit)
424+
w1 = sharedLimitWriter(&b1, &limit)
425+
w2 = sharedLimitWriter(&b2, &limit)
426426
ch = make(chan struct{})
427427
wg sync.WaitGroup
428428
)

0 commit comments

Comments
 (0)