Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions images/singleuser/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ RUN r -e "install.packages('IRkernel', version='1.3.2')" && \

USER root

# Ship the /public/dumps/public symlink. As per T432583 dumps-nfs.w.o is always
# mounted to /mnt/nfs/dumps
RUN mkdir -p /public/dumps && \
ln -s /mnt/nfs/dumps /public/dumps/public

## Setup OpenRefine
ENV OPENREFINE_DIR /srv/openrefine
ENV PATH=$PATH:$OPENREFINE_DIR
Expand Down
40 changes: 3 additions & 37 deletions paws/files/maintain-dumps-nfs/maintain-dumps-nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

Runs as a DaemonSet with Bidirectional mount propagation so the mount is
visible on the host. Also manages clouddumps100[12]-compat symlinks within
/mnt/nfs and a /public/dumps/public -> /mnt/nfs/dumps symlink for singleuser
pods.
/mnt/nfs.

Similar to dumps-nfs-client-sitter in the puppet repo, but differs in that it
also manages symlinks as opposed to puppet in production.

/mnt/nfs and /public/dumps are then bind-mounted from the host into singleuser
pods by the jupyterhub spawner.
/mnt/nfs is then bind-mounted from the host into singleuser pods by the
jupyterhub spawner.
"""

import errno
Expand Down Expand Up @@ -163,38 +162,6 @@ def ensure_compat_symlinks(host_mnt_nfs):
logger.debug("Compat symlink %s -> %s ok", link_path, target)


def ensure_public_dumps_symlink():
"""Create /host/public/dumps/public -> /mnt/nfs/dumps so singleuser pods can reach dumps via /public/dumps."""
dumps_dir = "/host/public/dumps"
public_path = os.path.join(dumps_dir, "public")
target = "/mnt/nfs/dumps"
try:
current = os.readlink(public_path)
if current == target:
logger.info("Symlink %s -> %s already exists", public_path, target)
return
logger.info("Symlink %s points to %s, updating", public_path, current)
os.unlink(public_path)
except OSError as e:
if e.errno == errno.ENOENT:
logger.info("Symlink %s missing — creating", public_path)
elif os.path.isdir(public_path):
logger.error(
"%s exists and is a directory — cannot create compat symlink",
public_path,
)
return
else:
logger.info("Removing existing %s to create symlink", public_path)
try:
os.unlink(public_path)
except OSError:
logger.warning("Failed to remove %s", public_path)
return
os.makedirs(dumps_dir, exist_ok=True)
os.symlink(target, public_path)


def main():
"""Mount NFS dumps, create compat symlinks, then loop for health checks and remounts."""
config = load_config()
Expand All @@ -203,7 +170,6 @@ def main():
server = config["server"]
mount_info = {"host_path": DUMPS_MOUNT}

ensure_public_dumps_symlink()
ensure_compat_symlinks("/host/mnt/nfs")

while True:
Expand Down
3 changes: 0 additions & 3 deletions paws/templates/maintain-dumps-nfs/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ spec:
- name: host-nfs
mountPath: /host/mnt/nfs
mountPropagation: Bidirectional
- name: host-public-dumps
mountPath: /host/public/dumps
mountPropagation: Bidirectional
- name: config
mountPath: /etc/maintain-dumps-nfs
readOnly: true
Expand Down
11 changes: 1 addition & 10 deletions paws/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ jupyterhub:
# * public-dumps is the public interface and holds a symlink to /mnt/nfs

spawner.volumes = [
{
'name': 'public-dumps',
'hostPath': { 'path': '/public/dumps' }
},
{
'name': 'mnt-nfs',
'hostPath': { 'path': '/mnt/nfs' }
Expand All @@ -177,11 +173,6 @@ jupyterhub:
'name': 'home',
'mountPath': '/home/paws'
},
{
'name': 'public-dumps',
'mountPath': '/public/dumps',
'readOnly': True
},
{
'name': 'mnt-nfs',
'mountPath': '/mnt/nfs',
Expand Down Expand Up @@ -247,7 +238,7 @@ jupyterhub:
fsGid: 52771
image:
name: quay.io/wikimedia-paws-prod/singleuser
tag: pr-530 # singleuser tag managed by github actions
tag: pr-532 # singleuser tag managed by github actions
pullPolicy: Always
memory:
guarantee: 0.70G
Expand Down
Loading