@@ -60,6 +60,7 @@ def __init__(
6060 num_of_workers ,
6161 single_worker_memory ,
6262 kerberos = False ,
63+ voms_proxy = False ,
6364 ):
6465 """Instantiate Dask resource manager.
6566
@@ -95,6 +96,7 @@ def __init__(
9596 self .kubernetes_uid = WORKFLOW_RUNTIME_USER_UID
9697
9798 self .kerberos = kerberos
99+ self .voms_proxy = voms_proxy
98100
99101 if DASK_AUTOSCALER_ENABLED :
100102 self .autoscaler_name = get_dask_component_name (workflow_id , "autoscaler" )
@@ -216,11 +218,10 @@ def _prepare_cluster(self):
216218 )
217219
218220 rucio = False
219- voms_proxy = False
220221
221222 if self .kerberos :
222223 self ._add_krb5_containers ()
223- if voms_proxy :
224+ if self . voms_proxy :
224225 self ._add_voms_proxy_init_container ()
225226 if rucio :
226227 self ._add_rucio_init_container ()
@@ -343,6 +344,28 @@ def _add_krb5_containers(self):
343344 f"trap 'touch { KRB5_STATUS_FILE_LOCATION } ' EXIT; " + existing_args [0 ]
344345 ]
345346
347+ def _get_voms_proxy_secrets (self , secrets_store ):
348+ """Get VOMS proxy secrets from secrets store.
349+
350+ Args:
351+ secrets_store: User secrets store instance
352+
353+ Returns:
354+ dict: Dictionary containing VOMS proxy secrets with empty string defaults
355+ """
356+ secret_keys = ["VONAME" , "VOMSPROXY_FILE" , "VOMSPROXY_PASS" ]
357+ secrets = {}
358+
359+ for key in secret_keys :
360+ secret = secrets_store .get_secret (key )
361+ secrets [key .lower ()] = secret .value_str if secret else ""
362+
363+ return {
364+ "vo" : secrets ["voname" ],
365+ "file" : secrets ["vomsproxy_file" ],
366+ "pass" : secrets ["vomsproxy_pass" ],
367+ }
368+
346369 def _add_voms_proxy_init_container (self ):
347370 """Add sidecar container for Dask workers."""
348371 ticket_cache_volume = {"name" : "voms-proxy-cache" , "emptyDir" : {}}
@@ -358,8 +381,10 @@ def _add_voms_proxy_init_container(self):
358381 current_app .config ["VOMSPROXY_CERT_CACHE_FILENAME" ],
359382 )
360383
361- voms_proxy_vo = os .environ .get ("VONAME" , "" )
362- voms_proxy_user_file = os .environ .get ("VOMSPROXY_FILE" , "" )
384+ voms_proxy_secrets = self ._get_voms_proxy_secrets (self .secrets_store )
385+ voms_proxy_vo = voms_proxy_secrets ["vo" ]
386+ voms_proxy_user_file = voms_proxy_secrets ["file" ]
387+ voms_proxy_pass = voms_proxy_secrets ["pass" ]
363388
364389 if voms_proxy_user_file :
365390 # multi-user deployment mode, where we rely on VOMS proxy file supplied by the user
@@ -399,23 +424,24 @@ def _add_voms_proxy_init_container(self):
399424 echo "[ERROR] File usercert.pem does not exist in user secrets."; \
400425 exit; \
401426 fi; \
402- if [ -z "$VOMSPROXY_PASS" ]; then \
427+ if [ -z {voms_proxy_pass} ]; then \
403428 echo "[ERROR] Environment variable VOMSPROXY_PASS is not set in user secrets."; \
404429 exit; \
405430 fi; \
406- if [ -z "$VONAME" ]; then \
431+ if [ -z {voms_proxy_vo} ]; then \
407432 echo "[ERROR] Environment variable VONAME is not set in user secrets."; \
408433 exit; \
409434 fi; \
410435 cp /etc/reana/secrets/userkey.pem /tmp/userkey.pem; \
411436 chmod 400 /tmp/userkey.pem; \
412- echo $VOMSPROXY_PASS | base64 -d | voms-proxy-init \
437+ echo {voms_proxy_pass} | base64 -d | voms-proxy-init \
413438 --voms {voms_proxy_vo} --key /tmp/userkey.pem \
414439 --cert $(readlink -f /etc/reana/secrets/usercert.pem) \
415440 --pwstdin --out {voms_proxy_file_path}; \
416441 chown {kubernetes_uid} {voms_proxy_file_path}' .format (
417442 voms_proxy_vo = voms_proxy_vo .lower (),
418443 voms_proxy_file_path = voms_proxy_file_path ,
444+ voms_proxy_pass = voms_proxy_pass ,
419445 kubernetes_uid = self .kubernetes_uid ,
420446 ),
421447 ],
0 commit comments