diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-06 21:38:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 21:38:54 +0200 |
commit | db5ec4dcdc4d9b1105d1ce66cb3704fda328dec3 (patch) | |
tree | 49cc0208cd633bcd8f4ad003567c7c5e280ad8d3 /pkg/domain | |
parent | 2f555c0c74d77e4a93ef90290f16d0908829e8c7 (diff) | |
parent | 274d34a25a3ed7b69a6e4caec07e845157048c96 (diff) | |
download | podman-db5ec4dcdc4d9b1105d1ce66cb3704fda328dec3.tar.gz podman-db5ec4dcdc4d9b1105d1ce66cb3704fda328dec3.tar.bz2 podman-db5ec4dcdc4d9b1105d1ce66cb3704fda328dec3.zip |
Merge pull request #15547 from vrothberg/RUN-1606
Support auto updates for Kubernetes workloads
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/abi/play.go | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 6ea20a4f2..12786afcd 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -661,9 +661,10 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY opts = append(opts, libpod.WithSdNotifyMode(sdNotifyMode)) + var proxy *notifyproxy.NotifyProxy // Create a notify proxy for the container. if sdNotifyMode != "" && sdNotifyMode != define.SdNotifyModeIgnore { - proxy, err := notifyproxy.New("") + proxy, err = notifyproxy.New("") if err != nil { return nil, err } @@ -675,6 +676,9 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY if err != nil { return nil, err } + if proxy != nil { + proxy.AddContainer(ctr) + } containers = append(containers, ctr) } @@ -774,21 +778,26 @@ func (ic *ContainerEngine) getImageAndLabelInfo(ctx context.Context, cwd string, } // Handle kube annotations - for k, v := range annotations { - switch k { - // Auto update annotation without container name will apply to - // all containers within the pod - case autoupdate.Label, autoupdate.AuthfileLabel: - labels[k] = v - // Auto update annotation with container name will apply only - // to the specified container - case fmt.Sprintf("%s/%s", autoupdate.Label, container.Name), - fmt.Sprintf("%s/%s", autoupdate.AuthfileLabel, container.Name): - prefixAndCtr := strings.Split(k, "/") - labels[prefixAndCtr[0]] = v + setLabel := func(label string) { + var result string + ctrSpecific := fmt.Sprintf("%s/%s", label, container.Name) + for k, v := range annotations { + switch k { + case label: + result = v + case ctrSpecific: + labels[label] = v + return + } + } + if result != "" { + labels[label] = result } } + setLabel(autoupdate.Label) + setLabel(autoupdate.AuthfileLabel) + return pulledImage, labels, nil } |