Repository navigation
Fix volume dir label for e2e-docker - #3398
Conversation
|
Related to #3392 |
|
[test] |
|
@smarterclayton @pmorie PTAL |
193589d to
30801ef
Compare
|
I can't read you awk so I don't know what you're trying to do. |
|
I'm taking a Docker container name such as |
|
Looks like no. Can you split this into a function though?
|
|
I thought you used it in multiple places
|
|
Not any more
|
|
[test] |
|
Green Jenkins! |
There was a problem hiding this comment.
is this the default volume path? any reason not to mount VOLUME_DIR instead, closer to what we do in e2e?
There was a problem hiding this comment.
unfortunate if we can't keep e2e bits under a single dir
There was a problem hiding this comment.
This is the way this script was originally set up. I tried switching to use VOLUME_DIR under /tmp/openshift-e2e. It took me a while to figure out why the mount calls were failing. They use nsenter_mount.go, which runs nsenter using the mount namespace from the node's pid 1. I think it wasn't able to see the dir, but I can dig further if needed.
There was a problem hiding this comment.
I0623 20:16:24.164991 1 empty_dir.go:282] pod b85ea4a2-19e4-11e5-a518-001c422dcd49: mounting tmpfs for volume not-used with opts [rootcontext="system_u:object_r:user_tmp_t:s0"]
I0623 20:16:24.165006 1 nsenter_mount.go:97] nsenter Mounting tmpfs /var/lib/openshift/openshift.local.volumes/pods/b85ea4a2-19e4-11e5-a518-001c422dcd49/volumes/kubernetes.io~secret/default-token-43tbh tmpfs [rootcontext="system_u:object_r:user_tmp_t:s0"]
I0623 20:16:24.165019 1 nsenter_mount.go:100] Mount command: nsenter [--mount=/rootfs/proc/1/ns/mnt -- /bin/mount -t tmpfs -o rootcontext="system_u:object_r:user_tmp_t:s0" tmpfs /var/lib/openshift/openshift.local.volumes/pods/b85ea4a2-19e4-11e5-a518-001c422dcd49/volumes/kubernetes.io~secret/default-token-43tbh]
I0623 20:16:24.169217 1 nsenter_mount.go:104] Output from mount command: mount: mount point /var/lib/openshift/openshift.local.volumes/pods/b85ea4a2-19e4-11e5-a518-001c422dcd49/volumes/kubernetes.io~secret/default-token-43tbh does not exist
E0623 20:16:24.169294 1 kubelet.go:1114] Unable to mount volumes for pod "exec_default": exit status 32; skipping pod
There was a problem hiding this comment.
The /var/lib/openshift path doesn't exist on the host for pid 1 to see - it only exists in the container.
There was a problem hiding this comment.
is there anything we can do to detect they've configured VOLUME_DIR to something that won't work (selinux-wise) ahead of time, ideally at server start?
nsenter issue aside, I think we can modify https://github.com/openshift/origin/blob/master/pkg/cmd/server/kubernetes/node.go#L102-L121 to always chcon the directory at startup. Right now it only does it if the directory needs to be created.
There was a problem hiding this comment.
@ncdc got it. still, can't we tell openshfit to use a different volumedir (the tmpdir path)?
There was a problem hiding this comment.
@bparees yes, let me try that (it'll just have to match the path on the host).
|
The log part of this LGTM; I don't have any background on the labeling. |
For test-end-to-end-docker.sh, use a volume directory under BASETMPDIR and label it correctly. The intermediate labeling solution is to chcon the volume dir on the host to svirt_sandbox_file_t. Longer term, we could 1. Update the selinux policy for volume dirs under /var/lib/openshift, assuming that's the default location for volumes. 2. Modify https://github.com/openshift/origin/blob/master/pkg/cmd/server/kubernetes/node.go#L102-L121 to always call chcon when the node starts, instead of only if the volume dir doesn't exist and is therefore newly created. This commit also changes the file name format of container logs captured by the e2e tests. Instead of being container-$containerID.log, they are now container-$podName-$containerName.log, such as container-docker-registry-1-7sm9l-registry.log.
|
[test] |
|
Need to clean up the pods from e2e-docker before we can start normal e2e. e2e tries to delete /tmp/openshift-e2e, but there are some lingering mounts (secrets etc) from e2e-docker in there. Working on a fix. |
There was a problem hiding this comment.
add -r to xargs to avoid running if there are no matching mounts
|
delete all flake [test] |
|
[merge] |
|
jinx! |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/3342/) (Image: devenv-fedora_1868) |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/3342/) |
|
Looks like I'm going to have to do some more tweaking to get this fully resolved. I'll take a look in a bit, or tomorrow. |
There was a problem hiding this comment.
Also, if we're ok with this in general, adding it just before you rm -rf the temp-dir would be good insurance.
There was a problem hiding this comment.
I'm tempted to run oc delete all --all for the test and default projects, and then run a wait_for_command that waits for the # of mounts in VOLUME_DIR to be 0.
Also, while we can do this before we clean the temp dir, the issue I'm facing is that e2e-docker runs and creates mounts in /tmp/openshift-e2e/containerized/volumes, finishes running, and then e2e starts and tries to rm -rf /tmp/openshift-e2e. This fails because there are some lingering mounts from the e2e-docker run.
There was a problem hiding this comment.
long-term, I'd much rather give e2e and e2e-docker their own folders
There was a problem hiding this comment.
+1 to waiting for mounts to be cleaned up. Seems like better test coverage.
Hopefully delete all flakes are resolved...
There was a problem hiding this comment.
cleanup can't really make assumptions about the API being available... it gets called in response to an exit signal, which could be from a failure halfway through...
There was a problem hiding this comment.
cleanup can't really make assumptions about the API being available... it gets called in response to an exit signal, which could be from a failure halfway through...
I thought we were talking about waiting for a condition after delete all, not verifying stuff following signal handling... did I misunderstand?
There was a problem hiding this comment.
@liggitt true... however, this is what e2e is currently doing: https://github.com/openshift/origin/blob/master/hack/test-end-to-end.sh#L111-L116
Change BASETMPDIR to /tmp/openshift-e2e-containerized so it does not share a common directory with test-end-to-end.sh. When they share a common directory, if the volume mounts don't get cleaned up for whatever reason, running the tests in succession can fail when they try to rm -rf BASETMPDIR. During test cleanup, attempt to delete all resources from the test and default projects, and then wait up to 2 minutes for the volume mounts to clear (it should only take approximately 10 seconds).
|
Evaluated for origin up to ba9bea7 |
There was a problem hiding this comment.
is selinuxenabled available in all OSes we run e2e on?
Merged by openshift-bot
|
🎉 🎊 🎈 |
For test-end-to-end-docker.sh, use a volume directory under BASETMPDIR
and label it correctly.
The intermediate labeling solution is to chcon the volume dir on the host to
svirt_sandbox_file_t.
Longer term, we could
assuming that's the default location for volumes.
https://github.com/openshift/origin/blob/master/pkg/cmd/server/kubernetes/node.go#L102-L121
to always call chcon when the node starts, instead of only if the volume
dir doesn't exist and is therefore newly created.
This commit also changes the file name format of container logs captured
by the e2e tests. Instead of being container-$containerID.log, they are
now container-$podName-$containerName.log, such as
container-docker-registry-1-7sm9l-registry.log.