Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

feat: add binding for instance group manager #104

Closed
wants to merge 27 commits into from

Conversation

toots
Copy link

@toots toots commented Jun 13, 2018

Fixes #103

This is missing a couple of methods and untested but should be a good start to see if that's headed to the right direction.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 13, 2018
@fhinkel
Copy link
Contributor

fhinkel commented Jun 13, 2018

Thanks! I think the linter recently switch the format. Can you update the linter and rerun?

@codecov
Copy link

codecov bot commented Jun 13, 2018

Codecov Report

Merging #104 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #104    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          19     21     +2     
  Lines        1581   1749   +168     
======================================
+ Hits         1581   1749   +168
Impacted Files Coverage Δ
src/autoscaler.js 100% <ø> (ø) ⬆️
src/index.js 100% <100%> (ø) ⬆️
src/instance-template.js 100% <100%> (ø)
src/instance-group-manager.js 100% <100%> (ø)
src/zone.js 100% <100%> (ø) ⬆️
src/operation.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 379ef81...945b547. Read the comment docs.

@toots
Copy link
Author

toots commented Jun 13, 2018

lint tests fixed :-)

@toots
Copy link
Author

toots commented Jun 14, 2018

I've added bindings for removeVMs and resize. However, I hit a snag looking at setInstanceTemplate & realized instance templates aren't supported yet.

I will try to have a look at it as well. Is it customary for these APIs to pass an instance of InstanceTemplate to setInstanceTemplate and extract the URL from the object or should the user pass directly the instanceURL as set by the server?

@toots
Copy link
Author

toots commented Jun 14, 2018

Okay, instanceTemplate is mostly there, still untested. Unless I hear back I'm gonna go ahead and enable passing Object<instanceTemplate> | String<instanceTemplateUrl> as instance template parameter for the instance group manager. This code is still totally untested but I've got an application waiting to use it so it'll eventually happen..

@toots
Copy link
Author

toots commented Jun 15, 2018

Ok, lookin at how images are created I did the same for instance group managers, adding mandatory instanceTemplate parameter and un-documenting autoCreate. That should wrap up the functionalities for this PR. Only thing I guessed was wether or not it is possible to use relative URLs for the instance template, same way as is done with disk image in image creation. I'm gonna test this in my application now so we shall see.. :-)

@toots
Copy link
Author

toots commented Jun 15, 2018

Ok, it would appear that at least the create functions are working, thus I think this PR is ready for review!

Copy link
Contributor

@stephenplusplus stephenplusplus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All is looking very good, just some small comments so far. Thank you for your help and patience!

src/index.js Outdated
@@ -351,7 +353,8 @@ Compute.prototype.createHealthCheck = function(name, options, callback) {
* //-
* compute.createImage('new-image', disk).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* var image = data[1];

This comment was marked as spam.

src/index.js Outdated
* const apiResponse = data[2];
* });
*/
Compute.prototype.createInstanceTemplate = function(name, options, callback) {

This comment was marked as spam.

src/index.js Outdated
*
* @param {string} name - The name of the target image.
* @param {object=} options - See an
* [InstanceTemplate resource](https://cloud.google.com/compute/docs/reference/v1/instanceTemplate#resource).

This comment was marked as spam.

src/index.js Outdated
var self = this;

if (typeof options !== 'object') {
throw new Error('options object is required.');

This comment was marked as spam.

src/index.js Outdated
* Get a list of instance templates.
*
* @see [InstanceTemplates Overview]{@link https://cloud.google.com/compute/docs/instanceTemplates}
* @see [InstanceTemplates: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceTemplates}

This comment was marked as spam.

src/zone.js Outdated
throw new Error('An InstanceTemplate object is required.');
}

if (typeof targetSize !== 'number') {

This comment was marked as spam.

@@ -0,0 +1,550 @@
/*!
* Copyright 2016 Google Inc. All Rights Reserved.

This comment was marked as spam.

/**
* Get a list of managed VM instances in this instance group manager.
*
* @see [InstaceGroups: listInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroupManagers/listInstances}

This comment was marked as spam.

* const apiResponse = data[1];
* });
*/
InstanceGroupManager.prototype.recreateVMs = function(callback) {

This comment was marked as spam.

this.request(
{
method: 'POST',
uri: '/resize?size=' + parseInt(size),

This comment was marked as spam.

@toots
Copy link
Author

toots commented Jun 28, 2018

Ok, all review remarks should have been fixed now. Thanks for looking at it!

@toots
Copy link
Author

toots commented Sep 6, 2018

Ok, sorry it took me so long to fix those last remarks. Should be all good now!

@ghost ghost assigned stephenplusplus Sep 12, 2018
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 12, 2018
@stephenplusplus
Copy link
Contributor

⚠️ Update!

I added a commit to do a few things:

  • Add system tests to verify the new stuff works against the real API
  • Add Compute#getInstanceGroupManagers() (and the stream counterpart) for listing global instance group manager
  • Export InstanceGroup from the Compute class
  • Add InstanceGroupManager#setInstanceTemplate
  • Add and require VMs argument to InstanceGroupManager#removeVMs

⌚️ Status!

I'm stuck a bit, as other tasks are pushing their way in front of this one. We still need:

  • Unit tests for the new methods I added:
    • Compute#getInstanceGroupManagers()
    • Compute#getInstanceGroupManagersStream()
    • InstanceGroupManager#setInstanceTemplate()
  • System tests for:
    • InstanceTemplate functionality (creating, listing, listing as stream)
    • InstanceGroupManager#recreateVMs()
    • InstanceGroupManager#removeVMs()
    • InstanceGroupManager#setInstanceTemplate()

I hope to get back to this soon, but if you want to play around and take on any of these, feel free!

Thanks again for your help and patience

@toots
Copy link
Author

toots commented Sep 28, 2018

Hi folks,

I just merged the master branch and adapted to the updated syntax as much as I could. It looks like coverage tests aren't passing anymore.

I'd like to say that this process has been a tad bit frustrating. My original PR had, I believe, a lot of merit on its own to begin with.

While I appreciate the reviews and being guided through the various layers of code quality tools here, I am not part of the dev team or working for this project, just a user who wishes to contribute back.

The more this PR drags, the more difficult it will be to keep it up-to date. Updating the syntax without merging it was, in a way, pretty inconsiderate if you think about it.

I'd love to see this PR merged but, as it stands, I don't think that I am willing to contribute to it past this point.

It would be great to see this binding cover some much needed part of the upstream API, however.

Cheers,
Romain

@stephenplusplus
Copy link
Contributor

Hey Romain, I'm frustrated for you as well. Thanks again for all the help you've provided. It's mostly a matter of attention being spread across all of our projects, and I'm sorry I couldn't spend more on this. When I was able to, seeing the small details that you nailed (docs links, types, test grouping) was very appreciated.

For now, this will probably have to sit for a bit longer, due to that same attention issue :( I hope I can come back soon, but for now, my list of "To Dos" above have to be conquered before it's shippable.

As always, thank you very much for your help, and I hope this won't deter you from contributing again if you see a mistake or just have an idea.

@sduskis
Copy link

sduskis commented Dec 17, 2018

@toots and @stephenplusplus, this PR is really out of date. Is this PR salvageable?

@toots
Copy link
Author

toots commented Dec 17, 2018

Well, in a more general context, I believe that it'd be nice if the library could cover all of the API functionalities. We use these calls on one of our work project and the fact that they aren't yet part of the released/official code has forced us to work out of a patched version and prevented a full open source release of it.

I'd be willing to work on salvaging this one PR but only if there's a clear path for a merge.

@JustinBeckwith
Copy link
Contributor

@toots I really apologize for this one - totally my fault. We do try to be a lot more attentive to PRs, but this one is honestly just bad luck. I believe this is the only repository we have that isn't green right now, and it's been broken on master for a number of months. I'm spending some time over the next few weeks trying to get us green, and get us back into a state where the library is shippable. Once we're in that state - I would be happy to re-engage, and see if we can get this landed. Until then - I want to be respectful of your time.

If you're blocked - another option here is the apiary library:
https://github.com/googleapis/google-api-nodejs-client

The apiary library is autogenerated, so the API coverage is going to be 100%. It's going to be far less polished and easy to use, but it will be complete.

Apologies again, and thanks for sticking with us here :)

@toots
Copy link
Author

toots commented Dec 17, 2018

Sounds good thanks for getting back to me. I'll wait and look at the apiary library meanwhile.

@JustinBeckwith
Copy link
Contributor

Ok! So we're in a better place now :)

@JustinBeckwith JustinBeckwith changed the title Add binding for instance group manager. feat: add binding for instance group manager Dec 21, 2018
@sduskis
Copy link

sduskis commented Jan 22, 2019

@toots, this PR has gone stale. Is it worth reviving it?

@toots
Copy link
Author

toots commented Jan 22, 2019

I would love to finish it but I'm swamped at the moment. Do you guys need it finished by a certain deadline?

@JustinBeckwith
Copy link
Contributor

Not at all :) Any help you can offer is awesome, whenever you have time (or its cool even if you don't). We really appreciate the help!

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Feb 7, 2019
@modeswitch
Copy link
Contributor

I'm willing to take this over so the maintainer can land it. Any objections?

@modeswitch
Copy link
Contributor

Rather than do extensive surgery here, I created #263. It only adds basic support, but I think it will be easier to add features once the basic plumbing is landed.

@JustinBeckwith JustinBeckwith added the needs work This is a pull request that needs a little love. label Feb 10, 2019
@JustinBeckwith
Copy link
Contributor

This was covered in #263 🥂

@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: no This human has *not* signed the Contributor License Agreement. needs work This is a pull request that needs a little love.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bindings for Instance Group Managers?
8 participants