kubernetes-retired / service-catalog

Consume services in Kubernetes using the Open Service Broker API
https://svc-cat.io
Apache License 2.0
1.05k stars 385 forks source link

Interacting with the service catalog API extension in third party application #1367

Closed maleck13 closed 5 years ago

maleck13 commented 6 years ago

When writing applications that interact with the kubernetes API we have the client-go. I am wondering what is the plan with api extensions such as the service catalog? If I wanted to interact with the service catalog API what would be the best way to do this currently?Can I consume the client package in this repo independently?

pmorie commented 6 years ago

I think we will have to publish a service-catalog-client-go project with just the client so that you don't have to pull the entire project in. It's worth thinking about what strategy we should have for releasing such a library so that it will work in the same GOPATH as a contemporary client-go.

maleck13 commented 6 years ago

Yes a client-go would be good, I think it is an interesting question for all extension API servers. I haven't had to extract a client before, but given that there is a generated clientset, it would be nice if there were tooling (I am not aware of any) that would allow extracting the generated client into a lib as this could be used by all API servers.

nilebox commented 6 years ago

I think we will have to publish a service-catalog-client-go project with just the client so that you don't have to pull the entire project in

While this has been done for the Kubernetes core server (with client-go project), the other API servers still provide their clients as part of their server repo, for example CRD server: apiextensions-apiserver, and the usage example: https://github.com/kubernetes/apiextensions-apiserver/blob/master/examples/client-go/main.go#L26

So I don't think there is an established best practice strategy for providing Go-clients.

surajnarwade commented 6 years ago

@pmorie , any progress on this ? I am confused how to use service-catalog as a library.

maleck13 commented 6 years ago

We are currently generating the client based on the api definitions. Using the kubernetes client-gen tool

surajnarwade commented 6 years ago

@maleck13 , any blog post or document link will help a lot. I want list down and consume services from my project. here is reference issue https://github.com/redhat-developer/odo/issues/266

maleck13 commented 6 years ago

@surajnarwade This may be useful https://github.com/aerogear/mobile-cli/blob/master/scripts/generate.sh

Shows how we are using the generate tool. The side effect here is it is up to us to keep the definitions upto date. Although there may be a way around that. Example usage of the client https://github.com/aerogear/mobile-cli/blob/master/pkg/cmd/services.go#L62

maleck13 commented 6 years ago

Would a proposal for this be a way forward? Happy to take this on

carolynvs commented 6 years ago

Using dep, I was able to write a third party app that used service catalog's client, and not end up pulling in all of the rest of their code too.

Gopkg.toml

[[constraint]]
  name = "github.com/kubernetes-incubator/service-catalog"
  version = "v0.1.18"

[prune]
  non-go = true
  go-tests = true
  unused-packages = true

It works just like the regular k8s client. I'd like to see this better documented but I don't believe we need a proposal or anything. @maleck13 Would you be interested in writing a new page for our docs that explains how to import, initialize and use the client? I have examples if you think that would help.

maleck13 commented 6 years ago

@carolynvs awesome this is great. I would be happy to contribute a docs update for this!

carolynvs commented 6 years ago

@maleck13 Sweet! Let me know if you have any questions, otherwise feel free to open a WIP PR and we can collaborate there. Or ping me on the k8s slack if that helps.

fejta-bot commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot commented 5 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot commented 5 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

k8s-ci-robot commented 5 years ago

@fejta-bot: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/service-catalog/issues/1367#issuecomment-504681631): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >Send feedback to sig-testing, kubernetes/test-infra and/or [fejta](https://github.com/fejta). >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.