diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-04-20 17:28:45 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-04-21 05:18:39 -0400 |
commit | 75fdb753ddb47d51df1f9781d5db0748edd738da (patch) | |
tree | f111b07053ef8be7cd71eb09b82d34eac18e1f9f | |
parent | 64f774866a37d2dc0d37d876d1bf3a96c4b04160 (diff) | |
download | podman-75fdb753ddb47d51df1f9781d5db0748edd738da.tar.gz podman-75fdb753ddb47d51df1f9781d5db0748edd738da.tar.bz2 podman-75fdb753ddb47d51df1f9781d5db0748edd738da.zip |
Handle annotations passed in via the client
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r-- | pkg/specgen/generate/container.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index 31465d8bf..d8d3bf11d 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -64,6 +64,16 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat } // annotations + + // Add annotations from the image + annotations, err := newImage.Annotations(ctx) + if err != nil { + return err + } + for k, v := range annotations { + annotations[k] = v + } + // in the event this container is in a pod, and the pod has an infra container // we will want to configure it as a type "container" instead defaulting to // the behavior of a "sandbox" container @@ -72,20 +82,17 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat // VM, which is the default behavior // - "container" denotes the container should join the VM of the SandboxID // (the infra container) - s.Annotations = make(map[string]string) + if len(s.Pod) > 0 { - s.Annotations[ann.SandboxID] = s.Pod - s.Annotations[ann.ContainerType] = ann.ContainerTypeContainer - } - // - // Next, add annotations from the image - annotations, err := newImage.Annotations(ctx) - if err != nil { - return err + annotations[ann.SandboxID] = s.Pod + annotations[ann.ContainerType] = ann.ContainerTypeContainer } - for k, v := range annotations { + + // now pass in the values from client + for k, v := range s.Annotations { annotations[k] = v } + s.Annotations = annotations // entrypoint entrypoint, err := newImage.Entrypoint(ctx) |