mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Merge pull request #117198 from charles-chenzz/deprecated_function
replace ioutil with os, update doc in kubelet
This commit is contained in:
@@ -293,7 +293,7 @@ func (cgc *containerGC) evictSandboxes(ctx context.Context, evictNonDeletedPods
|
||||
sandboxIDs.Insert(container.PodSandboxId)
|
||||
}
|
||||
|
||||
sandboxesByPod := make(sandboxesByPodUID)
|
||||
sandboxesByPod := make(sandboxesByPodUID, len(sandboxes))
|
||||
for _, sandbox := range sandboxes {
|
||||
podUID := types.UID(sandbox.Metadata.Uid)
|
||||
sandboxInfo := sandboxGCInfo{
|
||||
@@ -301,13 +301,8 @@ func (cgc *containerGC) evictSandboxes(ctx context.Context, evictNonDeletedPods
|
||||
createTime: time.Unix(0, sandbox.CreatedAt),
|
||||
}
|
||||
|
||||
// Set ready sandboxes to be active.
|
||||
if sandbox.State == runtimeapi.PodSandboxState_SANDBOX_READY {
|
||||
sandboxInfo.active = true
|
||||
}
|
||||
|
||||
// Set sandboxes that still have containers to be active.
|
||||
if sandboxIDs.Has(sandbox.Id) {
|
||||
// Set ready sandboxes and sandboxes that still have containers to be active.
|
||||
if sandbox.State == runtimeapi.PodSandboxState_SANDBOX_READY || sandboxIDs.Has(sandbox.Id) {
|
||||
sandboxInfo.active = true
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -407,7 +406,7 @@ func TestReadLogsLimitsWithTimestamps(t *testing.T) {
|
||||
logLineFmt := "2022-10-29T16:10:22.592603036-05:00 stdout P %v\n"
|
||||
logLineNewLine := "2022-10-29T16:10:22.592603036-05:00 stdout F \n"
|
||||
|
||||
tmpfile, err := ioutil.TempFile("", "log.*.txt")
|
||||
tmpfile, err := os.CreateTemp("", "log.*.txt")
|
||||
assert.NoError(t, err)
|
||||
|
||||
count := 10000
|
||||
|
||||
Reference in New Issue
Block a user