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

Bulk creation API #9633

Open
parikhyash opened this issue Jun 10, 2015 · 19 comments
Open

Bulk creation API #9633

parikhyash opened this issue Jun 10, 2015 · 19 comments
Labels
area/api Indicates an issue on api area. area/app-lifecycle kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@parikhyash
Copy link
Contributor

I have a list of services defined under a json having "kind" : "list"

I'm using the v1beta3 API version.

However, I don't see any endpoint to launch a list resource.

I'm following the Swagger spec on http://kubernetes.io/third_party/swagger-ui/#!/v1beta3/listService to see the endpoints.

Is there any way to use the API to launch multiple services using a single json/yaml with kind=list?

@parikhyash
Copy link
Contributor Author

Any update on this? @thockin

@ArtfulCoder ArtfulCoder added team/community priority/backlog Higher priority than priority/awaiting-more-evidence. labels Jun 12, 2015
@thockin
Copy link
Member

thockin commented Jun 19, 2015

@jlowdermilk this should work in kubectl, right? How does it work?

@j3ffml
Copy link
Contributor

j3ffml commented Jun 19, 2015

As far as I know the raw API doesn't support multi-create. kubectl supports creating multiple items via a list, but it does so by parsing the list and issuing create requests against the appropriate endpoint for each resource.

@j3ffml
Copy link
Contributor

j3ffml commented Jun 19, 2015

So to answer your question @parikhyash, if you want to create multiple items from a single yaml/json file, use kubectl create -f if you want to use the raw API, you'll have to parse the list and issue multiple creates. Supporting list creating within the API itself is an interesting idea, but not likely to be implemented any time soon. cc @bgrant0607.

@thockin
Copy link
Member

thockin commented Jun 19, 2015

Why do we have type List in the API?

On Fri, Jun 19, 2015 at 4:28 PM, Jeff Lowdermilk notifications@github.com
wrote:

So to answer your question @parikhyash https://github.com/parikhyash,
if you want to create multiple items from a single yaml/json file, use kubectl
create -f if you want to use the raw API, you'll have to parse the list
and issue multiple creates. Supporting list creating within the API itself
is an interesting idea, but not likely to be implemented any time soon. cc
@bgrant0607 https://github.com/bgrant0607.


Reply to this email directly or view it on GitHub
#9633 (comment)
.

@bgrant0607 bgrant0607 added kind/enhancement area/api Indicates an issue on api area. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed team/community labels Jun 19, 2015
@bgrant0607
Copy link
Member

@thockin We have list types for 2 reasons:

  1. That's what LIST (GET on a resource collection) returns
  2. So kubectl can decode/encode a LIST using the same machinery we use to decode/encode API objects

I could imagine a bulk-creation API in the future. I added this to the "v2" API list (#8190).

@bgrant0607 bgrant0607 changed the title Launch resource of "list" kind using rest API Bulk creation API Jun 20, 2015
@parikhyash
Copy link
Contributor Author

Thanks for the update @jlowdermilk . I'll continue using the multiple create approach for now.

The bulk-creation feature is particularly useful for bringing up all components of a Storm cluster or even a Redis cluster at once.
Also, will there be any field similar to dependencies in the future? For example, Nimbus would first wait for the Zookeeper replication controller to come up while supervisors wait for both Nimbus and Zookeeper. @bgrant0607 (Marathon does this by having a field called "dependencies" which takes a list of components)

@bgrant0607
Copy link
Member

Re. dependencies: Some previous discussion on #1768 and #4245

@thockin
Copy link
Member

thockin commented Jun 20, 2015

  1. I thought we returned PodList, ServiceList, etc for GET operations?

  2. We have pkg/client/clientcmd/api/types.go, why does this need to be in
    the main API file (assuming I am right on (1).

On Fri, Jun 19, 2015 at 5:01 PM, Brian Grant notifications@github.com
wrote:

@thockin https://github.com/thockin We have list types for 2 reasons:

  1. That's what LIST (GET on a resource collection) returns
  2. So kubectl can decode/encode a LIST using the same machinery we use to
    decode/encode API objects

I could imagine a bulk-creation API in the future. I added this to the
"v2" API list (#8190
#8190).


Reply to this email directly or view it on GitHub
#9633 (comment)
.

@bgrant0607
Copy link
Member

  1. True. The list mentioned at the top of this issue actually has kind ServiceList.
  2. List predates clientcmd/api/types.go. List was added in Allow runtime.Object to be encoded as runtime.RawExtension #2786. It doesn't appear in the swagger, only in types.go.

@thockin
Copy link
Member

thockin commented Jun 20, 2015

As I understand it the api/*/types.go List type is for use in json/yaml
files to hold a lit of multiple object types. I just don't get why it is
in pkg/api and not pkg/client, if outr API doesn't actually support it.

On Fri, Jun 19, 2015 at 10:40 PM, Brian Grant notifications@github.com
wrote:

  1. True. The list mentioned at the top of this issue actually has kind
    ServiceList.
  2. List predates clientcmd/api/types.go. List was added in Allow runtime.Object to be encoded as runtime.RawExtension #2786
    Allow runtime.Object to be encoded as runtime.RawExtension #2786. It
    doesn't appear in the swagger, only in types.go.


Reply to this email directly or view it on GitHub
#9633 (comment)
.

@bgrant0607
Copy link
Member

Don't know, but added to my massive API/client overhaul list in #8190

@thockin
Copy link
Member

thockin commented Jun 20, 2015

SGTM

On Fri, Jun 19, 2015 at 10:52 PM, Brian Grant notifications@github.com
wrote:

Don't know, but added to my massive API/client overhaul list in #8190
#8190


Reply to this email directly or view it on GitHub
#9633 (comment)
.

@bgrant0607
Copy link
Member

We would use the List type if we implemented watch of multiple kinds #1685

@bgrant0607 bgrant0607 added area/app-lifecycle team/api and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Nov 12, 2015
@0xmichalis 0xmichalis added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed team/api (deprecated - do not use) labels Mar 20, 2017
@fejta-bot
Copy link

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.

Prevent issues from auto-closing with an /lifecycle frozen comment.

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 22, 2017
@fejta-bot
Copy link

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
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 21, 2018
@bgrant0607
Copy link
Member

/remove-lifecycle rotten
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jan 27, 2018
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/enhancement labels Jun 5, 2018
@sftim
Copy link
Contributor

sftim commented Dec 20, 2022

Our typical answer to an end user need for bulk creation is to recommend that they use a controller (or operator), right?

@GowthamShanmugam
Copy link

How to do bulk action using a controller, Creating one CR will trigger multiple CR creations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/app-lifecycle kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

10 participants