diff options
author | Brent Baude <bbaude@redhat.com> | 2021-09-29 14:57:33 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2021-09-30 10:49:14 -0500 |
commit | 1ff6a5082a440fe4a4c3f3670534ab6185d26752 (patch) | |
tree | 8018f0ee002631fc383ac8fbd12ebebcec6ed1ab /test | |
parent | 966b6030fa5cc31c163e344b64109eddeffc3529 (diff) | |
download | podman-1ff6a5082a440fe4a4c3f3670534ab6185d26752.tar.gz podman-1ff6a5082a440fe4a4c3f3670534ab6185d26752.tar.bz2 podman-1ff6a5082a440fe4a4c3f3670534ab6185d26752.zip |
Support selinux options with bind mounts play/gen
When using play kube and generate kube, we need to support if bind
mounts have selinux options. As kubernetes does not support selinux in
this way, we tuck the selinux values into a pod annotation for
generation of the kube yaml. Then on play, we check annotations to see
if a value for the mount exists and apply it.
Fixes BZ #1984081
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/generate_kube_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index cb556991c..cb987e139 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -6,6 +6,8 @@ import ( "path/filepath" "strconv" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/util" . "github.com/containers/podman/v3/test/utils" "github.com/ghodss/yaml" @@ -555,6 +557,15 @@ var _ = Describe("Podman generate kube", func() { kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) + b, err := ioutil.ReadFile(outputFile) + Expect(err).ShouldNot(HaveOccurred()) + pod := new(v1.Pod) + err = yaml.Unmarshal(b, pod) + Expect(err).To(BeNil()) + val, found := pod.Annotations[define.BindMountPrefix+vol1] + Expect(found).To(BeTrue()) + Expect(val).To(HaveSuffix("z")) + rm := podmanTest.Podman([]string{"pod", "rm", "-f", "test1"}) rm.WaitWithDefaultTimeout() Expect(rm).Should(Exit(0)) |