Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Examples of using golang bindings? #1506

Closed
achanda opened this issue Sep 29, 2015 · 4 comments
Closed

Examples of using golang bindings? #1506

achanda opened this issue Sep 29, 2015 · 4 comments

Comments

@achanda
Copy link
Contributor

achanda commented Sep 29, 2015

I am trying to run rkt programmatically from another application. Are there any official golang bindings? I am looking at https://github.com/coreos/rkt/blob/master/api/v1/api.pb.go and I assume I'd need to go generate code, but how do I vendor this in to another project? Are there any usage examples?

@jonboulle
Copy link
Contributor

@achanda would love to hear more about your use case. This is not something we've focused on as the intention is really for rkt to integrate tightly with other systems (like systemd, Kubernetes, etc) which expose their own APIs.

The rkt API you reference (which will soon be available as a service - #1411) is intended for exposing read-only information about rkt pods/images only (see #1193, #1208); we want it to run as a non-privileged user, and for the foreseeable future rkt run will require root privileges to actually create/execute containers. (I should also mention that at the moment the API is proposed, experimental and subject to change - I'll post a clarification of that shortly.)

@yifan-gu can you point @achanda towards how we programmatically use rkt from the kubelet?

@achanda
Copy link
Contributor Author

achanda commented Sep 30, 2015

@jonboulle my use case is similar to kubelet. I was trying to add rkt support to https://github.com/hashicorp/nomad We were thinking if the integration will be more robust if we could use run rkt programatically. The PR is here: hashicorp/nomad#165

I was looking at the rkt package in kubernetes. The underlying implementation runs the rkt binary. Also, the rkt package seems to be pretty tightly integrated to kubernetes. I am not sure the package can be used in isolation. I am looking at:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/rkt/rkt.go

Thoughts?

@yifan-gu
Copy link
Contributor

@achanda Had a glance at your PR, seems currently the driver only launches the rkt pod. If that's all you need, then you don't need the client library. However rkt has not planned to provide APIs for launching pods because it's daemonless. The suggested way is to use other daemon to invoke rkt run to launch a pod such as systemd or other process supervisor.
If you need to get the pod/image information, you can wait for #1508 to be merged, then you should be able to use the generated grpc client bindings(https://github.com/coreos/rkt/blob/master/api/v1/api.pb.go#L708) in your code.

@achanda
Copy link
Contributor Author

achanda commented Sep 30, 2015

@jonboulle @yifan-gu thanks for the pointers guys. For now, I need to launch pods, thus a command invocation should be good enough. I will close this issue now.

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

No branches or pull requests

3 participants