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
4b0f2ab4
Commit
4b0f2ab4
authored
Nov 28, 2018
by
andrewsykim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile check to ensure cloud providers implement cloud interfaces
parent
6be4f1bb
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
58 additions
and
9 deletions
+58
-9
aws.go
pkg/cloudprovider/providers/aws/aws.go
+7
-3
azure.go
pkg/cloudprovider/providers/azure/azure.go
+7
-3
cloudstack.go
pkg/cloudprovider/providers/cloudstack/cloudstack.go
+5
-0
metadata.go
pkg/cloudprovider/providers/cloudstack/metadata.go
+3
-0
fake.go
pkg/cloudprovider/providers/fake/fake.go
+8
-0
gce.go
pkg/cloudprovider/providers/gce/gce.go
+8
-3
openstack.go
pkg/cloudprovider/providers/openstack/openstack.go
+3
-0
openstack_instances.go
pkg/cloudprovider/providers/openstack/openstack_instances.go
+2
-0
openstack_loadbalancer.go
...oudprovider/providers/openstack/openstack_loadbalancer.go
+2
-0
openstack_routes.go
pkg/cloudprovider/providers/openstack/openstack_routes.go
+2
-0
ovirt.go
pkg/cloudprovider/providers/ovirt/ovirt.go
+3
-0
photon.go
pkg/cloudprovider/providers/photon/photon.go
+4
-0
vsphere.go
pkg/cloudprovider/providers/vsphere/vsphere.go
+4
-0
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
4b0f2ab4
...
@@ -261,9 +261,6 @@ const DefaultVolumeType = "gp2"
...
@@ -261,9 +261,6 @@ const DefaultVolumeType = "gp2"
// Used to call recognizeWellKnownRegions just once
// Used to call recognizeWellKnownRegions just once
var
once
sync
.
Once
var
once
sync
.
Once
// AWS implements PVLabeler.
var
_
cloudprovider
.
PVLabeler
=
(
*
Cloud
)(
nil
)
// Services is an abstraction over AWS, to allow mocking/other implementations
// Services is an abstraction over AWS, to allow mocking/other implementations
type
Services
interface
{
type
Services
interface
{
Compute
(
region
string
)
(
EC2
,
error
)
Compute
(
region
string
)
(
EC2
,
error
)
...
@@ -480,6 +477,13 @@ type InstanceGroupInfo interface {
...
@@ -480,6 +477,13 @@ type InstanceGroupInfo interface {
CurrentSize
()
(
int
,
error
)
CurrentSize
()
(
int
,
error
)
}
}
var
_
cloudprovider
.
Interface
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Routes
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
PVLabeler
=
(
*
Cloud
)(
nil
)
// Cloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services.
// Cloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services.
type
Cloud
struct
{
type
Cloud
struct
{
ec2
EC2
ec2
EC2
...
...
pkg/cloudprovider/providers/azure/azure.go
View file @
4b0f2ab4
...
@@ -71,9 +71,6 @@ var (
...
@@ -71,9 +71,6 @@ var (
defaultExcludeMasterFromStandardLB
=
true
defaultExcludeMasterFromStandardLB
=
true
)
)
// Azure implements PVLabeler.
var
_
cloudprovider
.
PVLabeler
=
(
*
Cloud
)(
nil
)
// Config holds the configuration parsed from the --cloud-config flag
// Config holds the configuration parsed from the --cloud-config flag
// All fields are required unless otherwise specified
// All fields are required unless otherwise specified
type
Config
struct
{
type
Config
struct
{
...
@@ -143,6 +140,13 @@ type Config struct {
...
@@ -143,6 +140,13 @@ type Config struct {
MaximumLoadBalancerRuleCount
int
`json:"maximumLoadBalancerRuleCount" yaml:"maximumLoadBalancerRuleCount"`
MaximumLoadBalancerRuleCount
int
`json:"maximumLoadBalancerRuleCount" yaml:"maximumLoadBalancerRuleCount"`
}
}
var
_
cloudprovider
.
Interface
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Routes
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
PVLabeler
=
(
*
Cloud
)(
nil
)
// Cloud holds the config and clients
// Cloud holds the config and clients
type
Cloud
struct
{
type
Cloud
struct
{
Config
Config
...
...
pkg/cloudprovider/providers/cloudstack/cloudstack.go
View file @
4b0f2ab4
...
@@ -120,6 +120,11 @@ func newCSCloud(cfg *CSConfig) (*CSCloud, error) {
...
@@ -120,6 +120,11 @@ func newCSCloud(cfg *CSConfig) (*CSCloud, error) {
return
cs
,
nil
return
cs
,
nil
}
}
var
_
cloudprovider
.
Interface
=
(
*
CSCloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
CSCloud
)(
nil
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
CSCloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
CSCloud
)(
nil
)
// Initialize passes a Kubernetes clientBuilder interface to the cloud provider
// Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func
(
cs
*
CSCloud
)
Initialize
(
clientBuilder
cloudprovider
.
ControllerClientBuilder
,
stop
<-
chan
struct
{})
{
func
(
cs
*
CSCloud
)
Initialize
(
clientBuilder
cloudprovider
.
ControllerClientBuilder
,
stop
<-
chan
struct
{})
{
}
}
...
...
pkg/cloudprovider/providers/cloudstack/metadata.go
View file @
4b0f2ab4
...
@@ -31,6 +31,9 @@ import (
...
@@ -31,6 +31,9 @@ import (
"k8s.io/klog"
"k8s.io/klog"
)
)
var
_
cloudprovider
.
Instances
=
(
*
metadata
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
metadata
)(
nil
)
type
metadata
struct
{
type
metadata
struct
{
dhcpServer
string
dhcpServer
string
zone
string
zone
string
...
...
pkg/cloudprovider/providers/fake/fake.go
View file @
4b0f2ab4
...
@@ -45,6 +45,14 @@ type FakeUpdateBalancerCall struct {
...
@@ -45,6 +45,14 @@ type FakeUpdateBalancerCall struct {
Hosts
[]
*
v1
.
Node
Hosts
[]
*
v1
.
Node
}
}
var
_
cloudprovider
.
Interface
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
Routes
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
PVLabeler
=
(
*
FakeCloud
)(
nil
)
var
_
cloudprovider
.
Clusters
=
(
*
FakeCloud
)(
nil
)
// FakeCloud is a test-double implementation of Interface, LoadBalancer, Instances, and Routes. It is useful for testing.
// FakeCloud is a test-double implementation of Interface, LoadBalancer, Instances, and Routes. It is useful for testing.
type
FakeCloud
struct
{
type
FakeCloud
struct
{
Exists
bool
Exists
bool
...
...
pkg/cloudprovider/providers/gce/gce.go
View file @
4b0f2ab4
...
@@ -98,6 +98,14 @@ type gceObject interface {
...
@@ -98,6 +98,14 @@ type gceObject interface {
MarshalJSON
()
([]
byte
,
error
)
MarshalJSON
()
([]
byte
,
error
)
}
}
var
_
cloudprovider
.
Interface
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Routes
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
PVLabeler
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Clusters
=
(
*
Cloud
)(
nil
)
// Cloud is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
// Cloud is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
type
Cloud
struct
{
type
Cloud
struct
{
// ClusterID contains functionality for getting (and initializing) the ingress-uid. Call Cloud.Initialize()
// ClusterID contains functionality for getting (and initializing) the ingress-uid. Call Cloud.Initialize()
...
@@ -765,9 +773,6 @@ func isProjectNumber(idOrNumber string) bool {
...
@@ -765,9 +773,6 @@ func isProjectNumber(idOrNumber string) bool {
return
err
==
nil
return
err
==
nil
}
}
// Cloud implements cloudprovider.Interface.
var
_
cloudprovider
.
Interface
=
(
*
Cloud
)(
nil
)
func
gceNetworkURL
(
apiEndpoint
,
project
,
network
string
)
string
{
func
gceNetworkURL
(
apiEndpoint
,
project
,
network
string
)
string
{
if
apiEndpoint
==
""
{
if
apiEndpoint
==
""
{
apiEndpoint
=
gceComputeAPIEndpoint
apiEndpoint
=
gceComputeAPIEndpoint
...
...
pkg/cloudprovider/providers/openstack/openstack.go
View file @
4b0f2ab4
...
@@ -126,6 +126,9 @@ type MetadataOpts struct {
...
@@ -126,6 +126,9 @@ type MetadataOpts struct {
RequestTimeout
MyDuration
`gcfg:"request-timeout"`
RequestTimeout
MyDuration
`gcfg:"request-timeout"`
}
}
var
_
cloudprovider
.
Interface
=
(
*
OpenStack
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
OpenStack
)(
nil
)
// OpenStack is an implementation of cloud provider Interface for OpenStack.
// OpenStack is an implementation of cloud provider Interface for OpenStack.
type
OpenStack
struct
{
type
OpenStack
struct
{
provider
*
gophercloud
.
ProviderClient
provider
*
gophercloud
.
ProviderClient
...
...
pkg/cloudprovider/providers/openstack/openstack_instances.go
View file @
4b0f2ab4
...
@@ -30,6 +30,8 @@ import (
...
@@ -30,6 +30,8 @@ import (
cloudprovider
"k8s.io/cloud-provider"
cloudprovider
"k8s.io/cloud-provider"
)
)
var
_
cloudprovider
.
Instances
=
(
*
Instances
)(
nil
)
// Instances encapsulates an implementation of Instances for OpenStack.
// Instances encapsulates an implementation of Instances for OpenStack.
type
Instances
struct
{
type
Instances
struct
{
compute
*
gophercloud
.
ServiceClient
compute
*
gophercloud
.
ServiceClient
...
...
pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go
View file @
4b0f2ab4
...
@@ -78,6 +78,8 @@ const (
...
@@ -78,6 +78,8 @@ const (
ServiceAnnotationLoadBalancerInternal
=
"service.beta.kubernetes.io/openstack-internal-load-balancer"
ServiceAnnotationLoadBalancerInternal
=
"service.beta.kubernetes.io/openstack-internal-load-balancer"
)
)
var
_
cloudprovider
.
LoadBalancer
=
(
*
LbaasV2
)(
nil
)
// LbaasV2 is a LoadBalancer implementation for Neutron LBaaS v2 API
// LbaasV2 is a LoadBalancer implementation for Neutron LBaaS v2 API
type
LbaasV2
struct
{
type
LbaasV2
struct
{
LoadBalancer
LoadBalancer
...
...
pkg/cloudprovider/providers/openstack/openstack_routes.go
View file @
4b0f2ab4
...
@@ -33,6 +33,8 @@ import (
...
@@ -33,6 +33,8 @@ import (
var
errNoRouterID
=
errors
.
New
(
"router-id not set in cloud provider config"
)
var
errNoRouterID
=
errors
.
New
(
"router-id not set in cloud provider config"
)
var
_
cloudprovider
.
Routes
=
(
*
Routes
)(
nil
)
// Routes implements the cloudprovider.Routes for OpenStack clouds
// Routes implements the cloudprovider.Routes for OpenStack clouds
type
Routes
struct
{
type
Routes
struct
{
compute
*
gophercloud
.
ServiceClient
compute
*
gophercloud
.
ServiceClient
...
...
pkg/cloudprovider/providers/ovirt/ovirt.go
View file @
4b0f2ab4
...
@@ -49,6 +49,9 @@ type Instance struct {
...
@@ -49,6 +49,9 @@ type Instance struct {
// InstanceMap provides the map of Ovirt instances.
// InstanceMap provides the map of Ovirt instances.
type
InstanceMap
map
[
string
]
Instance
type
InstanceMap
map
[
string
]
Instance
var
_
cloudprovider
.
Interface
=
(
*
Cloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
Cloud
)(
nil
)
// Cloud is an implementation of the cloud provider interface for Ovirt.
// Cloud is an implementation of the cloud provider interface for Ovirt.
type
Cloud
struct
{
type
Cloud
struct
{
VmsRequest
*
url
.
URL
VmsRequest
*
url
.
URL
...
...
pkg/cloudprovider/providers/photon/photon.go
View file @
4b0f2ab4
...
@@ -55,6 +55,10 @@ const (
...
@@ -55,6 +55,10 @@ const (
// overrideIP = true in cloud config file. Default value is false.
// overrideIP = true in cloud config file. Default value is false.
var
overrideIP
bool
=
false
var
overrideIP
bool
=
false
var
_
cloudprovider
.
Interface
=
(
*
PCCloud
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
PCCloud
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
PCCloud
)(
nil
)
// Photon is an implementation of the cloud provider interface for Photon Controller.
// Photon is an implementation of the cloud provider interface for Photon Controller.
type
PCCloud
struct
{
type
PCCloud
struct
{
cfg
*
PCConfig
cfg
*
PCConfig
...
...
pkg/cloudprovider/providers/vsphere/vsphere.go
View file @
4b0f2ab4
...
@@ -76,6 +76,10 @@ var (
...
@@ -76,6 +76,10 @@ var (
ErrPasswordMissing
=
errors
.
New
(
MissingPasswordErrMsg
)
ErrPasswordMissing
=
errors
.
New
(
MissingPasswordErrMsg
)
)
)
var
_
cloudprovider
.
Interface
=
(
*
VSphere
)(
nil
)
var
_
cloudprovider
.
Instances
=
(
*
VSphere
)(
nil
)
var
_
cloudprovider
.
Zones
=
(
*
VSphere
)(
nil
)
// VSphere is an implementation of cloud provider Interface for VSphere.
// VSphere is an implementation of cloud provider Interface for VSphere.
type
VSphere
struct
{
type
VSphere
struct
{
cfg
*
VSphereConfig
cfg
*
VSphereConfig
...
...
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