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

feat(CLI): Support context #92

Closed
Tracked by #179 ...
gaocegege opened this issue Apr 29, 2022 · 8 comments
Closed
Tracked by #179 ...

feat(CLI): Support context #92

gaocegege opened this issue Apr 29, 2022 · 8 comments

Comments

@gaocegege
Copy link
Member

Description

context is used to switch between the backends (e.g. docker, kubernetes)

@gaocegege
Copy link
Member Author

cc @FogDong

@knight42
Copy link
Member

It seems we could save the contexts into the config file, something like:

$ cat config.yaml
current-context: foo
contexts:
- name: foo
  docker:
    config-path: /path/to/config.json (Defaults to ~/.docker/config.json)
- name: bar
  kubernetes:
    config-path: /path/to/kubeconfig (Defaults to ~/.kube/config)

We could add a new subcommand, say context, to manage contexts in the config.

@knight42
Copy link
Member

BTW this issue reminds me that docker cli supports context now: https://docs.docker.com/engine/context/working-with-contexts/

@gaocegege
Copy link
Member Author

It seems we could save the contexts into the config file, something like:

$ cat config.yaml
current-context: foo
contexts:
- name: foo
  docker:
    config-path: /path/to/config.json (Defaults to ~/.docker/config.json)
- name: bar
  kubernetes:
    config-path: /path/to/kubeconfig (Defaults to ~/.kube/config)

We could add a new subcommand, say context, to manage contexts in the config.

Yeah, the design LGTM although envd does not support k8s now. We can support different docker contexts currently.

@gaocegege
Copy link
Member Author

We may need to support two different context types: build and run.

The context for the build is to determine what buildkit will be used in envd. For example, buildkit container in the docker daemon docker-container://envd_buildkitd can be used. Or kube-pod://<pod-name-for-buildkit> also can be used if there is a buildkitd running on the Kubernetes.

Users may expect to use the buildkit on Kubernetes for CI. Ref #510

The context for the run will be used when running envd up. The container or pod will be created after the image is built successfully with buildkitd. We can use Docker or Kubernetes to run it. Thus we also need to support context here.

@gaocegege
Copy link
Member Author

gaocegege commented Jun 26, 2022

The user experience for the build may look like this:

envd context create --name docker-buildkit --builder docker-container://envd_buildkitd
envd context create --name kubernetes-buildkit --builder kube-pod://envd-buildkitd
envd context use --name kubernetes-buildkit
envd build 

The user experience for the run may look like this:

envd context create --name docker --docker /var/run/docker.sock
envd context create --name kubernetes --kubernetes <kubeconfig-path>
envd context use kubernetes 
envd up

The default builder should be docker-container://envd_buildkitd, the default runner should be --docker /var/run/docker.sock (Maybe different in macOS)

@gaocegege
Copy link
Member Author

@rudeigerc Hi are you still interested in the issue? Users expect it in the next release to support #510

@rudeigerc
Copy link
Member

@gaocegege I am a little bit running out of time recently. Please feel free to unassign me if other ones are interested in this issue.

@rudeigerc rudeigerc removed their assignment Jun 26, 2022
@gaocegege gaocegege self-assigned this Jun 26, 2022
@gaocegege gaocegege moved this to Done in envd sprint board Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

No branches or pull requests

3 participants