Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 29, 2022
1 parent 6bf247c commit 37a331d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion onyxia-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ if [ "`which kubectl`" != "" ]; then
kubectl config use-context in-cluster
export KUBERNETES_SERVICE_ACCOUNT=`cat /var/run/secrets/kubernetes.io/serviceaccount/token | tr "." "\n" | head -2 | tail -1 | base64 --decode | jq -r ' .["kubernetes.io"].serviceaccount.name'`
export KUBERNETES_NAMESPACE=`cat /var/run/secrets/kubernetes.io/serviceaccount/namespace`
# Fix permissions for custom images that need to be run as root
# Fix permissions on kubectl config file
if [[ $(id -u) = 0 ]] && grep -q "onyxia" /etc/passwd; then
# For internal images that need to be run as root
chown -R onyxia:users ${HOME}/.kube
else
# For community-based images
chmod 640 ${HOME}/.kube/config
fi
fi
Expand Down

0 comments on commit 37a331d

Please sign in to comment.