Skip to content

Commit

Permalink
add authentication to k8s related scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
averyniceday authored and sheridancbio committed Jul 20, 2021
1 parent d4c57a2 commit 2ae12e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions import-scripts/delete_slow_to_terminate_pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ MY_FLOCK_FILEPATH="/data/portal-cron/cron-lock/delete_slow_to_terminate_pods.loc
mv $temp_file $POD_TERMINATING_TIMESTAMP_FILE
}

/data/portal-cron/scripts/authenticate_service_account.sh
check_for_dependencies
now=$(date +%s)
make_work_dir_if_necessary
Expand Down
7 changes: 7 additions & 0 deletions import-scripts/precache-portals.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
# ----------------------------------------------------------
# Functions wrapping k8s/timing checks

def authenticate_service_account():
try:
subprocess.check_output(["/data/portal-cron/scripts/authenticate_service_account.sh"])
except:
print "Attempt to authenticate to k8s cluster failed with non-zero exit status, exiting..."
sys.exit(1)

# get pods associated with deployment
def get_deployed_pods(deployment_name):
deployed_pods = subprocess.check_output(["/bin/bash", "-c", "kubectl get pods | grep %s | sed 's/\s\s*/\t/g' | cut -f1" % (deployment_name)]).rstrip().split("\n")
Expand Down
3 changes: 3 additions & 0 deletions import-scripts/restart-portal-pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if ! which $KUBECTL_BINARY > /dev/null 2>&1 ; then
fi

unset portal_to_deployment_map

declare -A portal_to_deployment_map
portal_to_deployment_map["public"]="cbioportal-spring-boot"
portal_to_deployment_map["genie-public"]="cbioportal-backend-genie-public"
Expand Down Expand Up @@ -49,6 +50,8 @@ if [ -z "$deployment_id" ] ; then
echo "invalid portal_id : $portal_id"
print_portal_id_values
fi

/data/portal-cron/scripts/authenticate_service_account.sh
$KUBECTL_BINARY set env deployment $deployment_id --env="LAST_RESTART=$(date)"

if [ -z "$preserve_cache_flag" ] ; then
Expand Down

0 comments on commit 2ae12e9

Please sign in to comment.