You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/06/22 03:11:05 UTC

[01/34] libcloud git commit: update

Repository: libcloud
Updated Branches:
  refs/heads/trunk 98c4fe0a0 -> 42839c65e


update


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7949ca3a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7949ca3a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7949ca3a

Branch: refs/heads/trunk
Commit: 7949ca3ac7ca70277157e15424e8aa1a11d953c6
Parents: f3c7474
Author: andy <an...@gmail.com>
Authored: Sun May 21 10:36:39 2017 -0700
Committer: andy <an...@gmail.com>
Committed: Sun May 21 10:36:39 2017 -0700

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 153 +++++++++++++++++++++++++++++++++
 1 file changed, 153 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7949ca3a/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
new file mode 100644
index 0000000..3faf009
--- /dev/null
+++ b/libcloud/container/drivers/gke.py
@@ -0,0 +1,153 @@
+from libcloud.common.google import GoogleOAuth2Credential
+
+
+class GKENodeDriver(NodeDriver):
+    """
+    GCE Node 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.
+    """
+    connectionCls = GKEConnection
+    api_name = 'google'
+    name = "Google Container Engine"
+    type = Provider.GKE
+    website = 'https://container.googleapis.com'
+
+    # Google Compute Engine node states are mapped to Libcloud node states
+    # per the following dict. GCE does not have an actual 'stopped' state
+    # but instead uses a 'terminated' state to indicate the node exists
+    # but is not running. In order to better match libcloud, GCE maps this
+    # 'terminated' state to 'STOPPED'.
+    # Also, when a node is deleted from GCE, it no longer exists and instead
+    # will result in a ResourceNotFound error versus returning a placeholder
+    # node in a 'terminated' state.
+    # For more details, please see GCE's docs,
+    # https://cloud.google.com/compute/docs/instances#checkmachinestatus
+    NODE_STATE_MAP = {
+        "PROVISIONING": NodeState.PENDING,
+        "STAGING": NodeState.PENDING,
+        "RUNNING": NodeState.RUNNING,
+        "STOPPING": NodeState.PENDING,
+        "TERMINATED": NodeState.STOPPED,
+        "UNKNOWN": NodeState.UNKNOWN
+    }
+
+    AUTH_URL = "https://www.googleapis.com/auth/"
+    SA_SCOPES_MAP = {
+        # list derived from 'gcloud compute instances create --help'
+        "bigquery": "bigquery",
+        "cloud-platform": "cloud-platform",
+        "compute-ro": "compute.readonly",
+        "compute-rw": "compute",
+        "datastore": "datastore",
+        "logging-write": "logging.write",
+        "monitoring": "monitoring",
+        "monitoring-write": "monitoring.write",
+        "service-control": "servicecontrol",
+        "service-management": "service.management",
+        "sql": "sqlservice",
+        "sql-admin": "sqlservice.admin",
+        "storage-full": "devstorage.full_control",
+        "storage-ro": "devstorage.read_only",
+        "storage-rw": "devstorage.read_write",
+        "taskqueue": "taskqueue",
+        "useraccounts-ro": "cloud.useraccounts.readonly",
+        "useraccounts-rw": "cloud.useraccounts",
+        "userinfo-email": "userinfo.email"
+    }
+
+    IMAGE_PROJECTS = {
+        "centos-cloud": ["centos"],
+        "coreos-cloud": ["coreos"],
+        "debian-cloud": ["debian", "backports"],
+        "gce-nvme": ["nvme-backports"],
+        "google-containers": ["container-vm"],
+        "opensuse-cloud": ["opensuse"],
+        "rhel-cloud": ["rhel"],
+        "suse-cloud": ["sles", "suse"],
+        "ubuntu-os-cloud": ["ubuntu"],
+        "windows-cloud": ["windows"],
+    }
+
+    BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
+
+    def __init__(self, user_id, key=None, datacenter=None, project=None,
+                 auth_type=None, scopes=None, credential_file=None, **kwargs):
+        """
+        :param  user_id: The email address (for service accounts) or Client ID
+                         (for installed apps) to be used for authentication.
+        :type   user_id: ``str``
+
+        :param  key: The RSA Key (for service accounts) or file path containing
+                     key or Client Secret (for installed apps) to be used for
+                     authentication.
+        :type   key: ``str``
+
+        :keyword  datacenter: The name of the datacenter (zone) used for
+                              operations.
+        :type     datacenter: ``str``
+
+        :keyword  project: Your GCE project name. (required)
+        :type     project: ``str``
+
+        :keyword  auth_type: Accepted values are "SA" or "IA" or "GCE"
+                             ("Service Account" or "Installed Application" or
+                             "GCE" if libcloud is being used on a GCE 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 GCE instance.
+        :type     auth_type: ``str``
+
+        :keyword  scopes: List of authorization URLs. Default is empty and
+                          grants read/write to Compute, Storage, DNS.
+        :type     scopes: ``list``
+
+        :keyword  credential_file: Path to file for caching authentication
+                                   information used by GCEConnection.
+        :type     credential_file: ``str``
+        """
+        if not project:
+            raise ValueError('Project name must be specified using '
+                             '"project" keyword.')
+
+        self.auth_type = auth_type
+        self.project = project
+        self.scopes = scopes
+        self.credential_file = credential_file or \
+            GoogleOAuth2Credential.default_credential_file + '.' + self.project
+
+        super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
+
+        # Cache Zone and Region information to reduce API calls and
+        # increase speed
+        self.base_path = '/%s/projects/%s' % (API_VERSION,
+                                                      self.project)
+        self.zone_list = self.ex_list_zones()
+        self.zone_dict = {}
+        for zone in self.zone_list:
+            self.zone_dict[zone.name] = zone
+        if datacenter:
+            self.zone = self.ex_get_zone(datacenter)
+        else:
+            self.zone = None
+
+        self.region_list = self.ex_list_regions()
+        self.region_dict = {}
+        for region in self.region_list:
+            self.region_dict[region.name] = region
+
+        if self.zone:
+            self.region = self._get_region_from_zone(self.zone)
+        else:
+            self.region = None
+
+        # Volume details are looked up in this name-zone dict.
+        # It is populated if the volume name is not found or the dict is empty.
+        self._ex_volume_dict = {}


[20/34] libcloud git commit: removing spaces

Posted by an...@apache.org.
removing spaces


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/972ba8c6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/972ba8c6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/972ba8c6

Branch: refs/heads/trunk
Commit: 972ba8c645ed25094d2014829f79b898a63927e5
Parents: 6a4579d
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 19:19:43 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 19:19:43 2017 -0400

----------------------------------------------------------------------
 .../fixtures/gke/zones_us-central1-a_instance_serverconfig.json    | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/972ba8c6/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json b/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
index dd669e2..2b9685c 100644
--- a/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
+++ b/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
@@ -1,3 +1 @@
-
-
 {"validImageTypes": ["CONTAINER_VM", "COS"], "validNodeVersions": ["1.6.4", "1.6.2", "1.5.7", "1.5.6", "1.4.9"], "defaultClusterVersion": "1.6.4", "validMasterVersions": ["1.6.4", "1.5.7"], "defaultImageType": "COS"}


[29/34] libcloud git commit: missing json

Posted by an...@apache.org.
missing json


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4d17e75e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4d17e75e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4d17e75e

Branch: refs/heads/trunk
Commit: 4d17e75e811b11782db49859dfad49c7092b6541
Parents: 8968313
Author: andy <an...@gmail.com>
Authored: Tue Jun 20 08:50:03 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 20 08:50:03 2017 -0400

----------------------------------------------------------------------
 .../fixtures/gke/zones_us-central1-a_list.json  | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4d17e75e/libcloud/test/container/fixtures/gke/zones_us-central1-a_list.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/gke/zones_us-central1-a_list.json b/libcloud/test/container/fixtures/gke/zones_us-central1-a_list.json
new file mode 100644
index 0000000..5c6770b
--- /dev/null
+++ b/libcloud/test/container/fixtures/gke/zones_us-central1-a_list.json
@@ -0,0 +1,29 @@
+{"clusters": [{
+   "currentMasterVersion": "1.6.4",
+   "currentNodeCount": 3,
+   "currentNodeVersion": "1.6.4",
+   "initialClusterVersion": "1.6.4",
+   "locations": ["us-central1-a"],
+   "loggingService": "logging.googleapis.com",
+   "name": "cluster-1",
+   "network": "default",
+   "nodeConfig": {"diskSizeGb": 100,
+    "imageType": "COS",
+    "machineType": "n1-standard-1",
+    "oauthScopes": ["https://www.googleapis.com/auth/compute"],
+    "serviceAccount": "default"},
+   "nodeIpv4CidrSize": 24,
+   "nodePools": [{"autoscaling": {},
+     "config": {"diskSizeGb": 100,
+      "serviceAccount": "default"},
+     "initialNodeCount": 3,
+     "instanceGroupUrls": ["https://www.googleapis.com/compute/v1/projects/project_name"],
+     "management": {},
+     "name": "default-pool",
+     "status": "RUNNING",
+     "version": "1.6.4"}],
+   "selfLink": "https://container.googleapis.com/v1/projects/",
+   "servicesIpv4Cidr": "XX.XX.XXX.X/20",
+   "status": "RUNNING",
+   "subnetwork": "default",
+   "zone": "us-central1-a"}]}


[27/34] libcloud git commit: typo

Posted by an...@apache.org.
typo


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1ed137bc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1ed137bc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1ed137bc

Branch: refs/heads/trunk
Commit: 1ed137bcc1e5d9d2a05c95f76e282f68888e612e
Parents: 78aed02
Author: andy <an...@gmail.com>
Authored: Tue Jun 20 08:39:33 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 20 08:39:33 2017 -0400

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1ed137bc/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index d5e837b..07032d6 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -2750,7 +2750,6 @@ class GCENodeDriver(NodeDriver):
         :return: A list of zone objects.
         :rtype: ``list`` of :class:`GCEZone`
         """
-        print("WHEN DO WE DO THIS")
         list_zones = []
         request = '/zones'
         response = self.connection.request(request, method='GET').object


[19/34] libcloud git commit: adding the server json

Posted by an...@apache.org.
adding the server json


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6a4579d6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6a4579d6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6a4579d6

Branch: refs/heads/trunk
Commit: 6a4579d672c32dd5f35717d4e869cffa91b1944e
Parents: 3262d35
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 19:17:45 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 19:17:45 2017 -0400

----------------------------------------------------------------------
 .../fixtures/gke/zones_us-central1-a_instance_serverconfig.json   | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6a4579d6/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json b/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
new file mode 100644
index 0000000..dd669e2
--- /dev/null
+++ b/libcloud/test/container/fixtures/gke/zones_us-central1-a_instance_serverconfig.json
@@ -0,0 +1,3 @@
+
+
+{"validImageTypes": ["CONTAINER_VM", "COS"], "validNodeVersions": ["1.6.4", "1.6.2", "1.5.7", "1.5.6", "1.4.9"], "defaultClusterVersion": "1.6.4", "validMasterVersions": ["1.6.4", "1.5.7"], "defaultImageType": "COS"}


[33/34] libcloud git commit: Merge branch 'github-1059' into trunk

Posted by an...@apache.org.
Merge branch 'github-1059' into trunk


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/20bd5163
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/20bd5163
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/20bd5163

Branch: refs/heads/trunk
Commit: 20bd51634252a1a581ff5d307c5c45a26a6831f1
Parents: 98c4fe0 35bdf4e
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Jun 22 13:09:04 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Jun 22 13:09:04 2017 +1000

----------------------------------------------------------------------
 docs/container/drivers/gke.rst                  |  27 +++
 .../container/gke/instantiate_driver.py         |   9 +
 libcloud/compute/drivers/gce.py                 |   2 +-
 libcloud/container/drivers/gke.py               | 179 +++++++++++++++++++
 libcloud/container/drivers/kubernetes.py        |  22 +--
 libcloud/container/providers.py                 |   2 +
 libcloud/container/types.py                     |   1 +
 ...nes_us-central1-a_instance_serverconfig.json |   1 +
 .../fixtures/gke/zones_us-central1-a_list.json  |  29 +++
 libcloud/test/container/test_gke.py             |  93 ++++++++++
 libcloud/test/secrets.py-dist                   |   5 +
 11 files changed, 359 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/20bd5163/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------


[18/34] libcloud git commit: updates

Posted by an...@apache.org.
updates


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3262d355
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3262d355
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3262d355

Branch: refs/heads/trunk
Commit: 3262d35516f65b3017ceb4b1e5304b5009f17f56
Parents: 4cefbba
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 19:15:07 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 19:15:07 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py   | 22 +++++++++++-----------
 libcloud/test/container/test_gke.py |  4 ++--
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3262d355/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index acac294..519c893 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -42,24 +42,24 @@ class GKEConnection(GoogleBaseConnection):
         super(GKEConnection, self).__init__(
             user_id, key, secure=secure, auth_type=auth_type,
             credential_file=credential_file, **kwargs)
-        self.request_path = '%s/projects/%s' % (API_VERSION, project)
-        self.gce_params = None
+        self.request_path = '/%s/projects/%s' % (API_VERSION, project)
+        self.gke_params = None
 
     def pre_connect_hook(self, params, headers):
         """
-        Update URL parameters with values from self.gce_params.
+        Update URL parameters with values from self.gke_params.
 
         @inherits: :class:`GoogleBaseConnection.pre_connect_hook`
         """
         params, headers = super(GKEConnection, self).pre_connect_hook(params,
                                                                       headers)
-        if self.gce_params:
+        if self.gke_params:
             params.update(self.gce_params)
         return params, headers
 
     def request(self, *args, **kwargs):
         """
-        Perform request then do GCE-specific processing of URL params.
+        Perform request then do GKE-specific processing of URL params.
 
         @inherits: :class:`GoogleBaseConnection.request`
         """
@@ -67,12 +67,12 @@ class GKEConnection(GoogleBaseConnection):
 
         # If gce_params has been set, then update the pageToken with the
         # nextPageToken so it can be used in the next request.
-        if self.gce_params:
+        if self.gke_params:
             if 'nextPageToken' in response.object:
-                self.gce_params['pageToken'] = response.object['nextPageToken']
-            elif 'pageToken' in self.gce_params:
-                del self.gce_params['pageToken']
-            self.gce_params = None
+                self.gke_params['pageToken'] = response.object['nextPageToken']
+            elif 'pageToken' in self.gke_params:
+                del self.gke_params['pageToken']
+            self.gke_params = None
 
         return response
 
@@ -179,7 +179,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
         """
         if zone is None:
             zone = self.zone
-        request = "/zones/%s/serverconfig" % (self.zone)
+        request = "/zones/%s/serverconfig" % (zone)
 
         response = self.connection.request(request, method='GET').object
         return response

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3262d355/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 0129f9c..5d0f41e 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -19,7 +19,7 @@ Tests for Google Container Engine Driver
 import sys
 import unittest
 
-# from libcloud.utils.py3 import httplib
+from libcloud.utils.py3 import httplib
 from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION
 from libcloud.common.google import (GoogleBaseAuthConnection)
 from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase
@@ -62,7 +62,7 @@ class GKEMockHttp(MockHttp):
     json_hdr = {'content-type': 'application/json; charset=UTF-8'}
 
     def _get_method_name(self, type, use_param, qs, path):
-        api_path = '%s' % API_VERSION
+        api_path = '/%s' % API_VERSION
         project_path = '/projects/%s' % GKE_KEYWORD_PARAMS['project']
         path = path.replace(api_path, '')
         # This replace is separate, since there is a call with a different


[07/34] libcloud git commit: it runs

Posted by an...@apache.org.
it runs


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/78c72b15
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/78c72b15
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/78c72b15

Branch: refs/heads/trunk
Commit: 78c72b15787279125110026a0c42bb1dbdf65239
Parents: b970421
Author: andy <an...@gmail.com>
Authored: Fri Jun 9 23:17:09 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Fri Jun 9 23:17:09 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/78c72b15/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 02bb33f..6900952 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -46,6 +46,18 @@ class GKEConnection(GoogleBaseConnection):
         self.request_path = '%s/projects/%s' % (API_VERSION, project)
         self.gce_params = None
 
+    def pre_connect_hook(self, params, headers):
+        """
+        Update URL parameters with values from self.gce_params.
+
+        @inherits: :class:`GoogleBaseConnection.pre_connect_hook`
+        """
+        params, headers = super(GKEConnection, self).pre_connect_hook(params,
+                                                                      headers)
+        if self.gce_params:
+            params.update(self.gce_params)
+        return params, headers
+
     def request(self, *args, **kwargs):
         """
         Perform request then do GCE-specific processing of URL params.
@@ -85,7 +97,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
     website = 'https://container.googleapis.com'
     supports_clusters = True
 
-    AUTH_URL = "https://www.googleapis.com/auth/cloudplatform"
+    AUTH_URL = "https://container.googleapis.com/auth/"
 
     BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
 
@@ -159,3 +171,12 @@ class GKEContainerDriver(KubernetesContainerDriver):
         print(self.website+self.base_path)
         response = self.connection.request(request, method='GET').object
         print(response)
+
+    def get_server_config(self, zone=None):
+        """
+        """
+        request = "/zones/%s/serverconfig" % (zone)
+        # https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters
+        print(self.website+self.base_path)
+        response = self.connection.request(request, method='GET').object
+        print(response)


[23/34] libcloud git commit: removing issues with joyent

Posted by an...@apache.org.
removing issues with joyent


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f049cce1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f049cce1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f049cce1

Branch: refs/heads/trunk
Commit: f049cce1eabce72ab81d8675038d11f5f4f46733
Parents: 60d6462
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 20:02:15 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 20:02:15 2017 -0400

----------------------------------------------------------------------
 docs/container/drivers/joyent.rst | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f049cce1/docs/container/drivers/joyent.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/joyent.rst b/docs/container/drivers/joyent.rst
index 8dcaacf..a8b29d3 100644
--- a/docs/container/drivers/joyent.rst
+++ b/docs/container/drivers/joyent.rst
@@ -17,7 +17,7 @@ Instantiating the driver
 Download the script::
 
     curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh
-
+    
 Now execute the script, substituting the correct values::
 
     bash sdc-docker-setup.sh <CLOUDAPI_URL> <ACCOUNT_USERNAME> ~/.ssh/<PRIVATE_KEY_FILE>
@@ -28,31 +28,31 @@ This should output something similar to the following::
         CloudAPI:        https://us-east-1.api.joyent.com
         Account:         jill
         Key:             /Users/localuser/.ssh/sdc-docker.id_rsa
-
+    
     If you have a pass phrase on your key, the openssl command will
     prompt you for your pass phrase now and again later.
-
+    
     Verifying CloudAPI access.
     CloudAPI access verified.
-
+    
     Generating client certificate from SSH private key.
     writing RSA key
     Wrote certificate files to /Users/localuser/.sdc/docker/jill
-
+    
     Get Docker host endpoint from cloudapi.
     Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
-
+    
     * * *
     Success. Set your environment as follows:
-
+    
         export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
         export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
         export DOCKER_CLIENT_TIMEOUT=300
         export DOCKER_TLS_VERIFY=1
-
+        
 .. literalinclude:: /examples/container/joyent/instantiate_driver.py
    :language: python
-
+   
 API Docs
 --------
 


[25/34] libcloud git commit: typos

Posted by an...@apache.org.
typos


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7311833f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7311833f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7311833f

Branch: refs/heads/trunk
Commit: 7311833f903a15c4c2651f736ec8c218dede8202
Parents: 6f3e4c6
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 20:40:27 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 20:40:27 2017 -0400

----------------------------------------------------------------------
 docs/examples/container/gke/instantiate_driver.py | 2 +-
 libcloud/test/container/test_gke.py               | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7311833f/docs/examples/container/gke/instantiate_driver.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/gke/instantiate_driver.py b/docs/examples/container/gke/instantiate_driver.py
index c23060a..8beb9b9 100644
--- a/docs/examples/container/gke/instantiate_driver.py
+++ b/docs/examples/container/gke/instantiate_driver.py
@@ -6,4 +6,4 @@ cls = get_driver(Provider.GKE)
 conn = cls('testaccount-XXX@testproject.iam.gserviceaccount.com',
            'libcloud.json', project='testproject')
 
-conn.list_images()
+conn.list_clusters()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7311833f/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 909747b..91f0a16 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -72,7 +72,6 @@ class GKEMockHttp(MockHttp):
         path = path.replace(project_path, '')
         # The path to get project information is the base path, so use a fake
         # '/project' path instead
-        print("path", path)
         if not path:
             path = '/project'
         method_name = super(GKEMockHttp, self)._get_method_name(


[34/34] libcloud git commit: changes for #1059

Posted by an...@apache.org.
changes for #1059


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/42839c65
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/42839c65
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/42839c65

Branch: refs/heads/trunk
Commit: 42839c65ea90c7526af159adb3dfab0970b3601f
Parents: 20bd516
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Jun 22 13:10:51 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Jun 22 13:10:51 2017 +1000

----------------------------------------------------------------------
 CHANGES.rst | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/42839c65/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index ee3c1dc..da18a55 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -57,6 +57,10 @@ Compute
 Container
 ~~~~~~~~~
 
+- New driver for Google Container Engine
+  [GITHUB-1059]
+  (Andy Maheshwari)
+
 - [KUBERNETES] Fix get_container method responding with None
   [GITHUB-1054]
   (Anthony Shaw)


[30/34] libcloud git commit: typo

Posted by an...@apache.org.
typo


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f3d8b060
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f3d8b060
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f3d8b060

Branch: refs/heads/trunk
Commit: f3d8b0606f11c3af02fad81cc8b918f8d94917e2
Parents: 4d17e75
Author: andy <an...@gmail.com>
Authored: Tue Jun 20 09:03:42 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 20 09:03:42 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f3d8b060/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index e909e83..0e6e7a6 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -18,7 +18,7 @@ Tests for Google Container Engine Driver
 
 import sys
 import unittest
-
+import json
 from libcloud.utils.py3 import httplib
 from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION
 from libcloud.common.google import (GoogleBaseAuthConnection)
@@ -51,8 +51,8 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
 
     def test_list_images_response(self):
         config = self.driver.list_clusters(ex_zone="us-central1-a")
-        assert "zone" in config
-        assert config.zone == "us-central1-a"
+        assert "clusters" in config
+        assert config["clusters"][0]["zone"] == "us-central1-a"
 
     def test_server_config(self):
         config = self.driver.get_server_config()


[26/34] libcloud git commit: typo

Posted by an...@apache.org.
typo


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/78aed02f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/78aed02f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/78aed02f

Branch: refs/heads/trunk
Commit: 78aed02fc1a239f8188136cd19247566e09d1276
Parents: 7311833
Author: andy <an...@gmail.com>
Authored: Mon Jun 19 07:47:06 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Mon Jun 19 07:47:06 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/78aed02f/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 91f0a16..e909e83 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -52,7 +52,7 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
     def test_list_images_response(self):
         config = self.driver.list_clusters(ex_zone="us-central1-a")
         assert "zone" in config
-        assert config.zone = "us-central1-a"
+        assert config.zone == "us-central1-a"
 
     def test_server_config(self):
         config = self.driver.get_server_config()


[24/34] libcloud git commit: fixing typos

Posted by an...@apache.org.
fixing typos


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6f3e4c6d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6f3e4c6d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6f3e4c6d

Branch: refs/heads/trunk
Commit: 6f3e4c6d622ea0622f3ba0676e704337d00c456e
Parents: f049cce
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 20:39:30 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 20:39:30 2017 -0400

----------------------------------------------------------------------
 docs/container/drivers/gke.rst           |  2 +-
 libcloud/compute/drivers/gce.py          |  3 ++-
 libcloud/container/drivers/gke.py        | 18 +++++++++++++-----
 libcloud/container/drivers/kubernetes.py |  1 -
 libcloud/test/container/test_gke.py      | 14 +++++++++++---
 5 files changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/docs/container/drivers/gke.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/gke.rst b/docs/container/drivers/gke.rst
index 930c8c6..3edc473 100644
--- a/docs/container/drivers/gke.rst
+++ b/docs/container/drivers/gke.rst
@@ -21,7 +21,7 @@ https://github.com/apache/libcloud/blob/trunk/demos/gce_demo.py
 API Docs
 --------
 
-.. autoclass:: libcloud.container.drivers.joyent.GKEContainerDriver
+.. autoclass:: libcloud.container.drivers.gke.GKEContainerDriver
     :members:
     :inherited-members:
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 41eef06..d5e837b 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -69,7 +69,7 @@ class GCEConnection(GoogleBaseConnection):
     """
     Connection class for the GCE driver.
 
-    GCEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons:
+    GCEConnection extends :class:`google.GoogleBaseConnection` for 3 reasons:
       1. modify request_path for GCE URI.
       2. Implement gce_params functionality described below.
       3. Add request_aggregated_items method for making aggregated API calls.
@@ -2750,6 +2750,7 @@ class GCENodeDriver(NodeDriver):
         :return: A list of zone objects.
         :rtype: ``list`` of :class:`GCEZone`
         """
+        print("WHEN DO WE DO THIS")
         list_zones = []
         request = '/zones'
         response = self.connection.request(request, method='GET').object

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 646838f..f95ddf7 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -14,7 +14,7 @@ class GKEConnection(GoogleBaseConnection):
     """
     Connection class for the GKE driver.
 
-    GKEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons:
+    GKEConnection extends :class:`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.
@@ -84,8 +84,6 @@ class GKEContainerDriver(KubernetesContainerDriver):
 
     AUTH_URL = "https://container.googleapis.com/auth/"
 
-    BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
-
     def __init__(self, user_id, key=None, datacenter=None, project=None,
                  auth_type=None, scopes=None, credential_file=None,
                  host=None, port=443, **kwargs):
@@ -150,8 +148,13 @@ class GKEContainerDriver(KubernetesContainerDriver):
                 'scopes': self.scopes,
                 'credential_file': self.credential_file}
 
-    def list_images(self, zone=None):
+    def list_clusters(self, ex_zone=None):
         """
+        Return a list of cluster information in the current zone or all zones.
+
+        :keyword  ex_zone:  Optional zone name or None
+        :type     ex_zone:  ``str`` or :class:`GCEZone` or
+                            :class:`NodeLocation` or ``None``
         """
         request = "/zones/%s/clusters" % (zone)
         if zone is None:
@@ -160,8 +163,13 @@ class GKEContainerDriver(KubernetesContainerDriver):
         response = self.connection.request(request, method='GET').object
         return response
 
-    def get_server_config(self, zone=None):
+    def get_server_config(self, ex_zone=None):
         """
+        Return configuration info about the Container Engine service.
+
+        :keyword  ex_zone:  Optional zone name or None
+        :type     ex_zone:  ``str`` or :class:`GCEZone` or
+                            :class:`NodeLocation` or ``None``
         """
         if zone is None:
             zone = self.zone

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/container/drivers/kubernetes.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/kubernetes.py b/libcloud/container/drivers/kubernetes.py
index f3c547a..4c7dcba 100644
--- a/libcloud/container/drivers/kubernetes.py
+++ b/libcloud/container/drivers/kubernetes.py
@@ -123,7 +123,6 @@ class KubernetesContainerDriver(ContainerDriver):
 
         :return: ``None``
         """
-        print(key, secret)
         super(KubernetesContainerDriver, self).__init__(key=key, secret=secret,
                                                         secure=secure,
                                                         host=host,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f3e4c6d/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 5d0f41e..909747b 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -50,11 +50,13 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
         self.driver = GKEContainerDriver(*GKE_PARAMS, **kwargs)
 
     def test_list_images_response(self):
-        pass
+        config = self.driver.list_clusters(ex_zone="us-central1-a")
+        assert "zone" in config
+        assert config.zone = "us-central1-a"
 
     def test_server_config(self):
-        zones = self.driver.get_server_config()
-        print(zones)
+        config = self.driver.get_server_config()
+        assert "validImageTypes" in config
 
 
 class GKEMockHttp(MockHttp):
@@ -82,5 +84,11 @@ class GKEMockHttp(MockHttp):
             'zones_us-central1-a_instance_serverconfig.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def _zones_us_central1_a_clusters(self, method, url, body, headers):
+        body = self.fixtures.load(
+            'zones_us-central1-a_list.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


[16/34] libcloud git commit: update for test

Posted by an...@apache.org.
update for test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/94a30995
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/94a30995
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/94a30995

Branch: refs/heads/trunk
Commit: 94a309957bbe4f93ec346e0cfa8fb0aa086e05f1
Parents: e16a2b0
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 12:14:50 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 12:14:50 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/94a30995/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 98ea1f3..3a84aae 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -16,18 +16,13 @@
 Tests for Google Container Engine Driver
 """
 
-import datetime
-import mock
 import sys
 import unittest
 
-from libcloud.utils.py3 import httplib
+# from libcloud.utils.py3 import httplib
 from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION
-from libcloud.common.google import (GoogleBaseAuthConnection,
-                                    ResourceNotFoundError, ResourceExistsError,
-                                    GoogleBaseError)
+from libcloud.common.google import (GoogleBaseAuthConnection)
 from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase
-from libcloud.compute.base import Node, StorageVolume
 
 from libcloud.test import MockHttp
 from libcloud.test.container import TestCaseMixin


[15/34] libcloud git commit: update test

Posted by an...@apache.org.
update test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e16a2b06
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e16a2b06
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e16a2b06

Branch: refs/heads/trunk
Commit: e16a2b06075f115eb80a6781d6f64f00104fc521
Parents: e459ef6
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 11:51:12 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 11:51:12 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py   |  9 +++++++--
 libcloud/test/container/test_gke.py | 30 +++++++++++++++---------------
 2 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e16a2b06/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 91f24da..acac294 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -145,6 +145,9 @@ class GKEContainerDriver(KubernetesContainerDriver):
         self.auth_type = auth_type
         self.project = project
         self.scopes = scopes
+        self.zone = None
+        if datacenter is not None:
+            self.zone = datacenter
         self.credential_file = credential_file or \
             GoogleOAuth2Credential.default_credential_file + '.' + self.project
 
@@ -161,7 +164,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
                 'scopes': self.scopes,
                 'credential_file': self.credential_file}
 
-    def list_clusters(self, zone=None):
+    def list_images(self, zone=None):
         """
         """
         request = "/zones/%s/clusters" % (zone)
@@ -174,7 +177,9 @@ class GKEContainerDriver(KubernetesContainerDriver):
     def get_server_config(self, zone=None):
         """
         """
-        request = "/zones/%s/serverconfig" % (zone)
+        if zone is None:
+            zone = self.zone
+        request = "/zones/%s/serverconfig" % (self.zone)
 
         response = self.connection.request(request, method='GET').object
         return response

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e16a2b06/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index f38e5f5..98ea1f3 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -22,11 +22,7 @@ import sys
 import unittest
 
 from libcloud.utils.py3 import httplib
-from libcloud.compute.drivers.gce import (
-    GCENodeDriver, API_VERSION, timestamp_to_datetime, GCEAddress, GCEBackend,
-    GCEBackendService, GCEFirewall, GCEForwardingRule, GCEHealthCheck,
-    GCENetwork, GCENodeImage, GCERoute, GCERegion, GCETargetHttpProxy,
-    GCEUrlMap, GCEZone, GCESubnetwork)
+from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION
 from libcloud.common.google import (GoogleBaseAuthConnection,
                                     ResourceNotFoundError, ResourceExistsError,
                                     GoogleBaseError)
@@ -34,7 +30,7 @@ from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase
 from libcloud.compute.base import Node, StorageVolume
 
 from libcloud.test import MockHttp
-from libcloud.test.compute import TestCaseMixin
+from libcloud.test.container import TestCaseMixin
 from libcloud.test.file_fixtures import ContainerFileFixtures
 
 from libcloud.test.secrets import GKE_PARAMS, GKE_KEYWORD_PARAMS
@@ -46,29 +42,29 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
     """
     # Mock out a few specific calls that interact with the user, system or
     # environment.
-    GCEZone._now = lambda x: datetime.datetime(2013, 6, 26, 19, 0, 0)
     datacenter = 'us-central1-a'
 
     def setUp(self):
         GKEMockHttp.test = self
-        GKEContainerDriver.connectionCls.conn_class = GCEMockHttp
+        GKEContainerDriver.connectionCls.conn_class = GKEMockHttp
         GoogleBaseAuthConnection.conn_class = GoogleAuthMockHttp
         GKEMockHttp.type = None
-        kwargs = GCE_KEYWORD_PARAMS.copy()
+        kwargs = GKE_KEYWORD_PARAMS.copy()
         kwargs['auth_type'] = 'IA'
         kwargs['datacenter'] = self.datacenter
-        self.driver = GCENodeDriver(*GCE_PARAMS, **kwargs)
+        self.driver = GKEContainerDriver(*GKE_PARAMS, **kwargs)
 
-    def test_default_scopes(self):
-        self.assertEqual(self.driver.scopes, None)
+    def test_list_images_response(self):
+        pass
 
 
-class GCEMockHttp(MockHttp):
-    fixtures = ContainerFileFixtures('gce')
+class GKEMockHttp(MockHttp):
+    fixtures = ContainerFileFixtures('gke')
     json_hdr = {'content-type': 'application/json; charset=UTF-8'}
 
     def _get_method_name(self, type, use_param, qs, path):
-        api_path = '/container/%s' % API_VERSION
+        print("GKEMOCKHTTP", type, use_param, qs, path)
+        api_path = '%s' % API_VERSION
         project_path = '/projects/%s' % GKE_KEYWORD_PARAMS['project']
         path = path.replace(api_path, '')
         # This replace is separate, since there is a call with a different
@@ -76,8 +72,12 @@ class GCEMockHttp(MockHttp):
         path = path.replace(project_path, '')
         # The path to get project information is the base path, so use a fake
         # '/project' path instead
+        print("path", path)
         if not path:
             path = '/project'
         method_name = super(GKEMockHttp, self)._get_method_name(
             type, use_param, qs, path)
         return method_name
+
+if __name__ == '__main__':
+    sys.exit(unittest.main())


[22/34] libcloud git commit: fixing documentation

Posted by an...@apache.org.
fixing documentation


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/60d64622
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/60d64622
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/60d64622

Branch: refs/heads/trunk
Commit: 60d6462264d3221ed27e0bb2a39b319985978321
Parents: e208a9e
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 19:31:07 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 19:31:07 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/60d64622/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 20a9ae4..646838f 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -14,25 +14,11 @@ class GKEConnection(GoogleBaseConnection):
     """
     Connection class for the GKE driver.
 
-    GCEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons:
-      1. modify request_path for GCE URI.
+    GKEConnection extends :class:`google.GoogleBaseConnection` for 2 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.
 
-    If the parameter gce_params is set to a dict prior to calling request(),
-    the URL parameters will be updated to include those key/values FOR A
-    SINGLE REQUEST. If the response contains a nextPageToken,
-    gce_params['pageToken'] will be set to its value. This can be used to
-    implement paging in list:
-
-    >>> params, more_results = {'maxResults': 2}, True
-    >>> while more_results:
-    ...     driver.connection.gce_params=params
-    ...     driver.ex_list_urlmaps()
-    ...     more_results = 'pageToken' in params
-    ...
-    [<GCEUrlMap id="..." name="cli-map">, <GCEUrlMap id="..." name="lc-map">]
-    [<GCEUrlMap id="..." name="web-map">]
     """
     host = 'container.googleapis.com'
     responseCls = GKEResponse
@@ -79,7 +65,7 @@ class GKEConnection(GoogleBaseConnection):
 
 class GKEContainerDriver(KubernetesContainerDriver):
     """
-    GCE Node Driver class.
+    GKE Container Driver class.
 
     This is the primary driver for interacting with Google Container
     Engine. It contains all of the standard libcloud methods,
@@ -117,16 +103,16 @@ class GKEContainerDriver(KubernetesContainerDriver):
                               operations.
         :type     datacenter: ``str``
 
-        :keyword  project: Your GCE project name. (required)
+        :keyword  project: Your GKE project name. (required)
         :type     project: ``str``
 
-        :keyword  auth_type: Accepted values are "SA" or "IA" or "GCE"
+        :keyword  auth_type: Accepted values are "SA" or "IA" or "GKE"
                              ("Service Account" or "Installed Application" or
-                             "GCE" if libcloud is being used on a GCE instance
+                             "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 GCE instance.
+                             executed in a GKE instance.
         :type     auth_type: ``str``
 
         :keyword  scopes: List of authorization URLs. Default is empty and
@@ -134,7 +120,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
         :type     scopes: ``list``
 
         :keyword  credential_file: Path to file for caching authentication
-                                   information used by GCEConnection.
+                                   information used by GKEConnection.
         :type     credential_file: ``str``
         """
         if not project:


[21/34] libcloud git commit: fixing bug

Posted by an...@apache.org.
fixing bug


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e208a9ee
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e208a9ee
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e208a9ee

Branch: refs/heads/trunk
Commit: e208a9eeaec6171e5813e665ad36f67cea3c17ea
Parents: 972ba8c
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 19:26:01 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 19:26:01 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e208a9ee/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 519c893..20a9ae4 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -54,7 +54,7 @@ class GKEConnection(GoogleBaseConnection):
         params, headers = super(GKEConnection, self).pre_connect_hook(params,
                                                                       headers)
         if self.gke_params:
-            params.update(self.gce_params)
+            params.update(self.gke_params)
         return params, headers
 
     def request(self, *args, **kwargs):


[12/34] libcloud git commit: changing the test around

Posted by an...@apache.org.
changing the test around


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f2631067
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f2631067
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f2631067

Branch: refs/heads/trunk
Commit: f263106797994e4b5add5266fa56c2cf6da87fe4
Parents: 03b666f
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 21:40:52 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 21:40:52 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 54 ++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f2631067/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index dfe7881..5b68de9 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -13,26 +13,48 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from libcloud.test import unittest
+import datetime
+import mock
+import sys
+import unittest
 
-from libcloud.container.drivers.gke import GKEContainerDriver
-from libcloud.test.secrets import CONTAINER_PARAMS_DOCKER
+from libcloud.utils.py3 import httplib
+from libcloud.compute.drivers.gce import (
+    GCENodeDriver, API_VERSION, timestamp_to_datetime, GCEAddress, GCEBackend,
+    GCEBackendService, GCEFirewall, GCEForwardingRule, GCEHealthCheck,
+    GCENetwork, GCENodeImage, GCERoute, GCERegion, GCETargetHttpProxy,
+    GCEUrlMap, GCEZone, GCESubnetwork)
+from libcloud.common.google import (GoogleBaseAuthConnection,
+                                    ResourceNotFoundError, ResourceExistsError,
+                                    GoogleBaseError)
+from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase
+from libcloud.compute.base import Node, StorageVolume
 
+from libcloud.test import MockHttp
+from libcloud.test.compute import TestCaseMixin
+from libcloud.test.file_fixtures import ComputeFileFixtures
 
-from libcloud.test.container.test_kubernetes import KubernetesContainerDriverTestCase, KubernetesMockHttp
+from libcloud.test.secrets import GCE_PARAMS, GCE_KEYWORD_PARAMS
 
 
-class GKEContainerDriverTestCase(KubernetesContainerDriverTestCase, unittest.TestCase):
+class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
+    """
+    Google Compute Engine Test Class.
+    """
+    # Mock out a few specific calls that interact with the user, system or
+    # environment.
+    GCEZone._now = lambda x: datetime.datetime(2013, 6, 26, 19, 0, 0)
+    datacenter = 'us-central1-a'
 
     def setUp(self):
-        # Create a test driver for each version
-        versions = ('linux_124', 'mac_124')
-        self.drivers = []
-        for version in versions:
-            GKEContainerDriver.connectionCls.conn_class = \
-                KubernetesMockHttp
-            KubernetesMockHttp.type = None
-            KubernetesMockHttp.use_param = 'a'
-            driver = GKEContainerDriver(*CONTAINER_PARAMS_DOCKER)
-            driver.version = version
-            self.drivers.append(driver)
+        GCEMockHttp.test = self
+        GCENodeDriver.connectionCls.conn_class = GCEMockHttp
+        GoogleBaseAuthConnection.conn_class = GoogleAuthMockHttp
+        GCEMockHttp.type = None
+        kwargs = GCE_KEYWORD_PARAMS.copy()
+        kwargs['auth_type'] = 'IA'
+        kwargs['datacenter'] = self.datacenter
+        self.driver = GCENodeDriver(*GCE_PARAMS, **kwargs)
+
+    def test_default_scopes(self):
+        self.assertEqual(self.driver.scopes, None)


[03/34] libcloud git commit: update for Kuebernetes

Posted by an...@apache.org.
update for Kuebernetes


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8a6fe5ab
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8a6fe5ab
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8a6fe5ab

Branch: refs/heads/trunk
Commit: 8a6fe5abb305cbe7f75bc0802790cfa15a30d0da
Parents: de40af5
Author: andy <an...@gmail.com>
Authored: Sun Jun 4 20:37:50 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 4 20:37:50 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8a6fe5ab/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 50455c7..ed85adb 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -1,10 +1,10 @@
 from libcloud.common.google import GoogleOAuth2Credential
 
-from libcloud.container.drivers.docker import (DockerContainerDriver,
-                                               DockerConnection)
+from libcloud.container.drivers.kuebernetes import DockerContainerDriver,
+                                               KubernetesConnection
 
 
-class GKEContainerDriver(DockerContainerDriver):
+class GKEContainerDriver(KubernetesContainerDriver):
     """
     GCE Node Driver class.
 
@@ -16,7 +16,7 @@ class GKEContainerDriver(DockerContainerDriver):
     objects/strings).  In most cases, passing strings instead of objects will
     result in additional GKE API calls.
     """
-    connectionCls = DockerConnection
+    connectionCls = KubernetesConnection
     api_name = 'google'
     name = "Google Container Engine"
     type = Provider.GKE


[14/34] libcloud git commit: update

Posted by an...@apache.org.
update


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e459ef68
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e459ef68
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e459ef68

Branch: refs/heads/trunk
Commit: e459ef6812441e391399815b0364363d1cb477f8
Parents: 06c8ccb
Author: andy <an...@gmail.com>
Authored: Sat Jun 17 17:40:36 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sat Jun 17 17:40:36 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 30 +++++++++++++++++++++++++-----
 libcloud/test/secrets.py-dist       |  4 ++++
 2 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e459ef68/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index faa35c1..f38e5f5 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -35,9 +35,9 @@ from libcloud.compute.base import Node, StorageVolume
 
 from libcloud.test import MockHttp
 from libcloud.test.compute import TestCaseMixin
-from libcloud.test.file_fixtures import ComputeFileFixtures
+from libcloud.test.file_fixtures import ContainerFileFixtures
 
-from libcloud.test.secrets import GCE_PARAMS, GCE_KEYWORD_PARAMS
+from libcloud.test.secrets import GKE_PARAMS, GKE_KEYWORD_PARAMS
 
 
 class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
@@ -50,10 +50,10 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
     datacenter = 'us-central1-a'
 
     def setUp(self):
-        GCEMockHttp.test = self
-        GCENodeDriver.connectionCls.conn_class = GCEMockHttp
+        GKEMockHttp.test = self
+        GKEContainerDriver.connectionCls.conn_class = GCEMockHttp
         GoogleBaseAuthConnection.conn_class = GoogleAuthMockHttp
-        GCEMockHttp.type = None
+        GKEMockHttp.type = None
         kwargs = GCE_KEYWORD_PARAMS.copy()
         kwargs['auth_type'] = 'IA'
         kwargs['datacenter'] = self.datacenter
@@ -61,3 +61,23 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
 
     def test_default_scopes(self):
         self.assertEqual(self.driver.scopes, None)
+
+
+class GCEMockHttp(MockHttp):
+    fixtures = ContainerFileFixtures('gce')
+    json_hdr = {'content-type': 'application/json; charset=UTF-8'}
+
+    def _get_method_name(self, type, use_param, qs, path):
+        api_path = '/container/%s' % API_VERSION
+        project_path = '/projects/%s' % GKE_KEYWORD_PARAMS['project']
+        path = path.replace(api_path, '')
+        # This replace is separate, since there is a call with a different
+        # project name
+        path = path.replace(project_path, '')
+        # The path to get project information is the base path, so use a fake
+        # '/project' path instead
+        if not path:
+            path = '/project'
+        method_name = super(GKEMockHttp, self)._get_method_name(
+            type, use_param, qs, path)
+        return method_name

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e459ef68/libcloud/test/secrets.py-dist
----------------------------------------------------------------------
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index b7faf32..1b30bf2 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -24,6 +24,10 @@ GANDI_PARAMS = ('user',)
 GCE_PARAMS = ('email@developer.gserviceaccount.com', 'key')  # Service Account Authentication
 # GCE_PARAMS = ('client_id', 'client_secret')  # Installed App Authentication
 GCE_KEYWORD_PARAMS = {'project': 'project_name'}
+GKE_PARAMS = ('email@developer.gserviceaccount.com', 'key')  # Service Account Authentication
+# GCE_PARAMS = ('client_id', 'client_secret')  # Installed App Authentication
+GKE_KEYWORD_PARAMS = {'project': 'project_name'}
+
 HOSTINGCOM_PARAMS = ('user', 'secret')
 IBM_PARAMS = ('user', 'secret')
 ONAPP_PARAMS = ('key')


[06/34] libcloud git commit: Update

Posted by an...@apache.org.
Update


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b9704214
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b9704214
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b9704214

Branch: refs/heads/trunk
Commit: b970421475178d80ea27879bc38e9f1c885065b3
Parents: f222792
Author: andy <an...@gmail.com>
Authored: Thu Jun 8 08:20:16 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Thu Jun 8 08:20:16 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b9704214/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 96c1f8c..02bb33f 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -34,7 +34,7 @@ class GKEConnection(GoogleBaseConnection):
     [<GCEUrlMap id="..." name="cli-map">, <GCEUrlMap id="..." name="lc-map">]
     [<GCEUrlMap id="..." name="web-map">]
     """
-    host = 'www.googleapis.com'
+    host = 'container.googleapis.com'
     responseCls = GKEResponse
 
     def __init__(self, user_id, key, secure, auth_type=None,
@@ -85,7 +85,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
     website = 'https://container.googleapis.com'
     supports_clusters = True
 
-    AUTH_URL = "https://www.googleapis.com/auth/"
+    AUTH_URL = "https://www.googleapis.com/auth/cloudplatform"
 
     BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
 
@@ -156,6 +156,6 @@ class GKEContainerDriver(KubernetesContainerDriver):
         if zone is None:
             request = "/zones/clusters"
         # https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters
-        print(self.website+self.base_path+request)
-        response = self.connection.request(self.base_path + request, method='GET').object
+        print(self.website+self.base_path)
+        response = self.connection.request(request, method='GET').object
         print(response)


[13/34] libcloud git commit: updated

Posted by an...@apache.org.
updated


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/06c8ccb3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/06c8ccb3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/06c8ccb3

Branch: refs/heads/trunk
Commit: 06c8ccb3d9f65b04ddfeca56cc45976d1211eaea
Parents: f263106
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 21:50:24 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 21:50:24 2017 -0400

----------------------------------------------------------------------
 docs/container/drivers/gke.rst      | 51 +++++++-------------------------
 libcloud/test/container/test_gke.py |  3 ++
 2 files changed, 13 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/06c8ccb3/docs/container/drivers/gke.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/gke.rst b/docs/container/drivers/gke.rst
index d2c5548..930c8c6 100644
--- a/docs/container/drivers/gke.rst
+++ b/docs/container/drivers/gke.rst
@@ -1,58 +1,27 @@
 Google Container Driver Documentation
 ============================================
 
-`Google Container Platform`_ is a Docker hosting service, provided by Google.
+`Google Container Platform`_ is a Kubernetes hosting service, provided by Google.
 Docker-native tools and elastic hosts make deploying on Google Cloud as easy as running Docker on your laptop.
 There is no special software to install or configure.
-Mix Docker containers with container-native Linux to extend the benefits of containerization to legacy applications and stateful services.
+Mix Kubernetes containers with container-native Linux to extend the benefits of containerization to legacy applications and stateful services.
 
+Examples
+--------
 
-Instantiating the driver
-------------------------
-
-Download the script::
-
-    ****
-
-Now execute the script, substituting the correct values::
-
-    ****
-
-This should output something similar to the following::
-
-    Setting up Docker client for SDC using:
-        CloudAPI:        https://us-east-1.api.joyent.com
-        Account:         jill
-        Key:             /Users/localuser/.ssh/sdc-docker.id_rsa
-
-    If you have a pass phrase on your key, the openssl command will
-    prompt you for your pass phrase now and again later.
-
-    Verifying GoogleCloudAPI access.
-    CloudAPI access verified.
-
-    Generating client certificate from SSH private key.
-    writing RSA key
-    Wrote certificate files to /Users/localuser/.sdc/docker/jill
-
-    Get Docker host endpoint from cloudapi.
-    Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
+Additional example code can be found in the "demos" directory of Libcloud here:
+https://github.com/apache/libcloud/blob/trunk/demos/gce_demo.py
 
-    * * *
-    Success. Set your environment as follows:
+1. Getting Driver with Service Account authentication
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-        export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
-        export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
-        export DOCKER_CLIENT_TIMEOUT=300
-        export DOCKER_TLS_VERIFY=1
+.. literalinclude:: /examples/compute/gce/gce_service_account.py
 
-.. literalinclude:: /examples/container/joyent/instantiate_driver.py
-   :language: python
 
 API Docs
 --------
 
-.. autoclass:: libcloud.container.drivers.joyent.GoogleContainerDriver
+.. autoclass:: libcloud.container.drivers.joyent.GKEContainerDriver
     :members:
     :inherited-members:
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/06c8ccb3/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 5b68de9..faa35c1 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -12,6 +12,9 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""
+Tests for Google Container Engine Driver
+"""
 
 import datetime
 import mock


[10/34] libcloud git commit: update for formatting

Posted by an...@apache.org.
update for formatting


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1c11d5e2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1c11d5e2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1c11d5e2

Branch: refs/heads/trunk
Commit: 1c11d5e2bcb2556dd1891ac644e7f01d788492b7
Parents: b0eb0d3
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 21:10:41 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 21:10:41 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py   | 22 ++++++++++++----------
 libcloud/test/container/test_gke.py |  4 ++--
 2 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1c11d5e2/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 7e68b36..91f24da 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -81,13 +81,13 @@ class GKEContainerDriver(KubernetesContainerDriver):
     """
     GCE Node 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.
+    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.
+    objects/strings).  In most cases, passing strings instead of objects
+    will result in additional GKE API calls.
     """
     connectionCls = GKEConnection
     api_name = 'google'
@@ -101,7 +101,8 @@ class GKEContainerDriver(KubernetesContainerDriver):
     BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
 
     def __init__(self, user_id, key=None, datacenter=None, project=None,
-                 auth_type=None, scopes=None, credential_file=None, host=None, port=443, **kwargs):
+                 auth_type=None, scopes=None, credential_file=None,
+                 host=None, port=443, **kwargs):
         """
         :param  user_id: The email address (for service accounts) or Client ID
                          (for installed apps) to be used for authentication.
@@ -147,11 +148,11 @@ class GKEContainerDriver(KubernetesContainerDriver):
         self.credential_file = credential_file or \
             GoogleOAuth2Credential.default_credential_file + '.' + self.project
 
-        super(GKEContainerDriver, self).__init__(user_id, key, secure=True, host=None,
-                 port=None, **kwargs)
+        super(GKEContainerDriver, self).__init__(user_id, key,
+                                                 secure=True, host=None,
+                                                 port=None, **kwargs)
 
-        self.base_path = '/%s/projects/%s' % (API_VERSION,
-                                                      self.project)
+        self.base_path = '/%s/projects/%s' % (API_VERSION, self.project)
         self.website = GKEContainerDriver.website
 
     def _ex_connection_class_kwargs(self):
@@ -168,6 +169,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
             request = "/zones/clusters"
 
         response = self.connection.request(request, method='GET').object
+        return response
 
     def get_server_config(self, zone=None):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1c11d5e2/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 25dc708..dfe7881 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -31,8 +31,8 @@ class GKEContainerDriverTestCase(KubernetesContainerDriverTestCase, unittest.Tes
         for version in versions:
             GKEContainerDriver.connectionCls.conn_class = \
                 KubernetesMockHttp
-            DockerMockHttp.type = None
-            DockerMockHttp.use_param = 'a'
+            KubernetesMockHttp.type = None
+            KubernetesMockHttp.use_param = 'a'
             driver = GKEContainerDriver(*CONTAINER_PARAMS_DOCKER)
             driver.version = version
             self.drivers.append(driver)


[09/34] libcloud git commit: update

Posted by an...@apache.org.
update


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b0eb0d31
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b0eb0d31
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b0eb0d31

Branch: refs/heads/trunk
Commit: b0eb0d3131489148cc1ead2a308612c8d91eaaa6
Parents: 01f2c37
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 21:04:39 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 21:04:39 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b0eb0d31/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 6900952..7e68b36 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -1,6 +1,6 @@
 from libcloud.common.google import GoogleOAuth2Credential
 from libcloud.container.providers import Provider
-from libcloud.container.drivers.kubernetes import KubernetesConnection, KubernetesContainerDriver
+from libcloud.container.drivers.kubernetes import KubernetesContainerDriver
 from libcloud.common.google import GoogleResponse
 from libcloud.common.google import GoogleBaseConnection
 API_VERSION = 'v1'
@@ -39,7 +39,6 @@ class GKEConnection(GoogleBaseConnection):
 
     def __init__(self, user_id, key, secure, auth_type=None,
                  credential_file=None, project=None, **kwargs):
-        print("GKE CONNECTION", "auth_type", auth_type, "cred", credential_file)
         super(GKEConnection, self).__init__(
             user_id, key, secure=secure, auth_type=auth_type,
             credential_file=credential_file, **kwargs)
@@ -167,16 +166,13 @@ class GKEContainerDriver(KubernetesContainerDriver):
         request = "/zones/%s/clusters" % (zone)
         if zone is None:
             request = "/zones/clusters"
-        # https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters
-        print(self.website+self.base_path)
+
         response = self.connection.request(request, method='GET').object
-        print(response)
 
     def get_server_config(self, zone=None):
         """
         """
         request = "/zones/%s/serverconfig" % (zone)
-        # https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters
-        print(self.website+self.base_path)
+
         response = self.connection.request(request, method='GET').object
-        print(response)
+        return response


[04/34] libcloud git commit: going to use child of Kubernetes connection

Posted by an...@apache.org.
going to use child of Kubernetes connection


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7c7576b3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7c7576b3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7c7576b3

Branch: refs/heads/trunk
Commit: 7c7576b3b5e3586b375654eddc2de9b0404f50f9
Parents: 8a6fe5a
Author: andy <an...@gmail.com>
Authored: Sun Jun 4 21:56:31 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 4 21:56:31 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 90 +++++++---------------------------
 libcloud/test/secrets.py-dist     |  1 +
 2 files changed, 20 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7c7576b3/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index ed85adb..c881716 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -1,7 +1,8 @@
 from libcloud.common.google import GoogleOAuth2Credential
+from libcloud.container.providers import Provider
+from libcloud.container.drivers.kubernetes import KubernetesConnection, KubernetesContainerDriver
 
-from libcloud.container.drivers.kuebernetes import DockerContainerDriver,
-                                               KubernetesConnection
+API_VERSION = 'v1'
 
 
 class GKEContainerDriver(KubernetesContainerDriver):
@@ -21,6 +22,7 @@ class GKEContainerDriver(KubernetesContainerDriver):
     name = "Google Container Engine"
     type = Provider.GKE
     website = 'https://container.googleapis.com'
+    supports_clusters = True
 
     # Google Compute Engine node states are mapped to Libcloud node states
     # per the following dict. GCE does not have an actual 'stopped' state
@@ -35,23 +37,10 @@ class GKEContainerDriver(KubernetesContainerDriver):
 
     AUTH_URL = "https://www.googleapis.com/auth/"
 
-    IMAGE_PROJECTS = {
-        "centos-cloud": ["centos"],
-        "coreos-cloud": ["coreos"],
-        "debian-cloud": ["debian", "backports"],
-        "gce-nvme": ["nvme-backports"],
-        "google-containers": ["container-vm"],
-        "opensuse-cloud": ["opensuse"],
-        "rhel-cloud": ["rhel"],
-        "suse-cloud": ["sles", "suse"],
-        "ubuntu-os-cloud": ["ubuntu"],
-        "windows-cloud": ["windows"],
-    }
-
     BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
 
     def __init__(self, user_id, key=None, datacenter=None, project=None,
-                 auth_type=None, scopes=None, credential_file=None, **kwargs):
+                 auth_type=None, scopes=None, credential_file=None, host=None, port=443, **kwargs):
         """
         :param  user_id: The email address (for service accounts) or Client ID
                          (for installed apps) to be used for authentication.
@@ -89,68 +78,27 @@ class GKEContainerDriver(KubernetesContainerDriver):
         if not project:
             raise ValueError('Project name must be specified using '
                              '"project" keyword.')
-
+        if host is None:
+            host = GKEContainerDriver.website
         self.auth_type = auth_type
         self.project = project
         self.scopes = scopes
         self.credential_file = credential_file or \
             GoogleOAuth2Credential.default_credential_file + '.' + self.project
 
-        super(GKEContainerDriver, self).__init__(user_id, key, **kwargs)
+        super(GKEContainerDriver, self).__init__(user_id, key, host=host, port=port, **kwargs)
 
-        self.base_path = '/compute/%s/projects/%s' % (API_VERSION,
+        self.base_path = '/%s/projects/%s' % (API_VERSION,
                                                       self.project)
-        self.zone_list = self.ex_list_zones()
-        self.zone_dict = {}
-        for zone in self.zone_list:
-            self.zone_dict[zone.name] = zone
-        if datacenter:
-            self.zone = self.ex_get_zone(datacenter)
-        else:
-            self.zone = None
-
-        self.region_list = self.ex_list_regions()
-        self.region_dict = {}
-        for region in self.region_list:
-            self.region_dict[region.name] = region
-
-        if self.zone:
-            self.region = self._get_region_from_zone(self.zone)
-        else:
-            self.region = None
-
-        # Volume details are looked up in this name-zone dict.
-        # It is populated if the volume name is not found or the dict is empty.
-        self._ex_volume_dict = {}
-
-    def list_images(self, ex_project=None, ex_include_deprecated=False):
-        """
-        Return a list of image objects. If no project is specified, a list of
-        all non-deprecated global and vendor images images is returned. By
-        default, only non-deprecated images are returned.
+        self.website = GKEContainerDriver.website
 
-        :keyword  ex_project: Optional alternate project name.
-        :type     ex_project: ``str``, ``list`` of ``str``, or ``None``
-
-        :keyword  ex_include_deprecated: If True, even DEPRECATED images will
-                                         be returned.
-        :type     ex_include_deprecated: ``bool``
-
-        :return:  List of GCENodeImage objects
-        :rtype:   ``list`` of :class:`GCENodeImage`
+    def list_clusters(self, zone=None):
+        """
         """
-        dep = ex_include_deprecated
-        if ex_project is not None:
-            return self.ex_list_project_images(ex_project=ex_project,
-                                               ex_include_deprecated=dep)
-        image_list = self.ex_list_project_images(ex_project=None,
-                                                 ex_include_deprecated=dep)
-        for img_proj in list(self.IMAGE_PROJECTS.keys()):
-            try:
-                image_list.extend(
-                    self.ex_list_project_images(ex_project=img_proj,
-                                                ex_include_deprecated=dep))
-            except:
-                # do not break if an OS type is invalid
-                pass
-        return image_list
+        request = "/zones/%s/clusters" % (zone)
+        if zone is None:
+            request = "/zones/clusters"
+        # https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters
+        print(self.website+self.base_path+request)
+        response = self.connection.request(self.base_path + request, method='GET').object
+        print(response)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7c7576b3/libcloud/test/secrets.py-dist
----------------------------------------------------------------------
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index b44be36..b7faf32 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -98,3 +98,4 @@ CONTAINER_PARAMS_DOCKER = ('user', 'password')
 CONTAINER_PARAMS_ECS = ('user', 'password', 'region')
 CONTAINER_PARAMS_KUBERNETES = ('user', 'password')
 CONTAINER_PARAMS_RANCHER = ('user', 'password')
+CONTAINER_PARAMS_GKE = ('user', 'password')


[32/34] libcloud git commit: update for test

Posted by an...@apache.org.
update for test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/35bdf4e8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/35bdf4e8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/35bdf4e8

Branch: refs/heads/trunk
Commit: 35bdf4e8e06aaf46e7f14fe30068496f34394c44
Parents: 1b0f5ba
Author: andy <an...@gmail.com>
Authored: Wed Jun 21 21:45:35 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Wed Jun 21 21:45:35 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/35bdf4e8/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index e909e83..e4d29d6 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -51,8 +51,8 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
 
     def test_list_images_response(self):
         config = self.driver.list_clusters(ex_zone="us-central1-a")
-        assert "zone" in config
-        assert config.zone == "us-central1-a"
+        assert "clusters" in config
+        assert config["clusters"][0]["zone"] == "us-central1-a"
 
     def test_server_config(self):
         config = self.driver.get_server_config()


[11/34] libcloud git commit: update of doc code

Posted by an...@apache.org.
update of doc code


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/03b666f6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/03b666f6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/03b666f6

Branch: refs/heads/trunk
Commit: 03b666f6738484f90df49305c93789e57242a728
Parents: 1c11d5e
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 21:15:43 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 21:15:43 2017 -0400

----------------------------------------------------------------------
 docs/examples/container/gke/instantiate_driver.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/03b666f6/docs/examples/container/gke/instantiate_driver.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/gke/instantiate_driver.py b/docs/examples/container/gke/instantiate_driver.py
index a5b6143..c23060a 100644
--- a/docs/examples/container/gke/instantiate_driver.py
+++ b/docs/examples/container/gke/instantiate_driver.py
@@ -3,7 +3,7 @@ from libcloud.container.providers import get_driver
 
 cls = get_driver(Provider.GKE)
 
-conn = ComputeEngine('testaccount-XXX@testproject.iam.gserviceaccount.com',
-                     'libcloud.json', project='testproject')
+conn = cls('testaccount-XXX@testproject.iam.gserviceaccount.com',
+           'libcloud.json', project='testproject')
 
 conn.list_images()


[08/34] libcloud git commit: fixed my test

Posted by an...@apache.org.
fixed my test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/01f2c374
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/01f2c374
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/01f2c374

Branch: refs/heads/trunk
Commit: 01f2c374c587a16281910e93ad5932fd52069edc
Parents: 78c72b1
Author: andy <an...@gmail.com>
Authored: Tue Jun 13 20:55:10 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 13 20:55:10 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/01f2c374/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 5c17975..25dc708 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -15,24 +15,24 @@
 
 from libcloud.test import unittest
 
-from libcloud.container.drivers.gke import GoogleContainerDriver
+from libcloud.container.drivers.gke import GKEContainerDriver
 from libcloud.test.secrets import CONTAINER_PARAMS_DOCKER
 
 
-from libcloud.test.container.test_docker import DockerContainerDriverTestCase, DockerMockHttp
+from libcloud.test.container.test_kubernetes import KubernetesContainerDriverTestCase, KubernetesMockHttp
 
 
-class JoyentContainerDriverTestCase(DockerContainerDriverTestCase, unittest.TestCase):
+class GKEContainerDriverTestCase(KubernetesContainerDriverTestCase, unittest.TestCase):
 
     def setUp(self):
         # Create a test driver for each version
         versions = ('linux_124', 'mac_124')
         self.drivers = []
         for version in versions:
-            JoyentContainerDriver.connectionCls.conn_class = \
-                DockerMockHttp
+            GKEContainerDriver.connectionCls.conn_class = \
+                KubernetesMockHttp
             DockerMockHttp.type = None
             DockerMockHttp.use_param = 'a'
-            driver = JoyentContainerDriver(*CONTAINER_PARAMS_DOCKER)
+            driver = GKEContainerDriver(*CONTAINER_PARAMS_DOCKER)
             driver.version = version
             self.drivers.append(driver)


[17/34] libcloud git commit: test gke is broken again

Posted by an...@apache.org.
test gke is broken again


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4cefbbac
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4cefbbac
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4cefbbac

Branch: refs/heads/trunk
Commit: 4cefbbacdb9305c1c1565855f050d5cd8c9d263b
Parents: 94a3099
Author: andy <an...@gmail.com>
Authored: Sun Jun 18 13:03:00 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Sun Jun 18 13:03:00 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cefbbac/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 3a84aae..0129f9c 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -52,13 +52,16 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
     def test_list_images_response(self):
         pass
 
+    def test_server_config(self):
+        zones = self.driver.get_server_config()
+        print(zones)
+
 
 class GKEMockHttp(MockHttp):
     fixtures = ContainerFileFixtures('gke')
     json_hdr = {'content-type': 'application/json; charset=UTF-8'}
 
     def _get_method_name(self, type, use_param, qs, path):
-        print("GKEMOCKHTTP", type, use_param, qs, path)
         api_path = '%s' % API_VERSION
         project_path = '/projects/%s' % GKE_KEYWORD_PARAMS['project']
         path = path.replace(api_path, '')
@@ -74,5 +77,10 @@ class GKEMockHttp(MockHttp):
             type, use_param, qs, path)
         return method_name
 
+    def _zones_us_central1_a_serverconfig(self, method, url, body, headers):
+        body = self.fixtures.load(
+            'zones_us-central1-a_instance_serverconfig.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


[02/34] libcloud git commit: gke moving along

Posted by an...@apache.org.
gke moving along


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/de40af52
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/de40af52
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/de40af52

Branch: refs/heads/trunk
Commit: de40af52639c9f638bde30040e0fa19f37194d5c
Parents: 7949ca3
Author: andy <an...@gmail.com>
Authored: Tue May 23 09:47:18 2017 -0700
Committer: andy <an...@gmail.com>
Committed: Tue May 23 09:47:18 2017 -0700

----------------------------------------------------------------------
 docs/container/drivers/gke.rst                  | 58 +++++++++++++++
 docs/container/drivers/joyent.rst               | 18 ++---
 .../container/gke/instantiate_driver.py         |  9 +++
 libcloud/container/drivers/gke.py               | 75 ++++++++++----------
 libcloud/container/providers.py                 |  2 +
 libcloud/container/types.py                     |  1 +
 libcloud/test/container/test_gke.py             | 38 ++++++++++
 7 files changed, 156 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/docs/container/drivers/gke.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/gke.rst b/docs/container/drivers/gke.rst
new file mode 100644
index 0000000..d2c5548
--- /dev/null
+++ b/docs/container/drivers/gke.rst
@@ -0,0 +1,58 @@
+Google Container Driver Documentation
+============================================
+
+`Google Container Platform`_ is a Docker hosting service, provided by Google.
+Docker-native tools and elastic hosts make deploying on Google Cloud as easy as running Docker on your laptop.
+There is no special software to install or configure.
+Mix Docker containers with container-native Linux to extend the benefits of containerization to legacy applications and stateful services.
+
+
+Instantiating the driver
+------------------------
+
+Download the script::
+
+    ****
+
+Now execute the script, substituting the correct values::
+
+    ****
+
+This should output something similar to the following::
+
+    Setting up Docker client for SDC using:
+        CloudAPI:        https://us-east-1.api.joyent.com
+        Account:         jill
+        Key:             /Users/localuser/.ssh/sdc-docker.id_rsa
+
+    If you have a pass phrase on your key, the openssl command will
+    prompt you for your pass phrase now and again later.
+
+    Verifying GoogleCloudAPI access.
+    CloudAPI access verified.
+
+    Generating client certificate from SSH private key.
+    writing RSA key
+    Wrote certificate files to /Users/localuser/.sdc/docker/jill
+
+    Get Docker host endpoint from cloudapi.
+    Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
+
+    * * *
+    Success. Set your environment as follows:
+
+        export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
+        export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
+        export DOCKER_CLIENT_TIMEOUT=300
+        export DOCKER_TLS_VERIFY=1
+
+.. literalinclude:: /examples/container/joyent/instantiate_driver.py
+   :language: python
+
+API Docs
+--------
+
+.. autoclass:: libcloud.container.drivers.joyent.GoogleContainerDriver
+    :members:
+    :inherited-members:
+

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/docs/container/drivers/joyent.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/joyent.rst b/docs/container/drivers/joyent.rst
index a8b29d3..8dcaacf 100644
--- a/docs/container/drivers/joyent.rst
+++ b/docs/container/drivers/joyent.rst
@@ -17,7 +17,7 @@ Instantiating the driver
 Download the script::
 
     curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh
-    
+
 Now execute the script, substituting the correct values::
 
     bash sdc-docker-setup.sh <CLOUDAPI_URL> <ACCOUNT_USERNAME> ~/.ssh/<PRIVATE_KEY_FILE>
@@ -28,31 +28,31 @@ This should output something similar to the following::
         CloudAPI:        https://us-east-1.api.joyent.com
         Account:         jill
         Key:             /Users/localuser/.ssh/sdc-docker.id_rsa
-    
+
     If you have a pass phrase on your key, the openssl command will
     prompt you for your pass phrase now and again later.
-    
+
     Verifying CloudAPI access.
     CloudAPI access verified.
-    
+
     Generating client certificate from SSH private key.
     writing RSA key
     Wrote certificate files to /Users/localuser/.sdc/docker/jill
-    
+
     Get Docker host endpoint from cloudapi.
     Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
-    
+
     * * *
     Success. Set your environment as follows:
-    
+
         export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
         export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
         export DOCKER_CLIENT_TIMEOUT=300
         export DOCKER_TLS_VERIFY=1
-        
+
 .. literalinclude:: /examples/container/joyent/instantiate_driver.py
    :language: python
-   
+
 API Docs
 --------
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/docs/examples/container/gke/instantiate_driver.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/gke/instantiate_driver.py b/docs/examples/container/gke/instantiate_driver.py
new file mode 100644
index 0000000..a5b6143
--- /dev/null
+++ b/docs/examples/container/gke/instantiate_driver.py
@@ -0,0 +1,9 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+cls = get_driver(Provider.GKE)
+
+conn = ComputeEngine('testaccount-XXX@testproject.iam.gserviceaccount.com',
+                     'libcloud.json', project='testproject')
+
+conn.list_images()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index 3faf009..50455c7 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -1,7 +1,10 @@
 from libcloud.common.google import GoogleOAuth2Credential
 
+from libcloud.container.drivers.docker import (DockerContainerDriver,
+                                               DockerConnection)
 
-class GKENodeDriver(NodeDriver):
+
+class GKEContainerDriver(DockerContainerDriver):
     """
     GCE Node Driver class.
 
@@ -13,7 +16,7 @@ class GKENodeDriver(NodeDriver):
     objects/strings).  In most cases, passing strings instead of objects will
     result in additional GKE API calls.
     """
-    connectionCls = GKEConnection
+    connectionCls = DockerConnection
     api_name = 'google'
     name = "Google Container Engine"
     type = Provider.GKE
@@ -29,38 +32,8 @@ class GKENodeDriver(NodeDriver):
     # node in a 'terminated' state.
     # For more details, please see GCE's docs,
     # https://cloud.google.com/compute/docs/instances#checkmachinestatus
-    NODE_STATE_MAP = {
-        "PROVISIONING": NodeState.PENDING,
-        "STAGING": NodeState.PENDING,
-        "RUNNING": NodeState.RUNNING,
-        "STOPPING": NodeState.PENDING,
-        "TERMINATED": NodeState.STOPPED,
-        "UNKNOWN": NodeState.UNKNOWN
-    }
 
     AUTH_URL = "https://www.googleapis.com/auth/"
-    SA_SCOPES_MAP = {
-        # list derived from 'gcloud compute instances create --help'
-        "bigquery": "bigquery",
-        "cloud-platform": "cloud-platform",
-        "compute-ro": "compute.readonly",
-        "compute-rw": "compute",
-        "datastore": "datastore",
-        "logging-write": "logging.write",
-        "monitoring": "monitoring",
-        "monitoring-write": "monitoring.write",
-        "service-control": "servicecontrol",
-        "service-management": "service.management",
-        "sql": "sqlservice",
-        "sql-admin": "sqlservice.admin",
-        "storage-full": "devstorage.full_control",
-        "storage-ro": "devstorage.read_only",
-        "storage-rw": "devstorage.read_write",
-        "taskqueue": "taskqueue",
-        "useraccounts-ro": "cloud.useraccounts.readonly",
-        "useraccounts-rw": "cloud.useraccounts",
-        "userinfo-email": "userinfo.email"
-    }
 
     IMAGE_PROJECTS = {
         "centos-cloud": ["centos"],
@@ -123,11 +96,9 @@ class GKENodeDriver(NodeDriver):
         self.credential_file = credential_file or \
             GoogleOAuth2Credential.default_credential_file + '.' + self.project
 
-        super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
+        super(GKEContainerDriver, self).__init__(user_id, key, **kwargs)
 
-        # Cache Zone and Region information to reduce API calls and
-        # increase speed
-        self.base_path = '/%s/projects/%s' % (API_VERSION,
+        self.base_path = '/compute/%s/projects/%s' % (API_VERSION,
                                                       self.project)
         self.zone_list = self.ex_list_zones()
         self.zone_dict = {}
@@ -151,3 +122,35 @@ class GKENodeDriver(NodeDriver):
         # Volume details are looked up in this name-zone dict.
         # It is populated if the volume name is not found or the dict is empty.
         self._ex_volume_dict = {}
+
+    def list_images(self, ex_project=None, ex_include_deprecated=False):
+        """
+        Return a list of image objects. If no project is specified, a list of
+        all non-deprecated global and vendor images images is returned. By
+        default, only non-deprecated images are returned.
+
+        :keyword  ex_project: Optional alternate project name.
+        :type     ex_project: ``str``, ``list`` of ``str``, or ``None``
+
+        :keyword  ex_include_deprecated: If True, even DEPRECATED images will
+                                         be returned.
+        :type     ex_include_deprecated: ``bool``
+
+        :return:  List of GCENodeImage objects
+        :rtype:   ``list`` of :class:`GCENodeImage`
+        """
+        dep = ex_include_deprecated
+        if ex_project is not None:
+            return self.ex_list_project_images(ex_project=ex_project,
+                                               ex_include_deprecated=dep)
+        image_list = self.ex_list_project_images(ex_project=None,
+                                                 ex_include_deprecated=dep)
+        for img_proj in list(self.IMAGE_PROJECTS.keys()):
+            try:
+                image_list.extend(
+                    self.ex_list_project_images(ex_project=img_proj,
+                                                ex_include_deprecated=dep))
+            except:
+                # do not break if an OS type is invalid
+                pass
+        return image_list

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/libcloud/container/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/container/providers.py b/libcloud/container/providers.py
index a823382..da6661c 100644
--- a/libcloud/container/providers.py
+++ b/libcloud/container/providers.py
@@ -30,6 +30,8 @@ DRIVERS = {
     ('libcloud.container.drivers.kubernetes', 'KubernetesContainerDriver'),
     Provider.RANCHER:
     ('libcloud.container.drivers.rancher', 'RancherContainerDriver'),
+    Provider.GKE:
+    ('libcloud.container.drivers.gke', 'GKEContainerDriver')
 }
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/libcloud/container/types.py
----------------------------------------------------------------------
diff --git a/libcloud/container/types.py b/libcloud/container/types.py
index b89fdfd..b7a50ce 100644
--- a/libcloud/container/types.py
+++ b/libcloud/container/types.py
@@ -49,6 +49,7 @@ class Provider(object):
     DUMMY = 'dummy'
     DOCKER = 'docker'
     ECS = 'ecs'
+    GKE = 'GKE'
     JOYENT = 'joyent'
     KUBERNETES = 'kubernetes'
     RANCHER = 'rancher'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de40af52/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
new file mode 100644
index 0000000..5c17975
--- /dev/null
+++ b/libcloud/test/container/test_gke.py
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from libcloud.test import unittest
+
+from libcloud.container.drivers.gke import GoogleContainerDriver
+from libcloud.test.secrets import CONTAINER_PARAMS_DOCKER
+
+
+from libcloud.test.container.test_docker import DockerContainerDriverTestCase, DockerMockHttp
+
+
+class JoyentContainerDriverTestCase(DockerContainerDriverTestCase, unittest.TestCase):
+
+    def setUp(self):
+        # Create a test driver for each version
+        versions = ('linux_124', 'mac_124')
+        self.drivers = []
+        for version in versions:
+            JoyentContainerDriver.connectionCls.conn_class = \
+                DockerMockHttp
+            DockerMockHttp.type = None
+            DockerMockHttp.use_param = 'a'
+            driver = JoyentContainerDriver(*CONTAINER_PARAMS_DOCKER)
+            driver.version = version
+            self.drivers.append(driver)


[05/34] libcloud git commit: updates

Posted by an...@apache.org.
updates


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f2227922
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f2227922
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f2227922

Branch: refs/heads/trunk
Commit: f222792230ff44297a8537c3d6f3b54ca3df79c2
Parents: 7c7576b
Author: andy <an...@gmail.com>
Authored: Tue Jun 6 08:12:04 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 6 08:12:04 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py        | 85 ++++++++++++++++++++++-----
 libcloud/container/drivers/kubernetes.py | 23 ++++----
 2 files changed, 84 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f2227922/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index c881716..96c1f8c 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -1,10 +1,71 @@
 from libcloud.common.google import GoogleOAuth2Credential
 from libcloud.container.providers import Provider
 from libcloud.container.drivers.kubernetes import KubernetesConnection, KubernetesContainerDriver
-
+from libcloud.common.google import GoogleResponse
+from libcloud.common.google import GoogleBaseConnection
 API_VERSION = 'v1'
 
 
+class GKEResponse(GoogleResponse):
+    pass
+
+
+class GKEConnection(GoogleBaseConnection):
+    """
+    Connection class for the GKE driver.
+
+    GCEConnection extends :class:`google.GoogleBaseConnection` for 2 reasons:
+      1. modify request_path for GCE URI.
+      2. Implement gce_params functionality described below.
+      3. Add request_aggregated_items method for making aggregated API calls.
+
+    If the parameter gce_params is set to a dict prior to calling request(),
+    the URL parameters will be updated to include those key/values FOR A
+    SINGLE REQUEST. If the response contains a nextPageToken,
+    gce_params['pageToken'] will be set to its value. This can be used to
+    implement paging in list:
+
+    >>> params, more_results = {'maxResults': 2}, True
+    >>> while more_results:
+    ...     driver.connection.gce_params=params
+    ...     driver.ex_list_urlmaps()
+    ...     more_results = 'pageToken' in params
+    ...
+    [<GCEUrlMap id="..." name="cli-map">, <GCEUrlMap id="..." name="lc-map">]
+    [<GCEUrlMap id="..." name="web-map">]
+    """
+    host = 'www.googleapis.com'
+    responseCls = GKEResponse
+
+    def __init__(self, user_id, key, secure, auth_type=None,
+                 credential_file=None, project=None, **kwargs):
+        print("GKE CONNECTION", "auth_type", auth_type, "cred", credential_file)
+        super(GKEConnection, self).__init__(
+            user_id, key, secure=secure, auth_type=auth_type,
+            credential_file=credential_file, **kwargs)
+        self.request_path = '%s/projects/%s' % (API_VERSION, project)
+        self.gce_params = None
+
+    def request(self, *args, **kwargs):
+        """
+        Perform request then do GCE-specific processing of URL params.
+
+        @inherits: :class:`GoogleBaseConnection.request`
+        """
+        response = super(GKEConnection, self).request(*args, **kwargs)
+
+        # If gce_params has been set, then update the pageToken with the
+        # nextPageToken so it can be used in the next request.
+        if self.gce_params:
+            if 'nextPageToken' in response.object:
+                self.gce_params['pageToken'] = response.object['nextPageToken']
+            elif 'pageToken' in self.gce_params:
+                del self.gce_params['pageToken']
+            self.gce_params = None
+
+        return response
+
+
 class GKEContainerDriver(KubernetesContainerDriver):
     """
     GCE Node Driver class.
@@ -17,24 +78,13 @@ class GKEContainerDriver(KubernetesContainerDriver):
     objects/strings).  In most cases, passing strings instead of objects will
     result in additional GKE API calls.
     """
-    connectionCls = KubernetesConnection
+    connectionCls = GKEConnection
     api_name = 'google'
     name = "Google Container Engine"
     type = Provider.GKE
     website = 'https://container.googleapis.com'
     supports_clusters = True
 
-    # Google Compute Engine node states are mapped to Libcloud node states
-    # per the following dict. GCE does not have an actual 'stopped' state
-    # but instead uses a 'terminated' state to indicate the node exists
-    # but is not running. In order to better match libcloud, GCE maps this
-    # 'terminated' state to 'STOPPED'.
-    # Also, when a node is deleted from GCE, it no longer exists and instead
-    # will result in a ResourceNotFound error versus returning a placeholder
-    # node in a 'terminated' state.
-    # For more details, please see GCE's docs,
-    # https://cloud.google.com/compute/docs/instances#checkmachinestatus
-
     AUTH_URL = "https://www.googleapis.com/auth/"
 
     BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
@@ -86,12 +136,19 @@ class GKEContainerDriver(KubernetesContainerDriver):
         self.credential_file = credential_file or \
             GoogleOAuth2Credential.default_credential_file + '.' + self.project
 
-        super(GKEContainerDriver, self).__init__(user_id, key, host=host, port=port, **kwargs)
+        super(GKEContainerDriver, self).__init__(user_id, key, secure=True, host=None,
+                 port=None, **kwargs)
 
         self.base_path = '/%s/projects/%s' % (API_VERSION,
                                                       self.project)
         self.website = GKEContainerDriver.website
 
+    def _ex_connection_class_kwargs(self):
+        return {'auth_type': self.auth_type,
+                'project': self.project,
+                'scopes': self.scopes,
+                'credential_file': self.credential_file}
+
     def list_clusters(self, zone=None):
         """
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f2227922/libcloud/container/drivers/kubernetes.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/kubernetes.py b/libcloud/container/drivers/kubernetes.py
index 92036be..f3c547a 100644
--- a/libcloud/container/drivers/kubernetes.py
+++ b/libcloud/container/drivers/kubernetes.py
@@ -123,26 +123,29 @@ class KubernetesContainerDriver(ContainerDriver):
 
         :return: ``None``
         """
+        print(key, secret)
         super(KubernetesContainerDriver, self).__init__(key=key, secret=secret,
                                                         secure=secure,
                                                         host=host,
                                                         port=port)
-        if host.startswith('https://'):
-            secure = True
 
-        # strip the prefix
-        prefixes = ['http://', 'https://']
-        for prefix in prefixes:
-            if host.startswith(prefix):
-                host = host.strip(prefix)
+        if host is not None:
+            if host.startswith('https://'):
+                secure = True
+
+            # strip the prefix
+            prefixes = ['http://', 'https://']
+            for prefix in prefixes:
+                if host.startswith(prefix):
+                    host = host.strip(prefix)
+
+            self.connection.host = host
+            self.connection.port = port
 
         self.connection.secure = secure
         self.connection.key = key
         self.connection.secret = secret
 
-        self.connection.host = host
-        self.connection.port = port
-
     def list_containers(self, image=None, all=True):
         """
         List the deployed container images


[31/34] libcloud git commit: test update

Posted by an...@apache.org.
test update


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1b0f5ba6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1b0f5ba6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1b0f5ba6

Branch: refs/heads/trunk
Commit: 1b0f5ba6fed74501196d15efbf8c6cdb37a8853a
Parents: f3d8b06
Author: andy <an...@gmail.com>
Authored: Wed Jun 21 21:26:43 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Wed Jun 21 21:26:43 2017 -0400

----------------------------------------------------------------------
 libcloud/test/container/test_gke.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1b0f5ba6/libcloud/test/container/test_gke.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py
index 0e6e7a6..e909e83 100644
--- a/libcloud/test/container/test_gke.py
+++ b/libcloud/test/container/test_gke.py
@@ -18,7 +18,7 @@ Tests for Google Container Engine Driver
 
 import sys
 import unittest
-import json
+
 from libcloud.utils.py3 import httplib
 from libcloud.container.drivers.gke import GKEContainerDriver, API_VERSION
 from libcloud.common.google import (GoogleBaseAuthConnection)
@@ -51,8 +51,8 @@ class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin):
 
     def test_list_images_response(self):
         config = self.driver.list_clusters(ex_zone="us-central1-a")
-        assert "clusters" in config
-        assert config["clusters"][0]["zone"] == "us-central1-a"
+        assert "zone" in config
+        assert config.zone == "us-central1-a"
 
     def test_server_config(self):
         config = self.driver.get_server_config()


[28/34] libcloud git commit: fixing for parameter name change

Posted by an...@apache.org.
fixing for parameter name change


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8968313a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8968313a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8968313a

Branch: refs/heads/trunk
Commit: 8968313a008526679915c5416c07cc33c14bf6f1
Parents: 1ed137b
Author: andy <an...@gmail.com>
Authored: Tue Jun 20 08:41:02 2017 -0400
Committer: andy <an...@gmail.com>
Committed: Tue Jun 20 08:41:02 2017 -0400

----------------------------------------------------------------------
 libcloud/container/drivers/gke.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8968313a/libcloud/container/drivers/gke.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/gke.py b/libcloud/container/drivers/gke.py
index f95ddf7..9c678f8 100644
--- a/libcloud/container/drivers/gke.py
+++ b/libcloud/container/drivers/gke.py
@@ -156,8 +156,8 @@ class GKEContainerDriver(KubernetesContainerDriver):
         :type     ex_zone:  ``str`` or :class:`GCEZone` or
                             :class:`NodeLocation` or ``None``
         """
-        request = "/zones/%s/clusters" % (zone)
-        if zone is None:
+        request = "/zones/%s/clusters" % (ex_zone)
+        if ex_zone is None:
             request = "/zones/clusters"
 
         response = self.connection.request(request, method='GET').object
@@ -171,9 +171,9 @@ class GKEContainerDriver(KubernetesContainerDriver):
         :type     ex_zone:  ``str`` or :class:`GCEZone` or
                             :class:`NodeLocation` or ``None``
         """
-        if zone is None:
-            zone = self.zone
-        request = "/zones/%s/serverconfig" % (zone)
+        if ex_zone is None:
+            ex_zone = self.zone
+        request = "/zones/%s/serverconfig" % (ex_zone)
 
         response = self.connection.request(request, method='GET').object
         return response