Skip to content

Commit

Permalink
added support for overriding node id and vsn at runtime (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanshahkarami authored Oct 25, 2022
1 parent d08edbe commit fd6d416
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion vm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN apt install -y software-properties-common && add-apt-repository --yes --upda

# do not copy "private" folder
COPY ansible/*.yaml ansible/*.yml ansible/05-sage /ansible/
COPY entrypoint.sh .

WORKDIR /ansible
ENV LC_ALL=C.UTF-8
Expand Down Expand Up @@ -51,5 +50,6 @@ RUN ansible-playbook -i localhost, -c local ./waggle_config.yml \
-e copy_k8s_resource_files=no
#-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

COPY entrypoint.sh /entrypoint.sh
CMD /entrypoint.sh
#CMD /bin/sleep infinity
12 changes: 10 additions & 2 deletions vm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
set -x
set -e

# override node id, if defined
if [[ "${WAGGLE_NODE_ID}" ]]; then
echo "${WAGGLE_NODE_ID}" > /etc/waggle/node-id
fi

# override node vsn, if defined
if [[ "${WAGGLE_NODE_VSN}" ]]; then
echo "${WAGGLE_NODE_VSN}" > /etc/waggle/vsn
fi

# create fake kubectl for debugging
echo -e '#!/bin/bash\necho "(this is a dummy) created"' > /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl


cd /etc/waggle

# copy files in place so they can be deleted afterwards
Expand All @@ -37,4 +45,4 @@ mkdir -p /var/run/sshd
waggle-bk-registration.py

# reverse ssh tunnel (usually via systemd)
waggle-bk-reverse-tunnel.sh
waggle-bk-reverse-tunnel.sh

0 comments on commit fd6d416

Please sign in to comment.