diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-08-08 18:47:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 18:47:56 +0000 |
commit | 28607a9238b30be9e2b6dd6476f410eed5314ae9 (patch) | |
tree | 9d67eb8a5d8cdee5539dfed7fdc76807e9f6efbb | |
parent | 9d67d907ea8ca59b94643fbe78fd122ded6aed06 (diff) | |
parent | 696ea7905ec2c7e1774aac1ddc056c3ba45d7ea9 (diff) | |
download | podman-28607a9238b30be9e2b6dd6476f410eed5314ae9.tar.gz podman-28607a9238b30be9e2b6dd6476f410eed5314ae9.tar.bz2 podman-28607a9238b30be9e2b6dd6476f410eed5314ae9.zip |
Merge pull request #15239 from giuseppe/use-sandbox-id-gvisor
specgen: use sandbox id instead of name for annotation
-rw-r--r-- | pkg/specgen/generate/container.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index 8cfac924b..20cacc10d 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -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 |