summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorJordan Christiansen <xordspar0@gmail.com>2020-09-15 21:09:08 -0500
committerJordan Christiansen <xordspar0@gmail.com>2020-09-16 15:46:08 -0500
commit55dfa7fad205d811b4ade9a2424c49f7e2f7588f (patch)
tree21b00c985f17f8357c7e6e3fc648d9e4ed300337 /pkg/domain
parent8d7e7954546efb344d677e0c3c86d9d045a3de4f (diff)
downloadpodman-55dfa7fad205d811b4ade9a2424c49f7e2f7588f.tar.gz
podman-55dfa7fad205d811b4ade9a2424c49f7e2f7588f.tar.bz2
podman-55dfa7fad205d811b4ade9a2424c49f7e2f7588f.zip
Add labels to a pod created via play kube
When using `podman play kube` with a YAML file that has pod labels, apply those labels to the pods that podman makes. For example, this Deployment spec has labels on a pod: apiVersion: apps/v1 kind: Deployment metadata: name: myapp labels: app: myapp spec: selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: web image: nginx ports: - containerPort: 80 The pods that podman creates will have the label "app" set to "myapp" so that these pods can be found with `podman pods ps --filter label=app`. Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/infra/abi/play.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 6dfb52c63..659cc799c 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -132,6 +132,11 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
libpod.WithInfraContainer(),
libpod.WithPodName(podName),
}
+
+ if podYAML.ObjectMeta.Labels != nil {
+ podOptions = append(podOptions, libpod.WithPodLabels(podYAML.ObjectMeta.Labels))
+ }
+
// TODO we only configure Process namespace. We also need to account for Host{IPC,Network,PID}
// which is not currently possible with pod create
if podYAML.Spec.ShareProcessNamespace != nil && *podYAML.Spec.ShareProcessNamespace {