Second attempt: Plumb context to Kubelet CRI calls (#113591)

* plumb context from CRI calls through kubelet

* clean up extra timeouts

* try fixing incorrectly cancelled context
This commit is contained in:
David Ashpole
2022-11-05 09:02:13 -04:00
committed by GitHub
parent 27766455f1
commit 64af1adace
115 changed files with 1444 additions and 1190 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package e2enode
import (
"context"
"time"
v1 "k8s.io/api/core/v1"
@@ -77,7 +78,7 @@ var _ = SIGDescribe("ContainerLogRotation [Slow] [Serial] [Disruptive]", func()
id := kubecontainer.ParseContainerID(pod.Status.ContainerStatuses[0].ContainerID).ID
r, _, err := getCRIClient()
framework.ExpectNoError(err)
resp, err := r.ContainerStatus(id, false)
resp, err := r.ContainerStatus(context.Background(), id, false)
framework.ExpectNoError(err)
logPath := resp.GetStatus().GetLogPath()
ginkgo.By("wait for container log being rotated to max file limit")

View File

@@ -20,6 +20,7 @@ limitations under the License.
package e2enode
import (
"context"
"fmt"
"os/exec"
"path"
@@ -160,7 +161,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
ginkgo.By("Dump all running containers")
runtime, _, err := getCRIClient()
framework.ExpectNoError(err)
containers, err := runtime.ListContainers(&runtimeapi.ContainerFilter{
containers, err := runtime.ListContainers(context.Background(), &runtimeapi.ContainerFilter{
State: &runtimeapi.ContainerStateValue{
State: runtimeapi.ContainerState_CONTAINER_RUNNING,
},

View File

@@ -115,7 +115,7 @@ func waitForContainerRemoval(containerName, podName, podNS string) {
rs, _, err := getCRIClient()
framework.ExpectNoError(err)
gomega.Eventually(func() bool {
containers, err := rs.ListContainers(&runtimeapi.ContainerFilter{
containers, err := rs.ListContainers(context.Background(), &runtimeapi.ContainerFilter{
LabelSelector: map[string]string{
types.KubernetesPodNameLabel: podName,
types.KubernetesPodNamespaceLabel: podNS,

View File

@@ -155,7 +155,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
// Initialize the getContainerNames function to use CRI runtime client.
pod.getContainerNames = func() ([]string, error) {
relevantContainers := []string{}
containers, err := runtime.ListContainers(&runtimeapi.ContainerFilter{
containers, err := runtime.ListContainers(context.Background(), &runtimeapi.ContainerFilter{
LabelSelector: map[string]string{
types.KubernetesPodNameLabel: pod.podName,
types.KubernetesPodNamespaceLabel: f.Namespace.Name,

View File

@@ -125,11 +125,11 @@ func (rp *remotePuller) Name() string {
}
func (rp *remotePuller) Pull(image string) ([]byte, error) {
resp, err := rp.imageService.ImageStatus(&runtimeapi.ImageSpec{Image: image}, false)
resp, err := rp.imageService.ImageStatus(context.Background(), &runtimeapi.ImageSpec{Image: image}, false)
if err == nil && resp.GetImage() != nil {
return nil, nil
}
_, err = rp.imageService.PullImage(&runtimeapi.ImageSpec{Image: image}, nil, nil)
_, err = rp.imageService.PullImage(context.Background(), &runtimeapi.ImageSpec{Image: image}, nil, nil)
return nil, err
}

View File

@@ -381,7 +381,7 @@ func waitForAllContainerRemoval(podName, podNS string) {
rs, _, err := getCRIClient()
framework.ExpectNoError(err)
gomega.Eventually(func() bool {
containers, err := rs.ListContainers(&runtimeapi.ContainerFilter{
containers, err := rs.ListContainers(context.Background(), &runtimeapi.ContainerFilter{
LabelSelector: map[string]string{
types.KubernetesPodNameLabel: podName,
types.KubernetesPodNamespaceLabel: podNS,