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
068edd79
Commit
068edd79
authored
Sep 07, 2017
by
Nick Sardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bubble reservation error to the user when the address is specified.
parent
42e2ca8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
gce_address_manager.go
pkg/cloudprovider/providers/gce/gce_address_manager.go
+7
-7
No files found.
pkg/cloudprovider/providers/gce/gce_address_manager.go
View file @
068edd79
...
...
@@ -126,8 +126,8 @@ func (am *addressManager) ensureAddressReservation() (string, error) {
Subnetwork
:
am
.
subnetURL
,
}
e
rr
:=
am
.
svc
.
ReserveBetaRegionAddress
(
newAddr
,
am
.
region
)
if
e
rr
==
nil
{
reserveE
rr
:=
am
.
svc
.
ReserveBetaRegionAddress
(
newAddr
,
am
.
region
)
if
reserveE
rr
==
nil
{
if
newAddr
.
Address
!=
""
{
glog
.
V
(
4
)
.
Infof
(
"%v: successfully reserved IP %q with name %q"
,
am
.
logPrefix
,
newAddr
.
Address
,
newAddr
.
Name
)
return
newAddr
.
Address
,
nil
...
...
@@ -140,24 +140,24 @@ func (am *addressManager) ensureAddressReservation() (string, error) {
glog
.
V
(
4
)
.
Infof
(
"%v: successfully created address %q which reserved IP %q"
,
am
.
logPrefix
,
addr
.
Name
,
addr
.
Address
)
return
addr
.
Address
,
nil
}
else
if
!
isHTTPErrorCode
(
err
,
http
.
StatusConflict
)
&&
!
isHTTPErrorCode
(
e
rr
,
http
.
StatusBadRequest
)
{
}
else
if
!
isHTTPErrorCode
(
reserveErr
,
http
.
StatusConflict
)
&&
!
isHTTPErrorCode
(
reserveE
rr
,
http
.
StatusBadRequest
)
{
// If the IP is already reserved:
// by an internal address: a StatusConflict is returned
// by an external address: a BadRequest is returned
return
""
,
e
rr
return
""
,
reserveE
rr
}
// If the target IP was empty, we cannot try to find which IP caused a conflict.
// If the name was already used, then the next sync will attempt deletion of that address.
if
am
.
targetIP
==
""
{
return
""
,
fmt
.
Errorf
(
"failed to reserve address %q
, err: %v"
,
am
.
name
,
e
rr
)
return
""
,
fmt
.
Errorf
(
"failed to reserve address %q
with no specific IP, err: %v"
,
am
.
name
,
reserveE
rr
)
}
// Reserving the address failed due to a conflict or bad request. The address manager just checked that no address
// exists with the name, so it may belong to the user.
addr
,
err
:=
am
.
svc
.
GetBetaRegionAddressByIP
(
am
.
region
,
am
.
targetIP
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"
could not find address with IP %q after getting conflict error while creating address: %q"
,
am
.
targetIP
,
e
rr
)
return
""
,
fmt
.
Errorf
(
"
failed to get address by IP %q after reservation attempt, err: %q, reservation err: %q"
,
am
.
targetIP
,
err
,
reserveE
rr
)
}
// Check that the address attributes are as required.
...
...
@@ -170,7 +170,7 @@ func (am *addressManager) ensureAddressReservation() (string, error) {
// it was re-created by this point. May be possible that two controllers are running.
glog
.
Warning
(
"%v: address %q unexpectedly existed with IP %q."
,
am
.
logPrefix
,
addr
.
Name
,
am
.
targetIP
)
}
else
{
// If the retrieved address is not named with the loadbalancer name, then the controller does not own it.
// If the retrieved address is not named with the loadbalancer name, then the controller does not own it
, but will allow use of it
.
glog
.
V
(
4
)
.
Infof
(
"%v: address %q was already reserved with name: %q, description: %q"
,
am
.
logPrefix
,
am
.
targetIP
,
addr
.
Name
,
addr
.
Description
)
am
.
tryRelease
=
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