Skip to content

Commit

Permalink
swan-cern: Remove webhdfs related code
Browse files Browse the repository at this point in the history
Since webhdfsbrowser extension is no longer deployed in the AlmaLinux 9
user image, the code that was removed is no longer needed
  • Loading branch information
PMax5 authored and etejedor committed Sep 30, 2024
1 parent 6ddc59f commit 53139b0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
7 changes: 0 additions & 7 deletions swan-cern/files/private/side_container_tokens_perm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 0 additions & 34 deletions swan-cern/files/swan_computing_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 53139b0

Please sign in to comment.