From 4291f706e6ddd4645888fa57fa1c7f21bc4996ca Mon Sep 17 00:00:00 2001 From: Pedro Maximino Date: Mon, 30 Sep 2024 11:38:15 +0200 Subject: [PATCH] swan-cern: Remove webhdfs related code Since webhdfsbrowser extension is no longer deployed in the AlmaLinux 9 user image, the code that was removed is no longer needed --- .../private/side_container_tokens_perm.sh | 7 ---- swan-cern/files/swan_computing_config.py | 34 ------------------- 2 files changed, 41 deletions(-) diff --git a/swan-cern/files/private/side_container_tokens_perm.sh b/swan-cern/files/private/side_container_tokens_perm.sh index 1362b350..97236179 100644 --- a/swan-cern/files/private/side_container_tokens_perm.sh +++ b/swan-cern/files/private/side_container_tokens_perm.sh @@ -27,13 +27,6 @@ if [[ ! -f "/srv/side-container/eos/krb5cc" ]]; then exit 1 fi -if [[ -f "/srv/side-container/hadoop/webhdfs.toks" ]]; then - echo "add hadoop.toks to user container" - copy_token_to_notebook /srv/side-container/hadoop/webhdfs.toks /srv/notebook/tokens/webhdfs.toks -else - echo "webhdfs.toks not required, skipping" -fi - if [[ -f "/srv/side-container/hadoop/hadoop.toks" ]]; then echo "add hadoop.toks to user container" copy_token_to_notebook /srv/side-container/hadoop/hadoop.toks /srv/notebook/tokens/hadoop.toks diff --git a/swan-cern/files/swan_computing_config.py b/swan-cern/files/swan_computing_config.py index 32cd6d8f..1bd9cf16 100644 --- a/swan-cern/files/swan_computing_config.py +++ b/swan-cern/files/swan_computing_config.py @@ -145,7 +145,6 @@ async def _init_hadoop_secret(self): username = self.spawner.user.name hadoop_secret_name = f'hadoop-tokens-{username}' - webhdfs_token_base64 = '' k8suser_config_base64 = '' if cluster == 'k8s': @@ -159,24 +158,6 @@ async def _init_hadoop_secret(self): # if no access, all good for now raise ValueError("Could not setup user on k8s") - try: - # Retrieve hdfs token for user - webhdfs_token_base64 = subprocess.check_output( - ['sudo', '--preserve-env=SWAN_DEV', '/srv/jupyterhub/private/webhdfs_token.sh', hdfs_cluster, username], timeout=60 - ).decode('ascii') - except Exception as e: - # if no access, all good for now - raise ValueError("Could not get webhdfs tokens") - else: - try: - # Retrieve hdfs token for user - webhdfs_token_base64 = subprocess.check_output( - ['sudo', '--preserve-env=SWAN_DEV', '/srv/jupyterhub/private/webhdfs_token.sh', cluster, username], timeout=60 - ).decode('ascii') - except Exception as e: - # if no access, all good for now - raise ValueError("Could not get webhdfs tokens") - # Create V1Secret with webdhfs token and k8s user config try: secret_data = V1Secret() @@ -187,7 +168,6 @@ async def _init_hadoop_secret(self): secret_data.metadata = secret_meta secret_data.data = {} secret_data.data['k8s-user.config'] = k8suser_config_base64 - secret_data.data['webhdfs.toks'] = webhdfs_token_base64 try: await self.spawner.api.read_namespaced_secret(hadoop_secret_name, swan_container_namespace) @@ -257,20 +237,6 @@ def _modify_containers_for_spark(self, hadoop_secret_name): ), ) - # webhdfs token - notebook_container.env = self._add_or_replace_by_name( - notebook_container.env, - V1EnvVar( - name='WEBHDFS_TOKEN', - value_from=V1EnvVarSource( - secret_key_ref=V1SecretKeySelector( - key='webhdfs.toks', - name=hadoop_secret_name - ) - ) - ), - ) - def _gpu_enabled(self): """ return True if the user has requested a GPU