Skip to content

Commit

Permalink
Merge pull request kubernetes#102389 from CaoDonghui123/automated-che…
Browse files Browse the repository at this point in the history
…rry-pick-of-#99680-upstream-release-1.21

Automated cherry pick of kubernetes#99680: fix error of setting  negative value for containerLogMaxSize
  • Loading branch information
k8s-ci-robot authored Jul 10, 2021
2 parents c17d7c5 + 539bb65 commit 2999dfa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/kubelet/logs/container_log_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ func parseMaxSize(size string) (int64, error) {
if !ok {
return 0, fmt.Errorf("invalid max log size")
}
if maxSize < 0 {
return 0, fmt.Errorf("negative max log size %d", maxSize)
}
return maxSize, nil
}

Expand All @@ -161,6 +158,10 @@ func NewContainerLogManager(runtimeService internalapi.RuntimeService, osInterfa
if err != nil {
return nil, fmt.Errorf("failed to parse container log max size %q: %v", maxSize, err)
}
// Negative number means to disable container log rotation
if parsedMaxSize < 0 {
return NewStubContainerLogManager(), nil
}
// policy LogRotatePolicy
return &containerLogManager{
osInterface: osInterface,
Expand Down

0 comments on commit 2999dfa

Please sign in to comment.