server: inspect: add log path and mount point for cadvisor
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
378b9c0d2f
commit
69fc590fc3
6 changed files with 25 additions and 0 deletions
|
@ -361,6 +361,7 @@ func (c *ContainerServer) LoadSandbox(id string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
scontainer.SetMountPoint(m.Annotations[annotations.MountPoint])
|
||||
|
||||
if m.Annotations[annotations.Volumes] != "" {
|
||||
containerVolumes := []oci.ContainerVolume{}
|
||||
|
@ -483,6 +484,7 @@ func (c *ContainerServer) LoadContainer(id string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctr.SetMountPoint(m.Annotations[annotations.MountPoint])
|
||||
|
||||
c.ContainerStateFromDisk(ctr)
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ type Container struct {
|
|||
imageName string
|
||||
imageRef string
|
||||
volumes []ContainerVolume
|
||||
mountPoint string
|
||||
}
|
||||
|
||||
// ContainerVolume is a bind mount for the container.
|
||||
|
@ -222,3 +223,13 @@ func (c *Container) Volumes() []ContainerVolume {
|
|||
return c.volumes
|
||||
|
||||
}
|
||||
|
||||
// SetMountPoint sets the container mount point
|
||||
func (c *Container) SetMountPoint(mp string) {
|
||||
c.mountPoint = mp
|
||||
}
|
||||
|
||||
// MountPoint returns the container mount point
|
||||
func (c *Container) MountPoint() string {
|
||||
return c.mountPoint
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ const (
|
|||
// ShmPath is the shared memory path annotation
|
||||
ShmPath = "io.kubernetes.cri-o.ShmPath"
|
||||
|
||||
// MountPoint is the mount point of the container rootfs
|
||||
MountPoint = "io.kubernetes.cri-o.MountPoint"
|
||||
|
||||
// TrustedSandbox is the annotation for trusted sandboxes
|
||||
TrustedSandbox = "io.kubernetes.cri-o.TrustedSandbox"
|
||||
|
||||
|
|
|
@ -698,6 +698,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to mount container %s(%s): %v", containerName, containerID, err)
|
||||
}
|
||||
specgen.AddAnnotation(annotations.MountPoint, mountPoint)
|
||||
|
||||
containerImageConfig := containerInfo.Config
|
||||
if containerImageConfig == nil {
|
||||
|
@ -789,6 +790,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
container.SetMountPoint(mountPoint)
|
||||
|
||||
for _, cv := range containerVolumes {
|
||||
container.AddVolume(cv)
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-zoo/bone"
|
||||
)
|
||||
|
@ -15,6 +16,8 @@ type ContainerInfo struct {
|
|||
CreatedTime int64 `json:"created_time"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Annotations map[string]string `json:"annotations"`
|
||||
LogPath string `json:"log_path"`
|
||||
Root string `json:"root"`
|
||||
}
|
||||
|
||||
// CrioInfo stores information about the crio daemon
|
||||
|
@ -61,6 +64,8 @@ func (s *Server) StartInfoEndpoints() error {
|
|||
CreatedTime: ctrState.Created.UnixNano(),
|
||||
Labels: ctr.Labels(),
|
||||
Annotations: ctr.Annotations(),
|
||||
Root: ctr.MountPoint(),
|
||||
LogPath: filepath.Dir(ctr.LogPath()),
|
||||
}
|
||||
js, err := json.Marshal(ci)
|
||||
if err != nil {
|
||||
|
|
|
@ -442,6 +442,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to mount container %s in pod sandbox %s(%s): %v", containerName, sb.Name(), id, err)
|
||||
}
|
||||
g.AddAnnotation(annotations.MountPoint, mountPoint)
|
||||
g.SetRootPath(mountPoint)
|
||||
err = g.SaveToFile(filepath.Join(podContainer.Dir, "config.json"), saveOptions)
|
||||
if err != nil {
|
||||
|
@ -455,6 +456,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
container.SetMountPoint(mountPoint)
|
||||
|
||||
sb.SetInfraContainer(container)
|
||||
|
||||
|
|
Loading…
Reference in a new issue