Skip to content
Snippets Groups Projects
Commit 4dbee948 authored by Julien Leduc's avatar Julien Leduc
Browse files

All modifications to have a systemd ready container.

As systemd is mounting tmpfs in /tmp, I had to move the artifacts
repository to /opt/repo (which is anyway better).
Default entry point in the container is systemd and I added /etc/rc.local entry point for systemd containers.
Initially it is pulled from a shared mount on the kubelet running the
pod.
This commit is compatible with the standard way of running CI jobs,
following sytemd commits may break retrocompatibility.
parent ad4c8f83
Branches
Tags
No related merge requests found
......@@ -27,7 +27,7 @@ FROM gitlab-registry.cern.ch/linuxsupport/cc7-base
ENV ORCHESTRATIONDIR="continuousintegration/orchestration/pods" \
LOCALORCHESTRATIONDIR="/opt/ci" \
BASEDIR="continuousintegration/docker/ctafrontend/cc7" \
CTAREPODIR="/tmp/repo"
CTAREPODIR="/opt/repo"
# Manage repos before running yum
ADD ${BASEDIR}/etc /etc
......@@ -78,7 +78,9 @@ RUN yum-config-manager --enable epel --setopt="epel.priority=4" \
&& \
yum clean all \
&& \
rm -rf /var/cache/yum
rm -rf /var/cache/yum \
; \
rm -f /etc/rc.d/rc.local
# Add pod specific configuration
ADD ${BASEDIR}/config ${LOCALORCHESTRATIONDIR}
......@@ -92,4 +94,15 @@ ADD ${BASEDIR}/opt /opt
# Docker image run setup
ADD ${BASEDIR}/run.sh /
ENTRYPOINT ["/run.sh"]
# Add custom rc.local to massage kubernetes resources for
# the taget docker container
ADD ${BASEDIR}/rc.local /etc/rc.d
# Make sure it can be executed by root
RUN chmod 744 /etc/rc.local
# One more thing so that we can use systemd
VOLUME [ "/sys/fs/cgroup" ]
# And finally run systemd if the entrypoint is not overriden by docker
ENTRYPOINT ["/usr/sbin/init"]
#!/bin/bash
touch /var/lock/subsys/local
# for now we do tests using locally hackable resources mounter in /shared
echo -n "Waiting for /shared/rc.local" > /tmp/rc.log
for ((;;)); do test -e /shared/rc.local && break; sleep 1; echo -n . >> /tmp/rc.log; done
echo OK >> /tmp/rc.log
# rc.local envinronment is empty but I need all the kubernetes environment
# variables to go further and configure the services.
# As systemd is the container entry point it gets the environment variables
# from kubernetes and I can source them for later use.
if [ -e /proc/1/environ ]; then
while read -d $'\0' ENV; do export "$ENV"; done < /proc/1/environ
fi
printenv > /tmp/rc.local
# Let the next step take over
exec /shared/rc.local
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment