oci: Add volumes field to Container
We add a ContainerVolume struct and store a list of volumes in the Container object for quick retrieval. Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
bfcebcdb00
commit
5ab6ec3046
2 changed files with 22 additions and 0 deletions
|
@ -45,6 +45,14 @@ type Container struct {
|
||||||
stopSignal string
|
stopSignal string
|
||||||
imageName string
|
imageName string
|
||||||
imageRef string
|
imageRef string
|
||||||
|
volumes []ContainerVolume
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerVolume is a bind mount for the container.
|
||||||
|
type ContainerVolume struct {
|
||||||
|
ContainerPath string `json:"container_path"`
|
||||||
|
HostPath string `json:"host_path"`
|
||||||
|
Readonly bool `json:"readonly"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerState represents the status of a container.
|
// ContainerState represents the status of a container.
|
||||||
|
@ -198,3 +206,14 @@ func (c *Container) State() *ContainerState {
|
||||||
defer c.opLock.Unlock()
|
defer c.opLock.Unlock()
|
||||||
return c.state
|
return c.state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddVolume adds a volume to list of container volumes.
|
||||||
|
func (c *Container) AddVolume(v ContainerVolume) {
|
||||||
|
c.volumes = append(c.volumes, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Volumes returns the list of container volumes.
|
||||||
|
func (c *Container) Volumes() []ContainerVolume {
|
||||||
|
return c.volumes
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -69,6 +69,9 @@ const (
|
||||||
|
|
||||||
// StdinOnce is the stdin_once annotation
|
// StdinOnce is the stdin_once annotation
|
||||||
StdinOnce = "io.kubernetes.cri-o.StdinOnce"
|
StdinOnce = "io.kubernetes.cri-o.StdinOnce"
|
||||||
|
|
||||||
|
// Volumes is the volumes annotatoin
|
||||||
|
Volumes = "io.kubernetes.cri-o.Volumes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerType values
|
// ContainerType values
|
||||||
|
|
Loading…
Reference in a new issue