Skip to content

fix: refactor oauth2 support for earthscope-sdk #6194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hamilton-earthscope
Copy link
Contributor

This PR reconfigures how EarthScope's oauth2 context is injected into spawned containers

Copy link

github-actions bot commented Jun 11, 2025

Merging this PR will trigger the following deployment actions.

Support deployments

No support upgrades will be triggered

Staging deployments

Cloud Provider Cluster Name Hub Name Reason for Redeploy
aws earthscope staging Following helm chart values files were modified: common.values.yaml
gcp cloudbank staging Following prod hubs require redeploy: csun

Production deployments

Cloud Provider Cluster Name Hub Name Reason for Redeploy
gcp cloudbank csun Following helm chart values files were modified: csun.values.yaml
aws earthscope prod Following helm chart values files were modified: common.values.yaml
aws earthscope binder Following helm chart values files were modified: common.values.yaml

@yuvipanda
Copy link
Member

@hamilton-earthscope ty for the PR! I've rebased and deployed this to staging.geolab.earthscope.cloud/hub/oauth_login. I think it's failing because the JSON needs to be escaped. Here's the exception:

[E 2025-06-11 15:10:51.839 JupyterHub user:1007] Unhandled error starting google-oauth2|101500906458831444600's server: '"oauth2"'
    Traceback (most recent call last):
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/user.py", line 920, in spawn
        await asyncio.wait_for(f, timeout=spawner.start_timeout)
      File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
        return await fut
               ^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 3151, in _start
        pod = await self.get_pod_manifest()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 2306, in get_pod_manifest
        env=self.get_env(),  # Expansion is handled by get_env
            ^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 2498, in get_env
        env.update(self._expand_env(self.environment))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 2119, in _expand_env
        expanded_env[k] = self._expand_all(v)
                          ^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 2130, in _expand_all
        return self._expand_user_properties(src)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/kubespawner/spawner.py", line 2105, in _expand_user_properties
        rendered = template.format(**ns)
                   ^^^^^^^^^^^^^^^^^^^^^
    KeyError: '"oauth2"'

So this is a python string.format that needs to be escaped - primarily { -> {{ and } -> }} I think.

@yuvipanda
Copy link
Member

@hamilton-earthscope that seems to have fixed it. I deployed it in https://staging.geolab.earthscope.cloud/hub/oauth_login. wanna test and verify, and i'll deploy to prod?

@hamilton-earthscope
Copy link
Contributor Author

@yuvipanda it looks good on my end, thank you.

Can we hold off on merging this/deploying to prod until we are able to update our default image with a new version of our SDK?

@yuvipanda
Copy link
Member

@hamilton-earthscope great! Let me know and I'll merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants