mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 13:14:05 +00:00
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:
@@ -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")
|
||||
|
@@ -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,
|
||||
},
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user