Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
1. Remove check of pre-existence of implicit workload_config/output_dir.
2. Minor redundant code removal
  • Loading branch information
gargnitingoogle committed Aug 20, 2024
1 parent 5391bc9 commit 04af62c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions perfmetrics/scripts/testing_on_gke/examples/run-gke-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,17 @@ test -n "${pod_wait_time_in_seconds}" || export pod_wait_time_in_seconds="${DEFA
test -n "${instance_id}" || export instance_id="${DEFAULT_INSTANCE_ID}"
if test -n "${workload_config}"; then
workload_config="$(realpath "${workload_config}")"
test -f "${workload_config}"
else
export workload_config="${gke_testing_dir}"/examples/workloads.json
fi
test -f "${workload_config}"

if test -n "${output_dir}"; then
output_dir="$(realpath "${output_dir}")"
test -d "${output_dir}"
else
export output_dir="${gke_testing_dir}"/examples
fi
test -d "${output_dir}"

function printRunParameters() {
echo "Running $0 with following parameters:"
Expand Down Expand Up @@ -383,15 +384,11 @@ function createKubernetesServiceAccountForCluster() {
}

function addGCSAccessPermissions() {
for workloadFileName in "${workload_config}"; do
if test -f "${workloadFileName}"; then
grep -wh '\"bucket\"' "${workloadFileName}" | cut -d: -f2 | cut -d, -f1 | cut -d \" -f2 | sort | uniq | grep -v ' ' |
while read workload_bucket; do
gcloud storage buckets add-iam-policy-binding gs://${workload_bucket} \
--member "principal://iam.googleapis.com/projects/${project_number}/locations/global/workloadIdentityPools/${project_id}.svc.id.goog/subject/ns/${appnamespace}/sa/${ksa}" \
--role "roles/storage.objectUser"
done
fi
test -f "${workload_config}"
grep -wh '\"bucket\"' "${workload_config}" | cut -d: -f2 | cut -d, -f1 | cut -d \" -f2 | sort | uniq | grep -v ' ' | while read workload_bucket; do
gcloud storage buckets add-iam-policy-binding gs://${workload_bucket} \
--member "principal://iam.googleapis.com/projects/${project_number}/locations/global/workloadIdentityPools/${project_id}.svc.id.goog/subject/ns/${appnamespace}/sa/${ksa}" \
--role "roles/storage.objectUser"
done
}

Expand Down

0 comments on commit 04af62c

Please sign in to comment.