Momentlabs / athenaeum

Jupyter Notebooks as a service
1 stars 0 forks source link

Implement the ConfigMap, Helm configuration regieme #10

Closed jdrivas closed 6 years ago

jdrivas commented 6 years ago

In the above, configuration parameter means an entry in the Values file that can then be read by jupyterhub_config.py. That file is stored on the Docker image and so not available to Helm for Values interpolation. This means that the Values have to be inserted into the configuration file during deployment somehow. The preferred mechanism would seem to be a Kubernetes ConfigMap. The question then is how do we get them into the configuration file.?

jdrivas commented 6 years ago

For the moment, we're going to initialize the PVC statically and simply instruct KubeSpawner how to mount volumes and claim from that static PBC.

After this works we'll configure KS to make the claim dynamically.

jdrivas commented 6 years ago

For the Service configuration.

jdrivas commented 6 years ago

There are a couple of ways to support config and the .py configuration file.

  1. We can, essentially, recreate the Values file in a new Yaml file, that is then used as the data section for the configmap (this is essentially what the z2h folks did). Interestingly the z2h solution uses the form of ConfigMap that puts each Key into it's own file when mounted. The alternative, which I prefer, is to simply create a single yaml file, that is then read in to the config.py file as a one structure. Less frequent disk reads and Yaml translations (just one 'big' one). Less magic API. No get_value(....), just access the structure directly: config.foo.bar

  2. We can try to interpolate the Values file in with a template File().asConfig directive. I expect this won't work, haven't tried it yet, but this would be the best solution as it would keep it down to a single file rather than a pair of files we have to keep in sync - which is never a good idea.

  3. We could autogenerate the configmap from the Values file, not ideal but should only be required when we actually add entries to the Values file. This could be automated and incorporated to the git checkin process. Initial development will be a nightmare though.

I don't really like any of these options, except if 2 works they way I need it to.

jdrivas commented 6 years ago

Implemented and tested. The wiki contains a detailed explanation of what we're doing for coinfig.

The comment above is still relevant. We have more duplication than I would like, but are still striving for as much DRY as possible. The ConfigMap cannot be autogenerated from the Values file as not all elements are simply repeated from the Values file, some use helper templates. There really should be a better way, but we don't have it yet.