Support annotations from containers.conf

Currently podman does not use the annotations specified in the
containers.conf. This PR fixes this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2021-02-09 08:25:59 -05:00
parent 763d522983
commit cc846a8cd9
3 changed files with 23 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package generate
import (
"context"
"os"
"strings"
"github.com/containers/image/v5/manifest"
"github.com/containers/podman/v2/libpod"
@ -197,6 +198,15 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
annotations[ann.ContainerType] = ann.ContainerTypeContainer
}
for _, v := range rtc.Containers.Annotations {
split := strings.SplitN(v, "=", 2)
k := split[0]
v := ""
if len(split) == 2 {
v = split[1]
}
annotations[k] = v
}
// now pass in the values from client
for k, v := range s.Annotations {
annotations[k] = v