Skip to content

Commit

Permalink
Merge pull request containers#15239 from giuseppe/use-sandbox-id-gvisor
Browse files Browse the repository at this point in the history
specgen: use sandbox id instead of name for annotation
  • Loading branch information
openshift-merge-robot committed Aug 8, 2022
2 parents 9d67d90 + 696ea79 commit 28607a9
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/specgen/generate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,24 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
// - "container" denotes the container should join the VM of the SandboxID
// (the infra container)
if len(s.Pod) > 0 {
annotations[ann.SandboxID] = s.Pod
p, err := r.LookupPod(s.Pod)
if err != nil {
return nil, err
}
sandboxID := p.ID()
if p.HasInfraContainer() {
infra, err := p.InfraContainer()
if err != nil {
return nil, err
}
sandboxID = infra.ID()
}
annotations[ann.SandboxID] = sandboxID
annotations[ann.ContainerType] = ann.ContainerTypeContainer
// Check if this is an init-ctr and if so, check if
// the pod is running. we do not want to add init-ctrs to
// a running pod because it creates confusion for us.
if len(s.InitContainerType) > 0 {
p, err := r.LookupPod(s.Pod)
if err != nil {
return nil, err
}
containerStatuses, err := p.Status()
if err != nil {
return nil, err
Expand Down

0 comments on commit 28607a9

Please sign in to comment.