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
6b16f80d
Commit
6b16f80d
authored
Feb 16, 2015
by
Federico Simoncelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aws: report the nodes external id
Signed-off-by:
Federico Simoncelli
<
fsimonce@redhat.com
>
parent
1fc56aa0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
aws.go
pkg/cloudprovider/aws/aws.go
+23
-11
No files found.
pkg/cloudprovider/aws/aws.go
View file @
6b16f80d
...
@@ -122,6 +122,28 @@ func (aws *AWSCloud) Zones() (cloudprovider.Zones, bool) {
...
@@ -122,6 +122,28 @@ func (aws *AWSCloud) Zones() (cloudprovider.Zones, bool) {
// IPAddress is an implementation of Instances.IPAddress.
// IPAddress is an implementation of Instances.IPAddress.
func
(
aws
*
AWSCloud
)
IPAddress
(
name
string
)
(
net
.
IP
,
error
)
{
func
(
aws
*
AWSCloud
)
IPAddress
(
name
string
)
(
net
.
IP
,
error
)
{
inst
,
err
:=
aws
.
getInstancesByDnsName
(
name
)
if
err
!=
nil
{
return
nil
,
err
}
ip
:=
net
.
ParseIP
(
inst
.
PrivateIpAddress
)
if
ip
==
nil
{
return
nil
,
fmt
.
Errorf
(
"invalid network IP: %s"
,
inst
.
PrivateIpAddress
)
}
return
ip
,
nil
}
// ExternalID returns the cloud provider ID of the specified instance.
func
(
aws
*
AWSCloud
)
ExternalID
(
name
string
)
(
string
,
error
)
{
inst
,
err
:=
aws
.
getInstancesByDnsName
(
name
)
if
err
!=
nil
{
return
""
,
err
}
return
inst
.
InstanceId
,
nil
}
// Return the instances matching the relevant private dns name.
func
(
aws
*
AWSCloud
)
getInstancesByDnsName
(
name
string
)
(
*
ec2
.
Instance
,
error
)
{
f
:=
ec2
.
NewFilter
()
f
:=
ec2
.
NewFilter
()
f
.
Add
(
"private-dns-name"
,
name
)
f
.
Add
(
"private-dns-name"
,
name
)
...
@@ -142,17 +164,7 @@ func (aws *AWSCloud) IPAddress(name string) (net.IP, error) {
...
@@ -142,17 +164,7 @@ func (aws *AWSCloud) IPAddress(name string) (net.IP, error) {
return
nil
,
fmt
.
Errorf
(
"multiple instances found for host: %s"
,
name
)
return
nil
,
fmt
.
Errorf
(
"multiple instances found for host: %s"
,
name
)
}
}
ipAddress
:=
resp
.
Reservations
[
0
]
.
Instances
[
0
]
.
PrivateIpAddress
return
&
resp
.
Reservations
[
0
]
.
Instances
[
0
],
nil
ip
:=
net
.
ParseIP
(
ipAddress
)
if
ip
==
nil
{
return
nil
,
fmt
.
Errorf
(
"invalid network IP: %s"
,
ipAddress
)
}
return
ip
,
nil
}
// ExternalID returns the cloud provider ID of the specified instance.
func
(
aws
*
AWSCloud
)
ExternalID
(
name
string
)
(
string
,
error
)
{
return
""
,
fmt
.
Errorf
(
"unimplemented"
)
}
}
// Return a list of instances matching regex string.
// Return a list of instances matching regex string.
...
...
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