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
14f2a335
Commit
14f2a335
authored
Feb 27, 2019
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
endpoint-reconcilers: split stop and remove
parent
0d98463f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
14 deletions
+29
-14
lease.go
pkg/master/reconcilers/lease.go
+7
-5
lease_test.go
pkg/master/reconcilers/lease_test.go
+2
-2
mastercount.go
pkg/master/reconcilers/mastercount.go
+7
-2
none.go
pkg/master/reconcilers/none.go
+7
-3
reconcilers.go
pkg/master/reconcilers/reconcilers.go
+6
-2
No files found.
pkg/master/reconcilers/lease.go
View file @
14f2a335
...
...
@@ -283,14 +283,16 @@ func checkEndpointSubsetFormatWithLease(e *corev1.Endpoints, expectedIPs []strin
return
true
,
ipsCorrect
,
portsCorrect
}
func
(
r
*
leaseEndpointReconciler
)
StopReconciling
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
r
.
reconcilingLock
.
Lock
()
defer
r
.
reconcilingLock
.
Unlock
()
r
.
stopReconcilingCalled
=
true
func
(
r
*
leaseEndpointReconciler
)
RemoveEndpoints
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
if
err
:=
r
.
masterLeases
.
RemoveLease
(
ip
.
String
());
err
!=
nil
{
return
err
}
return
r
.
doReconcile
(
serviceName
,
endpointPorts
,
true
)
}
func
(
r
*
leaseEndpointReconciler
)
StopReconciling
()
{
r
.
reconcilingLock
.
Lock
()
defer
r
.
reconcilingLock
.
Unlock
()
r
.
stopReconcilingCalled
=
true
}
pkg/master/reconcilers/lease_test.go
View file @
14f2a335
...
...
@@ -547,7 +547,7 @@ func TestLeaseEndpointReconciler(t *testing.T) {
}
}
func
TestLease
StopReconciling
(
t
*
testing
.
T
)
{
func
TestLease
RemoveEndpoints
(
t
*
testing
.
T
)
{
ns
:=
corev1
.
NamespaceDefault
om
:=
func
(
name
string
)
metav1
.
ObjectMeta
{
return
metav1
.
ObjectMeta
{
Namespace
:
ns
,
Name
:
name
}
...
...
@@ -627,7 +627,7 @@ func TestLeaseStopReconciling(t *testing.T) {
}
}
r
:=
NewLeaseEndpointReconciler
(
clientset
.
CoreV1
(),
fakeLeases
)
err
:=
r
.
StopReconciling
(
test
.
serviceName
,
net
.
ParseIP
(
test
.
ip
),
test
.
endpointPorts
)
err
:=
r
.
RemoveEndpoints
(
test
.
serviceName
,
net
.
ParseIP
(
test
.
ip
),
test
.
endpointPorts
)
if
err
!=
nil
{
t
.
Errorf
(
"case %q: unexpected error: %v"
,
test
.
testName
,
err
)
}
...
...
pkg/master/reconcilers/mastercount.go
View file @
14f2a335
...
...
@@ -137,10 +137,9 @@ func (r *masterCountEndpointReconciler) ReconcileEndpoints(serviceName string, i
return
err
}
func
(
r
*
masterCountEndpointReconciler
)
StopReconciling
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
func
(
r
*
masterCountEndpointReconciler
)
RemoveEndpoints
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
r
.
reconcilingLock
.
Lock
()
defer
r
.
reconcilingLock
.
Unlock
()
r
.
stopReconcilingCalled
=
true
e
,
err
:=
r
.
endpointClient
.
Endpoints
(
metav1
.
NamespaceDefault
)
.
Get
(
serviceName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
...
...
@@ -167,6 +166,12 @@ func (r *masterCountEndpointReconciler) StopReconciling(serviceName string, ip n
return
err
}
func
(
r
*
masterCountEndpointReconciler
)
StopReconciling
()
{
r
.
reconcilingLock
.
Lock
()
defer
r
.
reconcilingLock
.
Unlock
()
r
.
stopReconcilingCalled
=
true
}
// Determine if the endpoint is in the format ReconcileEndpoints expects.
//
// Return values:
...
...
pkg/master/reconcilers/none.go
View file @
14f2a335
...
...
@@ -18,8 +18,9 @@ limitations under the License.
package
reconcilers
import
(
corev1
"k8s.io/api/core/v1"
"net"
corev1
"k8s.io/api/core/v1"
)
// NoneEndpointReconciler allows for the endpoint reconciler to be disabled
...
...
@@ -36,7 +37,10 @@ func (r *noneEndpointReconciler) ReconcileEndpoints(serviceName string, ip net.I
return
nil
}
//
StopReconciling
noop reconcile
func
(
r
*
noneEndpointReconciler
)
StopReconciling
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
//
RemoveEndpoints
noop reconcile
func
(
r
*
noneEndpointReconciler
)
RemoveEndpoints
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
{
return
nil
}
func
(
r
*
noneEndpointReconciler
)
StopReconciling
()
{
}
pkg/master/reconcilers/reconcilers.go
View file @
14f2a335
...
...
@@ -18,8 +18,9 @@ limitations under the License.
package
reconcilers
import
(
corev1
"k8s.io/api/core/v1"
"net"
corev1
"k8s.io/api/core/v1"
)
// EndpointReconciler knows how to reconcile the endpoints for the apiserver service.
...
...
@@ -35,7 +36,10 @@ type EndpointReconciler interface {
// endpoints for their {rw, ro} services.
// * ReconcileEndpoints is called periodically from all apiservers.
ReconcileEndpoints
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
,
reconcilePorts
bool
)
error
StopReconciling
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
// RemoveEndpoints removes this apiserver's lease.
RemoveEndpoints
(
serviceName
string
,
ip
net
.
IP
,
endpointPorts
[]
corev1
.
EndpointPort
)
error
// StopReonciling turns any later ReconcileEndpoints call into a noop.
StopReconciling
()
}
// Type the reconciler 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