libcloud.container.drivers.gke module

class libcloud.container.drivers.gke.GKEConnection(user_id, key, secure, auth_type=None, credential_file=None, project=None, **kwargs)[source]

Bases: GoogleBaseConnection

Connection class for the GKE driver.

GKEConnection extends google.GoogleBaseConnection for 3 reasons:
  1. modify request_path for GKE URI.

  2. Implement gce_params functionality described below.

  3. Add request_aggregated_items method for making aggregated API calls.

Determine authentication type, set up appropriate authentication connection and get initial authentication information.

Parameters:
  • user_id (str) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication.

  • key (str) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication.

  • auth_type (str) – See GoogleAuthType class for list and description of accepted values. If not supplied, auth_type will be guessed based on value of user_id or if the code is running on a GCE instance.

  • credential_file (str) – Path to file for caching authentication information.

  • scopes (list) – List of OAuth2 scope URLs. The empty default sets read/write access to Compute, Storage, and DNS.

host: str = 'container.googleapis.com'
pre_connect_hook(params, headers)[source]

Update URL parameters with values from self.gke_params.

@inherits: GoogleBaseConnection.pre_connect_hook

request(*args, **kwargs)[source]

Perform request then do GKE-specific processing of URL params.

@inherits: GoogleBaseConnection.request

responseCls

alias of GKEResponse

class libcloud.container.drivers.gke.GKEContainerDriver(user_id, key=None, datacenter=None, project=None, auth_type=None, scopes=None, credential_file=None, host=None, port=443, **kwargs)[source]

Bases: KubernetesContainerDriver

GKE Container Driver class.

This is the primary driver for interacting with Google Container Engine. It contains all of the standard libcloud methods, plus additional ex_* methods for more features.

Note that many methods allow either objects or strings (or lists of objects/strings). In most cases, passing strings instead of objects will result in additional GKE API calls.

Parameters:
  • user_id (str) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication.

  • key (str) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication.

  • datacenter (str) – The name of the datacenter (zone) used for operations.

  • project (str) – Your GKE project name. (required)

  • auth_type (str) – Accepted values are “SA” or “IA” or “GKE” (“Service Account” or “Installed Application” or “GKE” if libcloud is being used on a GKE instance with service account enabled). If not supplied, auth_type will be guessed based on value of user_id or if the code is being executed in a GKE instance.

  • scopes (list) – List of authorization URLs. Default is empty and grants read/write to Compute, Storage, DNS.

  • credential_file (str) – Path to file for caching authentication information used by GKEConnection.

AUTH_URL = 'https://container.googleapis.com/auth/'
api_name = 'google'
connectionCls

alias of GKEConnection

get_server_config(ex_zone=None)[source]

Return configuration info about the Container Engine service.

Parameters:

ex_zone (str or GCEZone or NodeLocation or None) – Optional zone name or None

list_clusters(ex_zone=None)[source]

Return a list of cluster information in the current zone or all zones.

Parameters:

ex_zone (str or GCEZone or NodeLocation or None) – Optional zone name or None

name = 'Google Container Engine'
supports_clusters = True

Whether the driver supports containers being deployed into clusters

type = 'GKE'
website = 'https://container.googleapis.com'
class libcloud.container.drivers.gke.GKEResponse(response, connection)[source]

Bases: GoogleResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)

  • connection (Connection) – Parent connection object.