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
8db551f6
Commit
8db551f6
authored
Apr 17, 2016
by
Rudi Chiarito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
golint fixes for aws cloudprovider
parent
f949b24e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
53 deletions
+53
-53
aws.go
pkg/cloudprovider/providers/aws/aws.go
+0
-0
aws_instancegroups.go
pkg/cloudprovider/providers/aws/aws_instancegroups.go
+5
-5
aws_loadbalancer.go
pkg/cloudprovider/providers/aws/aws_loadbalancer.go
+24
-24
aws_routes.go
pkg/cloudprovider/providers/aws/aws_routes.go
+17
-17
aws_test.go
pkg/cloudprovider/providers/aws/aws_test.go
+4
-4
aws_util.go
pkg/volume/aws_ebs/aws_util.go
+2
-2
admission.go
plugin/pkg/admission/persistentvolume/label/admission.go
+1
-1
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
8db551f6
This diff is collapsed.
Click to expand it.
pkg/cloudprovider/providers/aws/aws_instancegroups.go
View file @
8db551f6
...
...
@@ -25,7 +25,7 @@ import (
)
// AWSCloud implements InstanceGroups
var
_
InstanceGroups
=
&
AWS
Cloud
{}
var
_
InstanceGroups
=
&
Cloud
{}
// ResizeInstanceGroup sets the size of the specificed instancegroup Exported
// so it can be used by the e2e tests, which don't want to instantiate a full
...
...
@@ -44,8 +44,8 @@ func ResizeInstanceGroup(asg ASG, instanceGroupName string, size int) error {
// Implement InstanceGroups.ResizeInstanceGroup
// Set the size to the fixed size
func
(
a
*
AWS
Cloud
)
ResizeInstanceGroup
(
instanceGroupName
string
,
size
int
)
error
{
return
ResizeInstanceGroup
(
a
.
asg
,
instanceGroupName
,
size
)
func
(
c
*
Cloud
)
ResizeInstanceGroup
(
instanceGroupName
string
,
size
int
)
error
{
return
ResizeInstanceGroup
(
c
.
asg
,
instanceGroupName
,
size
)
}
// DescribeInstanceGroup gets info about the specified instancegroup
...
...
@@ -72,8 +72,8 @@ func DescribeInstanceGroup(asg ASG, instanceGroupName string) (InstanceGroupInfo
// Implement InstanceGroups.DescribeInstanceGroup
// Queries the cloud provider for information about the specified instance group
func
(
a
*
AWS
Cloud
)
DescribeInstanceGroup
(
instanceGroupName
string
)
(
InstanceGroupInfo
,
error
)
{
return
DescribeInstanceGroup
(
a
.
asg
,
instanceGroupName
)
func
(
c
*
Cloud
)
DescribeInstanceGroup
(
instanceGroupName
string
)
(
InstanceGroupInfo
,
error
)
{
return
DescribeInstanceGroup
(
c
.
asg
,
instanceGroupName
)
}
// awsInstanceGroup implements InstanceGroupInfo
...
...
pkg/cloudprovider/providers/aws/aws_loadbalancer.go
View file @
8db551f6
This diff is collapsed.
Click to expand it.
pkg/cloudprovider/providers/aws/aws_routes.go
View file @
8db551f6
...
...
@@ -25,14 +25,14 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider"
)
func
(
s
*
AWS
Cloud
)
findRouteTable
(
clusterName
string
)
(
*
ec2
.
RouteTable
,
error
)
{
func
(
c
*
Cloud
)
findRouteTable
(
clusterName
string
)
(
*
ec2
.
RouteTable
,
error
)
{
// This should be unnecessary (we already filter on TagNameKubernetesCluster,
// and something is broken if cluster name doesn't match, but anyway...
// TODO: All clouds should be cluster-aware by default
filters
:=
[]
*
ec2
.
Filter
{
newEc2Filter
(
"tag:"
+
TagNameKubernetesCluster
,
clusterName
)}
request
:=
&
ec2
.
DescribeRouteTablesInput
{
Filters
:
s
.
addFilters
(
filters
)}
request
:=
&
ec2
.
DescribeRouteTablesInput
{
Filters
:
c
.
addFilters
(
filters
)}
tables
,
err
:=
s
.
ec2
.
DescribeRouteTables
(
request
)
tables
,
err
:=
c
.
ec2
.
DescribeRouteTables
(
request
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -49,8 +49,8 @@ func (s *AWSCloud) findRouteTable(clusterName string) (*ec2.RouteTable, error) {
// ListRoutes implements Routes.ListRoutes
// List all routes that match the filter
func
(
s
*
AWS
Cloud
)
ListRoutes
(
clusterName
string
)
([]
*
cloudprovider
.
Route
,
error
)
{
table
,
err
:=
s
.
findRouteTable
(
clusterName
)
func
(
c
*
Cloud
)
ListRoutes
(
clusterName
string
)
([]
*
cloudprovider
.
Route
,
error
)
{
table
,
err
:=
c
.
findRouteTable
(
clusterName
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -68,7 +68,7 @@ func (s *AWSCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error
instanceIDs
=
append
(
instanceIDs
,
&
instanceID
)
}
instances
,
err
:=
s
.
getInstancesByIDs
(
instanceIDs
)
instances
,
err
:=
c
.
getInstancesByIDs
(
instanceIDs
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -95,12 +95,12 @@ func (s *AWSCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error
}
// Sets the instance attribute "source-dest-check" to the specified value
func
(
s
*
AWS
Cloud
)
configureInstanceSourceDestCheck
(
instanceID
string
,
sourceDestCheck
bool
)
error
{
func
(
c
*
Cloud
)
configureInstanceSourceDestCheck
(
instanceID
string
,
sourceDestCheck
bool
)
error
{
request
:=
&
ec2
.
ModifyInstanceAttributeInput
{}
request
.
InstanceId
=
aws
.
String
(
instanceID
)
request
.
SourceDestCheck
=
&
ec2
.
AttributeBooleanValue
{
Value
:
aws
.
Bool
(
sourceDestCheck
)}
_
,
err
:=
s
.
ec2
.
ModifyInstanceAttribute
(
request
)
_
,
err
:=
c
.
ec2
.
ModifyInstanceAttribute
(
request
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error configuring source-dest-check on instance %s: %v"
,
instanceID
,
err
)
}
...
...
@@ -109,20 +109,20 @@ func (s *AWSCloud) configureInstanceSourceDestCheck(instanceID string, sourceDes
// CreateRoute implements Routes.CreateRoute
// Create the described route
func
(
s
*
AWS
Cloud
)
CreateRoute
(
clusterName
string
,
nameHint
string
,
route
*
cloudprovider
.
Route
)
error
{
instance
,
err
:=
s
.
getInstanceByNodeName
(
route
.
TargetInstance
)
func
(
c
*
Cloud
)
CreateRoute
(
clusterName
string
,
nameHint
string
,
route
*
cloudprovider
.
Route
)
error
{
instance
,
err
:=
c
.
getInstanceByNodeName
(
route
.
TargetInstance
)
if
err
!=
nil
{
return
err
}
// In addition to configuring the route itself, we also need to configure the instance to accept that traffic
// On AWS, this requires turning source-dest checks off
err
=
s
.
configureInstanceSourceDestCheck
(
orEmpty
(
instance
.
InstanceId
),
false
)
err
=
c
.
configureInstanceSourceDestCheck
(
orEmpty
(
instance
.
InstanceId
),
false
)
if
err
!=
nil
{
return
err
}
table
,
err
:=
s
.
findRouteTable
(
clusterName
)
table
,
err
:=
c
.
findRouteTable
(
clusterName
)
if
err
!=
nil
{
return
err
}
...
...
@@ -147,7 +147,7 @@ func (s *AWSCloud) CreateRoute(clusterName string, nameHint string, route *cloud
request
.
DestinationCidrBlock
=
deleteRoute
.
DestinationCidrBlock
request
.
RouteTableId
=
table
.
RouteTableId
_
,
err
=
s
.
ec2
.
DeleteRoute
(
request
)
_
,
err
=
c
.
ec2
.
DeleteRoute
(
request
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error deleting blackholed AWS route (%s): %v"
,
aws
.
StringValue
(
deleteRoute
.
DestinationCidrBlock
),
err
)
}
...
...
@@ -159,7 +159,7 @@ func (s *AWSCloud) CreateRoute(clusterName string, nameHint string, route *cloud
request
.
InstanceId
=
instance
.
InstanceId
request
.
RouteTableId
=
table
.
RouteTableId
_
,
err
=
s
.
ec2
.
CreateRoute
(
request
)
_
,
err
=
c
.
ec2
.
CreateRoute
(
request
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error creating AWS route (%s): %v"
,
route
.
DestinationCIDR
,
err
)
}
...
...
@@ -169,8 +169,8 @@ func (s *AWSCloud) CreateRoute(clusterName string, nameHint string, route *cloud
// DeleteRoute implements Routes.DeleteRoute
// Delete the specified route
func
(
s
*
AWS
Cloud
)
DeleteRoute
(
clusterName
string
,
route
*
cloudprovider
.
Route
)
error
{
table
,
err
:=
s
.
findRouteTable
(
clusterName
)
func
(
c
*
Cloud
)
DeleteRoute
(
clusterName
string
,
route
*
cloudprovider
.
Route
)
error
{
table
,
err
:=
c
.
findRouteTable
(
clusterName
)
if
err
!=
nil
{
return
err
}
...
...
@@ -179,7 +179,7 @@ func (s *AWSCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) e
request
.
DestinationCidrBlock
=
aws
.
String
(
route
.
DestinationCIDR
)
request
.
RouteTableId
=
table
.
RouteTableId
_
,
err
=
s
.
ec2
.
DeleteRoute
(
request
)
_
,
err
=
c
.
ec2
.
DeleteRoute
(
request
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error deleting AWS route (%s): %v"
,
route
.
DestinationCIDR
,
err
)
}
...
...
pkg/cloudprovider/providers/aws/aws_test.go
View file @
8db551f6
...
...
@@ -43,7 +43,7 @@ func TestReadAWSCloudConfig(t *testing.T) {
name
string
reader
io
.
Reader
aws
AWS
Services
aws
Services
expectError
bool
zone
string
...
...
@@ -198,7 +198,7 @@ func TestNewAWSCloud(t *testing.T) {
name
string
reader
io
.
Reader
awsServices
AWS
Services
awsServices
Services
expectError
bool
region
string
...
...
@@ -508,7 +508,7 @@ func (a *FakeASG) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGrou
panic
(
"Not implemented"
)
}
func
mockInstancesResp
(
selfInstance
*
ec2
.
Instance
,
instances
[]
*
ec2
.
Instance
)
(
*
AWS
Cloud
,
*
FakeAWSServices
)
{
func
mockInstancesResp
(
selfInstance
*
ec2
.
Instance
,
instances
[]
*
ec2
.
Instance
)
(
*
Cloud
,
*
FakeAWSServices
)
{
awsServices
:=
NewFakeAWSServices
()
awsServices
.
instances
=
instances
awsServices
.
selfInstance
=
selfInstance
...
...
@@ -519,7 +519,7 @@ func mockInstancesResp(selfInstance *ec2.Instance, instances []*ec2.Instance) (*
return
awsCloud
,
awsServices
}
func
mockAvailabilityZone
(
availabilityZone
string
)
*
AWS
Cloud
{
func
mockAvailabilityZone
(
availabilityZone
string
)
*
Cloud
{
awsServices
:=
NewFakeAWSServices
()
.
withAz
(
availabilityZone
)
awsCloud
,
err
:=
newAWSCloud
(
nil
,
awsServices
)
if
err
!=
nil
{
...
...
pkg/volume/aws_ebs/aws_util.go
View file @
8db551f6
...
...
@@ -166,8 +166,8 @@ func pathExists(path string) (bool, error) {
}
// Return cloud provider
func
getCloudProvider
(
cloudProvider
cloudprovider
.
Interface
)
(
*
aws
.
AWS
Cloud
,
error
)
{
awsCloudProvider
,
ok
:=
cloudProvider
.
(
*
aws
.
AWS
Cloud
)
func
getCloudProvider
(
cloudProvider
cloudprovider
.
Interface
)
(
*
aws
.
Cloud
,
error
)
{
awsCloudProvider
,
ok
:=
cloudProvider
.
(
*
aws
.
Cloud
)
if
!
ok
||
awsCloudProvider
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to get AWS Cloud Provider. GetCloudProvider returned %v instead"
,
cloudProvider
)
}
...
...
plugin/pkg/admission/persistentvolume/label/admission.go
View file @
8db551f6
...
...
@@ -136,7 +136,7 @@ func (l *persistentVolumeLabel) getEBSVolumes() (aws.Volumes, error) {
if
err
!=
nil
||
cloudProvider
==
nil
{
return
nil
,
err
}
awsCloudProvider
,
ok
:=
cloudProvider
.
(
*
aws
.
AWS
Cloud
)
awsCloudProvider
,
ok
:=
cloudProvider
.
(
*
aws
.
Cloud
)
if
!
ok
{
// GetCloudProvider has gone very wrong
return
nil
,
fmt
.
Errorf
(
"error retrieving AWS cloud provider"
)
...
...
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