-
Notifications
You must be signed in to change notification settings - Fork 95
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
Make CDSDashboards.conda_envs dynamically update from function #1358
Conversation
bfc6bb3
to
fcbde47
Compare
Also related #1293 |
f54f34e
to
a457df7
Compare
I will update this issue later today. @viniciusdc will help with testing this PR once the tests pass. |
Will be working on this PR later tomorrow and have complete by Tuesday. Goal is to make use of the conda-store api to get available environments. |
Will be using the |
@HarshCasper some details on how to accomplish this. In the conda_store_config.py we will need to generate an api token via c.AuthenticationBackend.predefined_tokens = {
f"{config["cdsdashboard-secret"]}": {
"primary_namespace": "cdsdashboards",
"role_bindings": {
"*/*": ["viewer"],
}
}
} This is passed inside of here /~https://github.com/Quansight/qhub/blob/main/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/conda-store/server.tf#L1-L23. The more I think about it these tokens and permissions should be passed in in /~https://github.com/Quansight/qhub/blob/main/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/conda-store/variables.tf#L70 as a variable with the secret token along with permissions needed. here you will need to create a function which calls the conda-store kubernetes service api with this endpoint https://conda-store.readthedocs.io/en/latest/api.html#/api/api_list_environments_api_v1_environment__get. Getting started it might be easiest to hardcode the api token that is added to the conda-store config in order to test the api calls from cdsdashboards. Later we can talk about how to link them in terraform code. We will likely do tricks similar to how this same pattern is handled in jupyterhub /~https://github.com/Quansight/qhub/blob/main/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/variables.tf#L84-L87. |
a457df7
to
1be6876
Compare
@costrouc Tokens and the above configuration were all completed. I am working on a basic function to call the API. |
kubernetes.client.models.V1EndpointPort = kubernetes.client.models.CoreV1EndpointPort | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this line generated the following error:
Loading extra config: 01-theme.py │
│ Loading extra config: 02-spawner.py │
│ [E 2022-09-05 18:46:15.302 JupyterHub app:2989] │
│ Traceback (most recent call last): │
│ File "/opt/conda/lib/python3.7/site-packages/jupyterhub/app.py", line 2986, in launch_instance_async │
│ await self.initialize(argv) │
│ File "/opt/conda/lib/python3.7/site-packages/jupyterhub/app.py", line 2477, in initialize │
│ self.load_config_file(self.config_file) │
│ File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 110, in inner │
│ return method(app, *args, **kwargs) │
│ File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 889, in load_config_file │
│ raise_config_file_errors=self.raise_config_file_errors, │
│ File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 844, in _load_config_files │
│ config = loader.load_config() │
│ File "/opt/conda/lib/python3.7/site-packages/traitlets/config/loader.py", line 625, in load_config │
│ self._read_file_as_dict() │
│ File "/opt/conda/lib/python3.7/site-packages/traitlets/config/loader.py", line 658, in _read_file_as_dict │
│ exec(compile(f.read(), conf_filename, "exec"), namespace, namespace) │
│ File "/usr/local/etc/jupyterhub/jupyterhub_config.py", line 446, in <module> │
│ exec(config_py) │
│ File "<string>", line 5, in <module> │
│ File "/opt/conda/lib/python3.7/site-packages/kubespawner/__init__.py", line 13, in <module> │
│ from kubespawner.spawner import KubeSpawner │
│ File "/opt/conda/lib/python3.7/site-packages/kubespawner/spawner.py", line 42, in <module> │
│ from .objects import make_namespace │
│ File "/opt/conda/lib/python3.7/site-packages/kubespawner/objects.py", line 16, in <module> │
│ from kubernetes.client.models import V1EndpointPort │
│ ImportError: cannot import name 'V1EndpointPort' from 'kubernetes.client.models' (/opt/conda/lib/python3.7/site-packages/kubernetes/client/models/__init__.py)
Which made the Hub deployment enter a crash loop cycle. Returning the block above fixed the problem.
It needs to be tested with |
Blocked by ideonate/cdsdashboards#107, I was able to test this locally, though lets-encrypt didn't want to cooperate providing a valid cert... so I was unable to properly "see" the dashboard. Still, it was successfully launched with the mentioned changes in cdsdashboards. |
This is ready for review, when testing please be sure to use the latest available image from main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to wait for a new release of Conda-Store which I will be releasing tonight.
.../07-kubernetes-services/modules/kubernetes/services/conda-store/config/conda_store_config.py
Show resolved
Hide resolved
I will do another drive-test on this, then we are set |
Thanks for updating the cypress tests @iameskild, once you approve, this is ready to be merged. Something that we will need to check once v0.4.5rc shows up in beta, is how conda-store old environments will behave with the name changes (we are modifying the exposed env names with this config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viniciusdc I tested this myself and it works wonderfully :)
Closes #1310
Closes #1293
Changes introduced in this PR:
Types of changes
What types of changes does your PR introduce?
Put an
x
in the boxes that applyTesting
Requires testing
In case you checked yes, did you write tests?