GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-docs-samples/container/snippets at main · DataSolveProblems/python-docs-samples

Expand file tree

/

snippets

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

snippets

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
create_cluster.py
create_cluster.py
 
 
create_cluster_test.py
create_cluster_test.py
 
 
delete_cluster.py
delete_cluster.py
 
 
delete_cluster_test.py
delete_cluster_test.py
 
 
noxfile_config.py
noxfile_config.py
 
 
quickstart.py
quickstart.py
 
 
quickstart_test.py
quickstart_test.py
 
 
requirement-test.txt
requirement-test.txt
 
 
requirements.txt
requirements.txt
 
 

README.md

Outline

Samples

All the samples are self contained unless they are placed inside their own folders. The samples use Application Default Credentials (ADC) to authenticate with GCP. So make sure ADC is setup correctly (i.e. GOOGLE_APPLICATION_CREDENTIALS environment variable is set) before running the samples. Some sample might require additional python modules to be installed.

You can run samples as follows:

python <sample_name.py> <arg1> <arg2> ...

You can run the following command to find the usage and arguments for the samples:

python <sample_name.py> -h
# example
python quickstart.py -h

usage: quickstart.py [-h] project_id zone

positional arguments:
  project_id  Google Cloud project ID
  zone        GKE Cluster zone

optional arguments:
  -h, --help  show this help message and exit

Quickstart sample

  • quickstart.py: A simple example to list the GKE clusters in a given GCP project and zone. The sample uses the list_clusters() API to fetch the list of cluster.

Long running operation sample

The following samples are examples of operations that take a while to complete. For example creating a cluster in GKE can take a while to set up the cluster nodes, networking and configuring Kubernetes. Thus, calls to such long running APIs return an object of type Operation. We can then use the id of the returned operation to poll the get_operation() API to check for it's status. You can see the different statuses it can be in, in this proto definition.

  • create_cluster.py: An example of creating a GKE cluster (with mostly the defaults). This example shows how to handle responses of type Operation that represents a long running operation. The example uses the python module backoff to handle a graceful exponential backoff retry mechanism to check if the Operation has completed.

  • delete_cluster.py: An example of deleting a GKE cluster. This example shows how to handle responses of type Operation that represents a long running operation.

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.