Initial ansible onboard
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Match User git
|
||||
AuthorizedKeysCommandUser git
|
||||
AuthorizedKeysCommand /usr/local/bin/gitea-auth -u %u -t %t -k %k
|
||||
@@ -0,0 +1 @@
|
||||
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAD2EbNMt6U8KkXykm6cR9D7N6l1xjyAnN+4rzNK2PHbl0ZmrDa/4+zAjS83a5IV3+FcbdsGmBx/m+k0P/i26D5srAF6IPQpgm5bbUv0Izz2BUK7c+SILNRwovd1cYppdZnP4U670JuwmkyKOS6rmht28XmkKqVrRQLsCR7Kesa5D40JKQ==
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
NAMESPACE=gitea
|
||||
PREFIX=gitea-app
|
||||
# Get the list of running pod names in the given namespace and filter by prefix
|
||||
POD_NAME=$(/usr/local/bin/kubectl get pods -n "$NAMESPACE" -o json | jq -r --arg PREFIX "$PREFIX" '.items[] | select(.metadata.name | startswith($PREFIX)) | select(.status.phase == "Running") | .metadata.name' | head -n 1)
|
||||
# Check if a running pod matching the prefix is found
|
||||
if [ -z "$POD_NAME" ]; then
|
||||
exit 1
|
||||
else
|
||||
/usr/local/bin/kubectl exec -n "$NAMESPACE" "$POD_NAME" -i -- su -s /bin/bash git -- /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git "$@"
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
NAMESPACE=gitea
|
||||
PREFIX=gitea-app
|
||||
# Get the list of running pod names in the given namespace and filter by prefix
|
||||
POD_NAME=$(/usr/local/bin/kubectl get pods -n "$NAMESPACE" -o json | jq -r --arg PREFIX "$PREFIX" '.items[] | select(.metadata.name | startswith($PREFIX)) | select(.status.phase == "Running") | .metadata.name' | head -n 1)
|
||||
# Remove the -c flag from the command
|
||||
COMMAND=$(echo "$@" | sed "s/-c //g")
|
||||
# Check if a running pod matching the prefix is found
|
||||
if [ ! -z "$POD_NAME" ]; then
|
||||
/usr/local/bin/kubectl exec -n "$NAMESPACE" "$POD_NAME" -i -- env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" su -s /bin/bash git -- $COMMAND
|
||||
fi
|
||||
Reference in New Issue
Block a user