Move GCECloud into its own pkg

pull/6/head
Tim Hockin 2014-08-19 15:34:35 -07:00
parent 95e0be9a63
commit b23bef26eb
3 changed files with 11 additions and 9 deletions

View File

@ -28,6 +28,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" "github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/gce"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" "github.com/GoogleCloudPlatform/kubernetes/pkg/master"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/util"
verflag "github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag" verflag "github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag"
@ -79,7 +80,7 @@ func main() {
switch *cloudProvider { switch *cloudProvider {
case "gce": case "gce":
var err error var err error
cloud, err = cloudprovider.NewGCECloud() cloud, err = gce_cloud.NewGCECloud()
if err != nil { if err != nil {
glog.Fatalf("Couldn't connect to GCE cloud: %#v", err) glog.Fatalf("Couldn't connect to GCE cloud: %#v", err)
} }

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package cloudprovider package gce_cloud
import ( import (
"fmt" "fmt"
@ -28,6 +28,7 @@ import (
"code.google.com/p/goauth2/compute/serviceaccount" "code.google.com/p/goauth2/compute/serviceaccount"
compute "code.google.com/p/google-api-go-client/compute/v1" compute "code.google.com/p/google-api-go-client/compute/v1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
) )
// GCECloud is an implementation of Interface, TCPLoadBalancer and Instances for Google Compute Engine. // GCECloud is an implementation of Interface, TCPLoadBalancer and Instances for Google Compute Engine.
@ -84,17 +85,17 @@ func NewGCECloud() (*GCECloud, error) {
} }
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine. // TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine.
func (gce *GCECloud) TCPLoadBalancer() (TCPLoadBalancer, bool) { func (gce *GCECloud) TCPLoadBalancer() (cloudprovider.TCPLoadBalancer, bool) {
return gce, true return gce, true
} }
// Instances returns an implementation of Instances for Google Compute Engine. // Instances returns an implementation of Instances for Google Compute Engine.
func (gce *GCECloud) Instances() (Instances, bool) { func (gce *GCECloud) Instances() (cloudprovider.Instances, bool) {
return gce, true return gce, true
} }
// Zones returns an implementation of Zones for Google Compute Engine. // Zones returns an implementation of Zones for Google Compute Engine.
func (gce *GCECloud) Zones() (Zones, bool) { func (gce *GCECloud) Zones() (cloudprovider.Zones, bool) {
return gce, true return gce, true
} }
@ -237,12 +238,12 @@ func (gce *GCECloud) List(filter string) ([]string, error) {
return instances, nil return instances, nil
} }
func (gce *GCECloud) GetZone() (Zone, error) { func (gce *GCECloud) GetZone() (cloudprovider.Zone, error) {
region, err := getGceRegion(gce.zone) region, err := getGceRegion(gce.zone)
if err != nil { if err != nil {
return Zone{}, err return cloudprovider.Zone{}, err
} }
return Zone{ return cloudprovider.Zone{
FailureDomain: gce.zone, FailureDomain: gce.zone,
Region: region, Region: region,
}, nil }, nil

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package cloudprovider package gce_cloud
import ( import (
"testing" "testing"