Skip to content

Commit 87e54bb

Browse files
authored
standup.sh & teardown.sh for non-cluster-level-admin users (#546)
* Add idea to gitignore * Add non-admin flag option * Add non-admin run option * Update show_usage function * Update LLMDBENCH_USER_IS_ADMIN usage
1 parent 1abeb83 commit 87e54bb

File tree

7 files changed

+48
-20
lines changed

7 files changed

+48
-20
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ env.bak/
5757
venv.bak/
5858
environment/
5959

60+
.idea/
61+
6062
scenarios/none.sh
6163

6264
# Python specifics

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
# You are encouraged to use static refs such as tags, instead of branch name
1313
#
1414
# Running "pre-commit autoupdate" automatically updates rev to latest tag
15-
rev: 0.13.1+ibm.61.dss
15+
rev: 0.13.1+ibm.64.dss
1616
hooks:
1717
- id: detect-secrets # pragma: whitelist secret
1818
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-05-16T02:30:29Z",
6+
"generated_at": "2025-11-30T10:06:26Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -87,7 +87,7 @@
8787
}
8888
]
8989
},
90-
"version": "0.13.1+ibm.61.dss",
90+
"version": "0.13.1+ibm.64.dss",
9191
"word_list": {
9292
"file": null,
9393
"hash": null

setup/env.sh

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -549,23 +549,33 @@ else
549549
export LLMDBENCH_CONTROL_KCMD=$(echo $LLMDBENCH_CONTROL_KCMD | $LLMDBENCH_CONTROL_SCMD 's^oc ^kubectl ^g')
550550
fi
551551

552-
export LLMDBENCH_USER_IS_ADMIN=0
553-
if [[ $LLMDBENCH_CONTROL_DEPLOY_IS_OPENSHIFT -eq 1 ]]; then
554-
admin_user=$($LLMDBENCH_CONTROL_KCMD get clusterrolebindings -o json | jq '.items[] | select(.roleRef.name=="cluster-admin")' | jq '.subjects[0].name' | grep $($LLMDBENCH_CONTROL_KCMD whoami) || true)
555-
if [[ ! -z ${admin_user} || $($LLMDBENCH_CONTROL_KCMD whoami) == "system:admin" ]]; then
556-
export LLMDBENCH_USER_IS_ADMIN=1
557-
fi
558-
else
559-
not_admin=$($LLMDBENCH_CONTROL_KCMD get crds 2>&1 | grep -i Forbidden || true)
560-
if [[ -z ${not_admin} ]]; then
561-
export LLMDBENCH_USER_IS_ADMIN=1
562-
is_ns=$($LLMDBENCH_CONTROL_KCMD get namespace -o name| grep -E "namespace/${LLMDBENCH_VLLM_COMMON_NAMESPACE}$" || true)
563-
if [[ ! -z ${is_ns} ]]; then
564-
export LLMDBENCH_CONTROL_PROXY_UID=$($LLMDBENCH_CONTROL_KCMD get namespace ${LLMDBENCH_VLLM_COMMON_NAMESPACE} -o json | jq -e -r '.metadata.annotations["openshift.io/sa.scc.uid-range"]' | perl -F'/' -lane 'print $F[0]+1');
552+
if [[ -z "${LLMDBENCH_USER_IS_ADMIN:-}" ]]; then # Check if variable was overridden
553+
export LLMDBENCH_USER_IS_ADMIN=0
554+
if [[ $LLMDBENCH_CONTROL_DEPLOY_IS_OPENSHIFT -eq 1 ]]; then
555+
admin_user=$($LLMDBENCH_CONTROL_KCMD get clusterrolebindings -o json | jq '.items[] | select(.roleRef.name=="cluster-admin")' | jq '.subjects[0].name' | grep $($LLMDBENCH_CONTROL_KCMD whoami) || true)
556+
if [[ ! -z ${admin_user} || $($LLMDBENCH_CONTROL_KCMD whoami) == "system:admin" ]]; then
557+
export LLMDBENCH_USER_IS_ADMIN=1
558+
fi
559+
else
560+
not_admin=$($LLMDBENCH_CONTROL_KCMD get crds 2>&1 | grep -i Forbidden || true)
561+
if [[ -z ${not_admin} ]]; then
562+
export LLMDBENCH_USER_IS_ADMIN=1
563+
is_ns=$($LLMDBENCH_CONTROL_KCMD get namespace -o name| grep -E "namespace/${LLMDBENCH_VLLM_COMMON_NAMESPACE}$" || true)
564+
if [[ ! -z ${is_ns} ]]; then
565+
export LLMDBENCH_CONTROL_PROXY_UID=$($LLMDBENCH_CONTROL_KCMD get namespace ${LLMDBENCH_VLLM_COMMON_NAMESPACE} -o json | jq -e -r '.metadata.annotations["openshift.io/sa.scc.uid-range"]' | perl -F'/' -lane 'print $F[0]+1');
566+
fi
565567
fi
566568
fi
567569
fi
568570

571+
# Config to avoid blocked commands for non-admin users
572+
if [[ $LLMDBENCH_USER_IS_ADMIN -eq 0 ]]; then
573+
announce "ℹ️ Configuring environment for non-admin users."
574+
export LLMDBENCH_VLLM_GAIE_CHART_VERSION="v0"
575+
export LLMDBENCH_VLLM_MODELSERVICE_GAIE_MONITORING_PROMETHEUS_ENABLED=false
576+
export LLMDBENCH_VLLM_MODELSERVICE_INFERENCE_POOL=false
577+
fi
578+
569579
export LLMDBENCH_CONTROL_DEPLOY_IS_MINIKUBE=${LLMDBENCH_CONTROL_DEPLOY_IS_MINIKUBE:-0}
570580
has_minikube=$($LLMDBENCH_CONTROL_KCMD get pods -n kube-system 2>&1 | grep 'etcd-minikube' || true)
571581
if [[ ! -z ${has_minikube} ]]; then

setup/standup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function show_usage {
4141
-u/--wva [deploy model with Workload Variant Autoscaler (default=$LLMDBENCH_WVA_ENABLED)] \n \
4242
-n/--dry-run [just print the command which would have been executed (default=$LLMDBENCH_CONTROL_DRY_RUN) ] \n \
4343
-v/--verbose [print the command being executed, and result (default=$LLMDBENCH_CONTROL_VERBOSE) ] \n \
44+
-i/--non-admin [run the setup script as a non-cluster-level admin user] \n \
4445
-h/--help (show this help)\n \
4546
4647
* [step list] can take of form of comma-separated single/double digits (e.g. \"-s 0,1,5\") or ranges (e.g. \"-s 1-7\")"
@@ -131,6 +132,10 @@ while [[ $# -gt 0 ]]; do
131132
export LLMDBENCH_CLIOVERRIDE_CONTROL_VERBOSE=1
132133
export LLMDBENCH_CONTROL_VERBOSE=1
133134
;;
135+
-i|--non-admin)
136+
announce "ℹ️ You are running as a non-cluster-level admin user."
137+
export LLMDBENCH_CLIOVERRIDE_USER_IS_ADMIN=0
138+
;;
134139
-h|--help)
135140
show_usage
136141
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]

setup/steps/07_deploy_setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ def main():
173173
model_dir.mkdir(parents=True, exist_ok=True)
174174

175175
# Generate helmfile YAML content
176-
helmfile_content = f"""repositories:
176+
non_admin_defaults = ""
177+
if not ev['user_is_admin'] == "0": # Avoid default namespace creation for non cluster-level admin users
178+
non_admin_defaults = "helmDefaults:\n createNamespace: false\n---\n\n"
179+
180+
helmfile_content = f"""{non_admin_defaults}repositories:
177181
- name: {ev['vllm_modelservice_helm_repository']}
178182
url: {ev['vllm_modelservice_helm_repository_url']}
179183
- name: {ev['vllm_infra_helm_repository']}

setup/teardown.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function show_usage {
3636
-m/--models [list the models to be deployed (default=$LLMDBENCH_DEPLOY_MODEL_LIST) ] \n \
3737
-t/--methods [list of standup methods (default=$LLMDBENCH_DEPLOY_METHODS, possible values \"standalone\" and \"modelservice\") ] \n \
3838
-v/--verbose [print the command being executed, and result (default=$LLMDBENCH_CONTROL_VERBOSE) ] \n \
39+
-i/--non-admin [run the teardown script as a non-cluster-level admin user] \n \
3940
-h/--help (show this help)"
4041
}
4142

@@ -96,6 +97,10 @@ while [[ $# -gt 0 ]]; do
9697
export LLMDBENCH_CLIOVERRIDE_CONTROL_VERBOSE=1
9798
export LLMDBENCH_CONTROL_VERBOSE=1
9899
;;
100+
-i|--non-admin)
101+
announce "ℹ️ You are running as a non-cluster-level admin user."
102+
export LLMDBENCH_CLIOVERRIDE_USER_IS_ADMIN=0
103+
;;
99104
-h|--help)
100105
show_usage
101106
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
@@ -162,9 +167,11 @@ for tgtns in ${LLMDBENCH_VLLM_COMMON_NAMESPACE} ${LLMDBENCH_HARNESS_NAMESPACE};
162167
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} delete --namespace $tgtns --ignore-not-found=true httproute $(model_attribute $model modelid_label)" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
163168
fi
164169

165-
for cr in ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-endpoint-picker ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-epp-metrics-scrape ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-manager ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-metrics-auth ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-admin ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-editor ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-viewer; do
166-
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} delete --ignore-not-found=true ClusterRole $cr" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
167-
done
170+
if [[ $LLMDBENCH_USER_IS_ADMIN -eq 1 ]] ; then # Non-admin users cannot delete ClusterRole
171+
for cr in ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-endpoint-picker ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-epp-metrics-scrape ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-manager ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-metrics-auth ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-admin ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-editor ${LLMDBENCH_VLLM_MODELSERVICE_RELEASE}-modelservice-viewer; do
172+
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} delete --ignore-not-found=true ClusterRole $cr" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
173+
done
174+
fi
168175
fi
169176
done
170177

0 commit comments

Comments
 (0)