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
ff7ce44e
Commit
ff7ce44e
authored
Oct 18, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14517 from jayunit100/reorder
Auto commit by PR queue bot
parents
578d7521
a2f99577
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
controller.go
pkg/master/controller.go
+8
-4
No files found.
pkg/master/controller.go
View file @
ff7ce44e
...
@@ -248,18 +248,22 @@ func (c *Controller) SetEndpoints(serviceName string, ip net.IP, endpointPorts [
...
@@ -248,18 +248,22 @@ func (c *Controller) SetEndpoints(serviceName string, ip net.IP, endpointPorts [
glog
.
Warningf
(
"Resetting endpoints for master service %q to %v"
,
serviceName
,
e
)
glog
.
Warningf
(
"Resetting endpoints for master service %q to %v"
,
serviceName
,
e
)
return
c
.
EndpointRegistry
.
UpdateEndpoints
(
ctx
,
e
)
return
c
.
EndpointRegistry
.
UpdateEndpoints
(
ctx
,
e
)
}
else
if
!
ipCorrect
{
}
else
if
!
ipCorrect
{
// We *always* add our own IP address; if there are too many IP
// We *always* add our own IP address.
// addresses, we remove the ones lexicographically after our
e
.
Subsets
[
0
]
.
Addresses
=
append
(
e
.
Subsets
[
0
]
.
Addresses
,
api
.
EndpointAddress
{
IP
:
ip
.
String
()})
// Lexicographic order is retained by this step.
e
.
Subsets
=
endpoints
.
RepackSubsets
(
e
.
Subsets
)
// If too many IP addresses, remove the ones lexicographically after our
// own IP address. Given the requirements stated at the top of
// own IP address. Given the requirements stated at the top of
// this function, this should cause the list of IP addresses to
// this function, this should cause the list of IP addresses to
// become eventually correct.
// become eventually correct.
e
.
Subsets
[
0
]
.
Addresses
=
append
(
e
.
Subsets
[
0
]
.
Addresses
,
api
.
EndpointAddress
{
IP
:
ip
.
String
()})
e
.
Subsets
=
endpoints
.
RepackSubsets
(
e
.
Subsets
)
if
addrs
:=
&
e
.
Subsets
[
0
]
.
Addresses
;
len
(
*
addrs
)
>
c
.
MasterCount
{
if
addrs
:=
&
e
.
Subsets
[
0
]
.
Addresses
;
len
(
*
addrs
)
>
c
.
MasterCount
{
// addrs is a pointer because we're going to mutate it.
// addrs is a pointer because we're going to mutate it.
for
i
,
addr
:=
range
*
addrs
{
for
i
,
addr
:=
range
*
addrs
{
if
addr
.
IP
==
ip
.
String
()
{
if
addr
.
IP
==
ip
.
String
()
{
for
len
(
*
addrs
)
>
c
.
MasterCount
{
for
len
(
*
addrs
)
>
c
.
MasterCount
{
// wrap around if necessary.
remove
:=
(
i
+
1
)
%
len
(
*
addrs
)
remove
:=
(
i
+
1
)
%
len
(
*
addrs
)
*
addrs
=
append
((
*
addrs
)[
:
remove
],
(
*
addrs
)[
remove
+
1
:
]
...
)
*
addrs
=
append
((
*
addrs
)[
:
remove
],
(
*
addrs
)[
remove
+
1
:
]
...
)
}
}
...
...
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