Merge pull request #117198 from charles-chenzz/deprecated_function

replace ioutil with os, update doc in kubelet
This commit is contained in:
Kubernetes Prow Robot
2023-05-02 08:18:14 -07:00
committed by GitHub
10 changed files with 17 additions and 23 deletions

View File

@@ -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
}

View File

@@ -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