[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [atomic-devel] atomic hosts: allow writeable /sbin/fs.d



Hi,

>> AFAICT, that does not solve the problem, that e.g. kubernetes gluster
>> (or ceph) plugin will call the host's mount(8), which will need to find
>> a mount.glusterfs helper script (on the host) that will call
>> mount.glusterfs in the container. 
> 
> Yes, this approach requires patching the mount.{glusterfs,ceph} tool itself to
> have a version of --in-ns-of.

I am not entirely sure I understand what you mean.

Just to be sure, is the following broadly what you have in mind:
 * kubernetes will call mount on the host
 * mount will magically know which container to look into to run the
helper (tbd, I guess)
 * mount.glusterfs will run with --in-ns-of (to mount on the host)


See below for the mount.glusterfs wrapper script that I run (adoption of
atomic mount caused quiet some complication unfortunately, and I would
love to make use of systemd-nspawn, but the namespaces did not work out
as I wanted them to.). It seems conceptionally easier, but maybe I did
not really understand what you meant.



> There's a other issues here of course in that /etc/fstab and in particular
> systemd aren't aware of this, and that might argue for having the storage
> drivers directly on the host, which the rpm-ostree package layering model
> solves.

Systemd won't know when kubernetes mounts a volume by itself regardless
of whether a container performs the mount or not, or am I missing things.


Cheers,
 Tobias Florek

--8<--8<--8<--
#!/bin/sh
# /sbin/mount.glusterfs
# This is a crude hack that depends on the right ordering of options
set -e
set -x

MACHINEDIR=/var/lib/machines/atomic-gluster-server

VOLUME="$1"
shift

TARGET="$1"
shift

mount_machinedir() {
   is_mounted "$MACHINEDIR" || \
       /bin/atomic mount -o rw docker.io/ibotty/atomic-gluster-server \
                               "$MACHINEDIR"
   bindmount_machinedir /dev
   bindmount_machinedir /proc
   bindmount_machinedir /sys
   bindmount_machinedir /var/log/glusterfs
   is_mounted "$MACHINEDIR/rootfs/mnt" || \
       /bin/mount -t tmpfs tmpfs "$MACHINEDIR/rootfs/mnt"
}

bindmount_machinedir() {
   is_mounted "$MACHINEDIR/rootfs$1" || \
       /bin/mount -o bind "$1" "$MACHINEDIR/rootfs$1"
}

mount_targetdir() {
   MTARGET="$MACHINEDIR/rootfs/mnt$1"
   /bin/mkdir -p "$MTARGET"

   is_mounted "$MTARGET" || \
       /bin/mount --bind --make-rshared "$1" "$MTARGET"
}

is_mounted() {
   # surround search string by spaces to not match mounts in subdirs
   /bin/mount | /bin/grep -q " $1 "
}

mount_machinedir
mount_targetdir "$TARGET"
/sbin/chroot "$MACHINEDIR/rootfs" /sbin/mount.glusterfs "$VOLUME"
"/mnt$TARGET" $*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]