mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #99680 from CaoDonghui123/fixissues4
fix error of setting negative value for containerLogMaxSize
This commit is contained in:
commit
88c0e8968b
@ -138,9 +138,6 @@ func parseMaxSize(size string) (int64, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return 0, fmt.Errorf("invalid max log size")
|
return 0, fmt.Errorf("invalid max log size")
|
||||||
}
|
}
|
||||||
if maxSize < 0 {
|
|
||||||
return 0, fmt.Errorf("negative max log size %d", maxSize)
|
|
||||||
}
|
|
||||||
return maxSize, nil
|
return maxSize, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +158,10 @@ func NewContainerLogManager(runtimeService internalapi.RuntimeService, osInterfa
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse container log max size %q: %v", maxSize, err)
|
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
|
// policy LogRotatePolicy
|
||||||
return &containerLogManager{
|
return &containerLogManager{
|
||||||
osInterface: osInterface,
|
osInterface: osInterface,
|
||||||
|
Loading…
Reference in New Issue
Block a user