[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OpenShift go client library



On Tue, Oct 11, 2016 at 9:12 AM, Andy Goldstein <agoldste redhat com> wrote:
We don't currently have a standalone go client library. Your best bet, for now, is to use Godeps to vendor in the same versions of dependencies that OpenShift currently uses.

Andy

​The way we handle this for various OpenShift Online components (which use not only the client libraries but also other supporting data structures, controller framework pieces, etc) is to use godep to restore origin’s dependency tree into GOPATH and then vendor things back into our own project. It’s pretty involved, but the overall steps are:

0. Using a clean GOPATH…
1. Clone origin to $GOPATH/src/github.com/openshift/origin
2. Clone kubernetes to $GOPATH/src/k8s.io/kubernetes
3. Add and fetch a kubernetes Git remote at https://github.com/openshift/kubernetes
4. Use the origin `hack/move-upstream.sh` script to apply patches that Origin carries to its various dependencies
5. Use the origin `hack/godep-restore.sh` script to reconstitute all of Origin’s dependencies within GOPATH
6. Update any packages within GOPATH whose versions we want to override from Origin
7. Use `godep save ./…` in our own package within GOPATH to vendor our dependencies from GOPATH

Obviously this is far from ideal, but works and ensures our code is compatible with a specific of origin and all its transitive dependencies. There are some finer details omitted here (especially around `hack/move-upstream.sh`). Feel free to reach out if I can provide further clarifications. Good luck!

—Dan


 
On Tue, Oct 11, 2016 at 8:15 AM, Tomas Kral <tkral redhat com> wrote:
Hi all,
is there standalone OpenShift client library for Go?
Or what is the best way for writing programs calling OpenShift api.

Currently I'm creating OpenShift client and using it like this:

import (
  github.com/openshift/origin/pkg/client
  github.com/openshift/origin/pkg/cmd/util/clientcmd
)

factory := clientcmd.NewFactory(nil)
clientConfig, err := factory.ClientConfig()
client := client.NewOrDie(clientConfig)
  client.DeploymentConfigs(namespace).Create(dc)


But I have problem with
github.com/openshift/origin/pkg/cmd/util/clientcmd and
github.com/openshift/origin/pkg/client.
It looks like they both have
github.com/docker/docker/pkg/term/winconsole in their dependency
chain.
This is creating conflict between github.com/docker/docker versions,
because my applications requires newer version of docker, and is no
winconsole pkg :(



--
Tomas

_______________________________________________
dev mailing list
dev lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev


_______________________________________________
dev mailing list
dev lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]