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
2812936d
Commit
2812936d
authored
Mar 27, 2015
by
Justin Santa Barbara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify logic of pd.go
parent
6a4153fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
aws.go
pkg/cloudprovider/aws/aws.go
+3
-3
pd.go
test/e2e/pd.go
+6
-12
No files found.
pkg/cloudprovider/aws/aws.go
View file @
2812936d
...
...
@@ -240,9 +240,9 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc, instanceId string, metadat
ec2
:=
&
goamzEC2
{
ec2
:
ec2
.
New
(
auth
,
region
)}
awsCloud
:=
&
AWSCloud
{
ec2
:
ec2
,
cfg
:
cfg
,
region
:
region
,
ec2
:
ec2
,
cfg
:
cfg
,
region
:
region
,
availabilityZone
:
zone
,
}
...
...
test/e2e/pd.go
View file @
2812936d
...
...
@@ -186,16 +186,14 @@ func createPD() (string, error) {
return
""
,
err
}
return
pdName
,
nil
}
else
if
testContext
.
provider
==
"aws"
{
}
else
{
volumes
,
ok
:=
testContext
.
cloudConfig
.
Provider
.
(
aws_cloud
.
Volumes
)
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"Provider does not
implement volumes interface
"
)
return
""
,
fmt
.
Errorf
(
"Provider does not
support volumes
"
)
}
volumeOptions
:=
&
aws_cloud
.
VolumeOptions
{}
volumeOptions
.
CapacityMB
=
10
*
1024
return
volumes
.
CreateVolume
(
volumeOptions
)
}
else
{
return
""
,
fmt
.
Errorf
(
"Unsupported provider type"
)
}
}
...
...
@@ -205,14 +203,12 @@ func deletePD(pdName string) error {
// TODO: make this hit the compute API directly.
return
exec
.
Command
(
"gcloud"
,
"compute"
,
"disks"
,
"delete"
,
"--zone="
+
zone
,
pdName
)
.
Run
()
}
else
if
testContext
.
provider
==
"aws"
{
}
else
{
volumes
,
ok
:=
testContext
.
cloudConfig
.
Provider
.
(
aws_cloud
.
Volumes
)
if
!
ok
{
return
fmt
.
Errorf
(
"Provider does not implement volumes interface
"
)
return
""
,
fmt
.
Errorf
(
"Provider does not support volumes
"
)
}
return
volumes
.
DeleteVolume
(
pdName
)
}
else
{
return
fmt
.
Errorf
(
"Unsupported provider type"
)
}
}
...
...
@@ -224,14 +220,12 @@ func detachPD(hostName, pdName string) error {
// TODO: make this hit the compute API directly.
return
exec
.
Command
(
"gcloud"
,
"compute"
,
"instances"
,
"detach-disk"
,
"--zone="
+
zone
,
"--disk="
+
pdName
,
instanceName
)
.
Run
()
}
else
if
testContext
.
provider
==
"aws"
{
}
else
{
volumes
,
ok
:=
testContext
.
cloudConfig
.
Provider
.
(
aws_cloud
.
Volumes
)
if
!
ok
{
return
fmt
.
Errorf
(
"Provider does not implement volumes interface
"
)
return
""
,
fmt
.
Errorf
(
"Provider does not support volumes
"
)
}
return
volumes
.
DetachDisk
(
hostName
,
pdName
)
}
else
{
return
fmt
.
Errorf
(
"Unsupported provider type"
)
}
}
...
...
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