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

Conversation

@Shabirmean
Copy link
Contributor

@Shabirmean Shabirmean commented Feb 9, 2022

Fixes #3

Description

  • For a detailed description read internal ref b/189985582
  • The Kubernetes engine API protos were written before the API Improvement Proposal (AIP-151)
  • AIP-151 suggests to annotate API calls that takes a long time to complete with a certain annotation. This will enable the auto-generator (that generates our client libraries) to wrap the response an object of type google.longrunning.Operation in a language native (Python Future or Nodejs Promise) async construct.
  • However, since AIP-151 came long after the container.v1 API protos were written, the container API protos don't have the necessary annotation as guided in AIP-151
  • As a result the auto generated container client libraries do not return the very useful google.longrunning.Operation object, instead they return google.container.v1.Operation
  • This object does not have the necessary built-ins to easily verify if the operation has completed.
  • Thus this PR adds a few samples to show to customers how they can use this Operation object to validate if their operation has successfully completed using polling with backoff on the getOperation() API

Changes

  • Added 3 samples to showcase usage of the library and to show how to handle responses of type google.container.v1.Operation
    • A quickstart sample which simply lists the clusters
    • A create cluster and delete cluster example that returns an Operation object since they are long running operations
  • Updated the READMEs explain the samples
  • I have also added test cases for the added samples

Testing

  • Create a project
  • Enable the container (GKE) API
  • Create a service account with permissions to create/delete clusters (can use Owner)
  • Download a key for the created service account
export GOOGLE_APPLICATION_CREDENTIALS="<PATH_TO_KEY>"
gcloud config set project <GCP_PROJECT>

cd <repo_path>
git checkout lro-fix
cd samples/snippets

python quickstart.js <GCP_PROJECT> us-central1-b
python create_cluster.js <GCP_PROJECT> us-central1-b gke10
python delete_cluster.js <GCP_PROJECT> us-central1-b gke10

nox -s py-3.6

@Shabirmean Shabirmean requested review from a team as code owners February 9, 2022 02:58
@product-auto-label product-auto-label bot added api: container Issues related to the googleapis/python-container API. samples Issues that are directly related to samples. labels Feb 9, 2022
@Shabirmean Shabirmean added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 9, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 9, 2022
@Shabirmean Shabirmean requested a review from busunkim96 February 9, 2022 15:02
@Shabirmean
Copy link
Contributor Author

@busunkim96 - adding you in here since you had been part of the discussion in #3 and also b/189985582. Can you TAL and see if it sufficiently addresses the requirements?

@parthea parthea changed the title improvement: add usage samples to show handling of LRO response Operation docs(samples): add usage samples to show handling of LRO response Operation Feb 9, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 10, 2022
@Shabirmean
Copy link
Contributor Author

@parthea - I've addressed the comments we discussed offline:

  • Remove inline code for the landing page README
  • Add region tags
  • Add tests

Please TAL look when you have some time! Thank you 🙌🏼

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 11, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 11, 2022
@Shabirmean Shabirmean added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 14, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 14, 2022
@Shabirmean Shabirmean merged commit 309ad62 into main Feb 16, 2022
@Shabirmean Shabirmean deleted the lro-fix branch February 16, 2022 01:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: container Issues related to the googleapis/python-container API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Container: example(s) for long-running operations

3 participants