Skip to content
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

Add capabilities/privileged to build container to support running on K8s without Docker #1512

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

Conversation

manics
Copy link
Member

@manics manics commented Jul 25, 2022

I thought it'd be interesting to get BinderHub running on K8S without Docker. This is the first step:

I've only added one new config, build_capabilities, and overloaded it to set privileged=True. Alternatives include:

  • separate config for capabilities and privileged
  • allowing the full security_context to be specified- this would be the most flexible, but looking at Convert JSON or Dict to client objects kubernetes-client/python#977 it doesn't sound like it's possible to construct the a Kubernetes object form JSON... unless someone knows a way to do so?

Copy link
Collaborator

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for working on this, @manics!

@@ -382,6 +393,13 @@ def submit(self):
client.V1EnvVar(name="GIT_CREDENTIAL_ENV", value=self.git_credentials)
)

if "privileged" in self.build_capabilities:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just ask for something like build_security_context or something and just pass it on directly through?

Part of the complexity here is that we want this to be not kubernetes specific. However, I think the way to do that is to refactor out the current class to be a KubeBuilder or something, and use traitlets directly. But until then, I think we should pass config through directly as much as possible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easily, we'd need to recurse through the JSON dict by copying this KubeSpawner code:
https://github.com/jupyterhub/kubespawner/blob/63aaccc567d03110fb83c19cbdbfdc1a30eb5406/kubespawner/utils.py#L92-L188

Good point about the long-term plan to make this into a traitlets Configurable.... let me see if I can come up with something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuvipanda I've added a new traitlets based build class in #1518

@manics manics marked this pull request as draft July 28, 2022 18:32
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