Skip to content

Commit

Permalink
Async Refactor (#145)
Browse files Browse the repository at this point in the history
- change from kubernetes to kubernetes_asyncio
- split API to separate component from operator
- simplify AnarchyRun definition
- add new feature specific tests
- make all runner pod tokens dynamic
- update ansible version to 7.0.0
  • Loading branch information
jkupferer authored Nov 24, 2022
1 parent 0663ce7 commit aaf95c1
Show file tree
Hide file tree
Showing 72 changed files with 6,343 additions and 5,027 deletions.
1 change: 1 addition & 0 deletions .s2i/bin/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -eo pipefail
shopt -s dotglob

mkdir -p /opt/app-root/src || :
cp --preserve=mode --recursive /tmp/src/api /opt/app-root/
cp --preserve=mode --recursive /tmp/src/anarchy-runner /opt/app-root/

touch \
Expand Down
37 changes: 22 additions & 15 deletions .s2i/bin/run
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#!/bin/sh

if [ "${ANARCHY_COMPONENT}" == 'runner' ]
then
export HOME=/opt/app-root/anarchy-runner
export ANSIBLE_CONFIG=$HOME/ansible-runner/ansible.cfg
export KUBECONFIG=$HOME/kubeconfig
export LD_PRELOAD=libnss_wrapper.so
export NSS_WRAPPER_PASSWD=$HOME/passwd
export NSS_WRAPPER_GROUP=$HOME/group
export OPERATOR_NAMESPACE="$(cat /run/secrets/kubernetes.io/serviceaccount/namespace)"

cp /etc/passwd $NSS_WRAPPER_PASSWD
cp /etc/group $NSS_WRAPPER_GROUP
echo ansible:x:$(id -u):$(id -g):ansible:$HOME:/bin/bash >> $NSS_WRAPPER_PASSWD

exec /opt/app-root/bin/python3 $HOME/anarchy-runner.py
if [ "${ANARCHY_COMPONENT}" == 'api' ]
then
export HOME=/opt/app-root/api
cd $HOME
exec uvicorn app:app --host 0.0.0.0 --port 5000 --lifespan on --log-level info --log-config logconfig.yaml
elif [ "${ANARCHY_COMPONENT}" == 'runner' ]
then
export HOME=/opt/app-root/anarchy-runner
cd $HOME
export ANSIBLE_CONFIG=$HOME/ansible-runner/ansible.cfg
export KUBECONFIG=$HOME/kubeconfig
exec /opt/app-root/bin/python3 $HOME/main.py
elif [ "true" == "${ANARCHY_RUNNING_ALL_IN_ONE}" ]
then
if [ -z "${RUNNER_TOKEN}" ]
then
export RUNNER_TOKEN="$(openssl rand -base64 15)"
fi
ANARCHY_COMPONENT=api $0 &
ANARCHY_COMPONENT=runner ANARCHY_URL=http://$HOSTNAME:5000 RUNNER_NAME=default $0 &
exec /usr/libexec/s2i/run
else
exec /usr/libexec/s2i/run
exec /usr/libexec/s2i/run
fi
Loading

0 comments on commit aaf95c1

Please sign in to comment.