Skip to content

Commit 7c8f519

Browse files
arpsharmArpit Sharma
andauthored
Support BENCHMARK_OPERATOR_NAMESPACE for OpenShift CI (#1184)
When set, use BENCHMARK_OPERATOR_NAMESPACE for workload/operator namespace so CI can leave NAMESPACE as the job namespace for the result secret. Fixes permission error: framework cannot write secret in benchmark-operator on the build cluster. Co-authored-by: Arpit Sharma <arpsharm@arpsharm-thinkpadx1carbongen9.bengluru.csb>
1 parent 2d0245f commit 7c8f519

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benchmark_runner/main/environment_variables.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ def __init__(self):
136136
'hammerdb': 4.0
137137
}
138138

139-
# Set namespace based on workload
139+
# Set namespace based on workload.
140+
# BENCHMARK_OPERATOR_NAMESPACE is used when set (e.g. OpenShift CI) so the app targets that
141+
# namespace for workload/operator while NAMESPACE can remain the job namespace for the framework.
140142
base_workload = self._environment_variables_dict['workload'].split('_')[0]
141-
if EnvironmentVariables.get_env('NAMESPACE'):
143+
if EnvironmentVariables.get_env('BENCHMARK_OPERATOR_NAMESPACE'):
144+
self._environment_variables_dict['namespace'] = EnvironmentVariables.get_env('BENCHMARK_OPERATOR_NAMESPACE')
145+
elif EnvironmentVariables.get_env('NAMESPACE'):
142146
self._environment_variables_dict['namespace'] = EnvironmentVariables.get_env('NAMESPACE')
143147
elif base_workload in self._environment_variables_dict['workload_namespaces']:
144148
default_namespace = self._environment_variables_dict['workload_namespaces'][base_workload]

0 commit comments

Comments
 (0)