mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
Fix bug in dockershim to set sandbox id properly.
This commit is contained in:
@@ -56,14 +56,16 @@ func toRuntimeAPIContainer(c *dockertypes.Container) (*runtimeApi.Container, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
labels, annotations := extractLabels(c.Labels)
|
labels, annotations := extractLabels(c.Labels)
|
||||||
|
sandboxID := c.Labels[sandboxIDLabelKey]
|
||||||
return &runtimeApi.Container{
|
return &runtimeApi.Container{
|
||||||
Id: &c.ID,
|
Id: &c.ID,
|
||||||
Metadata: metadata,
|
PodSandboxId: &sandboxID,
|
||||||
Image: &runtimeApi.ImageSpec{Image: &c.Image},
|
Metadata: metadata,
|
||||||
ImageRef: &c.ImageID,
|
Image: &runtimeApi.ImageSpec{Image: &c.Image},
|
||||||
State: &state,
|
ImageRef: &c.ImageID,
|
||||||
Labels: labels,
|
State: &state,
|
||||||
Annotations: annotations,
|
Labels: labels,
|
||||||
|
Annotations: annotations,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,13 +73,14 @@ func TestListContainers(t *testing.T) {
|
|||||||
// Prepend to the expected list because ListContainers returns
|
// Prepend to the expected list because ListContainers returns
|
||||||
// the most recent containers first.
|
// the most recent containers first.
|
||||||
expected = append([]*runtimeApi.Container{{
|
expected = append([]*runtimeApi.Container{{
|
||||||
Metadata: configs[i].Metadata,
|
Metadata: configs[i].Metadata,
|
||||||
Id: &id,
|
Id: &id,
|
||||||
State: &state,
|
PodSandboxId: &sandboxID,
|
||||||
Image: configs[i].Image,
|
State: &state,
|
||||||
ImageRef: &imageRef,
|
Image: configs[i].Image,
|
||||||
Labels: configs[i].Labels,
|
ImageRef: &imageRef,
|
||||||
Annotations: configs[i].Annotations,
|
Labels: configs[i].Labels,
|
||||||
|
Annotations: configs[i].Annotations,
|
||||||
}}, expected...)
|
}}, expected...)
|
||||||
}
|
}
|
||||||
containers, err := ds.ListContainers(nil)
|
containers, err := ds.ListContainers(nil)
|
||||||
|
Reference in New Issue
Block a user