Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
aabf1c35
Commit
aabf1c35
authored
Nov 13, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a clusters interface and GCE implementation.
parent
8c358f0c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
1 deletion
+57
-1
aws.go
pkg/cloudprovider/aws/aws.go
+4
-0
cloud.go
pkg/cloudprovider/cloud.go
+10
-0
fake.go
pkg/cloudprovider/fake/fake.go
+4
-1
gce.go
pkg/cloudprovider/gce/gce.go
+27
-0
openstack.go
pkg/cloudprovider/openstack/openstack.go
+4
-0
ovirt.go
pkg/cloudprovider/ovirt/ovirt.go
+4
-0
vagrant.go
pkg/cloudprovider/vagrant/vagrant.go
+4
-0
No files found.
pkg/cloudprovider/aws/aws.go
View file @
aabf1c35
...
@@ -101,6 +101,10 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc) (*AWSCloud, error) {
...
@@ -101,6 +101,10 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc) (*AWSCloud, error) {
},
nil
},
nil
}
}
func
(
aws
*
AWSCloud
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
nil
,
false
}
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Amazon Web Services.
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Amazon Web Services.
func
(
aws
*
AWSCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
aws
*
AWSCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
nil
,
false
return
nil
,
false
...
...
pkg/cloudprovider/cloud.go
View file @
aabf1c35
...
@@ -30,6 +30,16 @@ type Interface interface {
...
@@ -30,6 +30,16 @@ type Interface interface {
Instances
()
(
Instances
,
bool
)
Instances
()
(
Instances
,
bool
)
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
Zones
()
(
Zones
,
bool
)
Zones
()
(
Zones
,
bool
)
// Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
Clusters
()
(
Clusters
,
bool
)
}
// Clusters is an abstract, pluggable interface for clusters of containers.
type
Clusters
interface
{
// List lists the names of the available clusters.
ListClusters
()
([]
string
,
error
)
// Master gets back the address (either DNS name or IP address) of the master node for the cluster.
Master
(
clusterName
string
)
(
string
,
error
)
}
}
// TCPLoadBalancer is an abstract, pluggable interface for TCP load balancers.
// TCPLoadBalancer is an abstract, pluggable interface for TCP load balancers.
...
...
pkg/cloudprovider/fake/fake.go
View file @
aabf1c35
...
@@ -45,8 +45,11 @@ func (f *FakeCloud) ClearCalls() {
...
@@ -45,8 +45,11 @@ func (f *FakeCloud) ClearCalls() {
f
.
Calls
=
[]
string
{}
f
.
Calls
=
[]
string
{}
}
}
func
(
f
*
FakeCloud
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
f
,
true
}
// TCPLoadBalancer returns a fake implementation of TCPLoadBalancer.
// TCPLoadBalancer returns a fake implementation of TCPLoadBalancer.
//
// Actually it just returns f itself.
// Actually it just returns f itself.
func
(
f
*
FakeCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
f
*
FakeCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
f
,
true
return
f
,
true
...
...
pkg/cloudprovider/gce/gce.go
View file @
aabf1c35
...
@@ -30,6 +30,7 @@ import (
...
@@ -30,6 +30,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"
container
"code.google.com/p/google-api-go-client/container/v1beta1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/resources"
"github.com/GoogleCloudPlatform/kubernetes/pkg/resources"
...
@@ -40,6 +41,7 @@ import (
...
@@ -40,6 +41,7 @@ import (
// 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.
type
GCECloud
struct
{
type
GCECloud
struct
{
service
*
compute
.
Service
service
*
compute
.
Service
containerService
*
container
.
Service
projectID
string
projectID
string
zone
string
zone
string
instanceID
string
instanceID
string
...
@@ -115,14 +117,23 @@ func newGCECloud() (*GCECloud, error) {
...
@@ -115,14 +117,23 @@ func newGCECloud() (*GCECloud, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
containerSvc
,
err
:=
container
.
New
(
client
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
GCECloud
{
return
&
GCECloud
{
service
:
svc
,
service
:
svc
,
containerService
:
containerSvc
,
projectID
:
projectID
,
projectID
:
projectID
,
zone
:
zone
,
zone
:
zone
,
instanceID
:
instanceID
,
instanceID
:
instanceID
,
},
nil
},
nil
}
}
func
(
gce
*
GCECloud
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
gce
,
true
}
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine.
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine.
func
(
gce
*
GCECloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
gce
*
GCECloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
gce
,
true
return
gce
,
true
...
@@ -385,3 +396,19 @@ func (gce *GCECloud) convertDiskToAttachedDisk(disk *compute.Disk, readWrite str
...
@@ -385,3 +396,19 @@ func (gce *GCECloud) convertDiskToAttachedDisk(disk *compute.Disk, readWrite str
Type
:
"PERSISTENT"
,
Type
:
"PERSISTENT"
,
}
}
}
}
func
(
gce
*
GCECloud
)
ListClusters
()
([]
string
,
error
)
{
list
,
err
:=
gce
.
containerService
.
Projects
.
Clusters
.
List
(
gce
.
projectID
)
.
Do
()
if
err
!=
nil
{
return
nil
,
err
}
result
:=
[]
string
{}
for
_
,
cluster
:=
range
list
.
Clusters
{
result
=
append
(
result
,
cluster
.
Name
)
}
return
result
,
nil
}
func
(
gce
*
GCECloud
)
Master
(
clusterName
string
)
(
string
,
error
)
{
return
"k8s-"
+
clusterName
+
"-master.internal"
,
nil
}
pkg/cloudprovider/openstack/openstack.go
View file @
aabf1c35
...
@@ -208,6 +208,10 @@ func (i *Instances) GetNodeResources(name string) (*api.NodeResources, error) {
...
@@ -208,6 +208,10 @@ func (i *Instances) GetNodeResources(name string) (*api.NodeResources, error) {
return
rsrc
,
nil
return
rsrc
,
nil
}
}
func
(
aws
*
OpenStack
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
nil
,
false
}
func
(
os
*
OpenStack
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
os
*
OpenStack
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
nil
,
false
return
nil
,
false
}
}
...
...
pkg/cloudprovider/ovirt/ovirt.go
View file @
aabf1c35
...
@@ -95,6 +95,10 @@ func newOVirtCloud(config io.Reader) (*OVirtCloud, error) {
...
@@ -95,6 +95,10 @@ func newOVirtCloud(config io.Reader) (*OVirtCloud, error) {
return
&
OVirtCloud
{
VmsRequest
:
request
},
nil
return
&
OVirtCloud
{
VmsRequest
:
request
},
nil
}
}
func
(
aws
*
OVirtCloud
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
nil
,
false
}
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for oVirt cloud
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for oVirt cloud
func
(
v
*
OVirtCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
v
*
OVirtCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
nil
,
false
return
nil
,
false
...
...
pkg/cloudprovider/vagrant/vagrant.go
View file @
aabf1c35
...
@@ -80,6 +80,10 @@ func newVagrantCloud() (*VagrantCloud, error) {
...
@@ -80,6 +80,10 @@ func newVagrantCloud() (*VagrantCloud, error) {
},
nil
},
nil
}
}
func
(
aws
*
VagrantCloud
)
Clusters
()
(
cloudprovider
.
Clusters
,
bool
)
{
return
nil
,
false
}
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Vagrant cloud.
// TCPLoadBalancer returns an implementation of TCPLoadBalancer for Vagrant cloud.
func
(
v
*
VagrantCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
func
(
v
*
VagrantCloud
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
return
nil
,
false
return
nil
,
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment