cloudera / director-sdk

Cloudera Director API clients
http://www.cloudera.com/director
Apache License 2.0
17 stars 19 forks source link

Grow and Shrink using the API #3

Closed ujjwal closed 8 years ago

ujjwal commented 8 years ago

Trying to figure out how to growAndShrink the cluster using the API. I am guessing it is using ClusterAPI PUT, but I can find no documentation around the payload.

I just want to be able to reduce/increase a certain type of instance groups.

vinithra commented 8 years ago

Hi,

If you do a GET of the cluster endpoint, then you'll get the current data that Director is operating on. You can then modify the count of the instance group that you want to grow/shrink and provide that as the payload for PUT. You can use the API console to experiment with this. To access the API console, click on the ? symbol in the upper right corner of the Director UI.

Hope this helps.

Vinithra.

ujjwal commented 8 years ago

I see instances but don't see instance group in the JSON. Am I missing something?

andreisavu commented 8 years ago

@ujjwal Director is using a declarative approach. To grow a cluster via the API what you need to do is to retrieve the current cluster template, mutate the object to include additional virtual instances (with random UUID as identifiers) and send it back as an update request.

See the following file for more details on how the template was constructed: https://github.com/cloudera/director-sdk/blob/master/python-client-samples/cluster.py