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
4d7e9052
Unverified
Commit
4d7e9052
authored
May 31, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 31, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77582 from mrkm4ntr/clean-proxy-config
Clean up code in proxy/config
parents
bdf3d248
bc76a18d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
21 deletions
+2
-21
BUILD
pkg/proxy/config/BUILD
+0
-1
config.go
pkg/proxy/config/config.go
+2
-20
No files found.
pkg/proxy/config/BUILD
View file @
4d7e9052
...
...
@@ -18,7 +18,6 @@ go_library(
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
...
...
pkg/proxy/config/config.go
View file @
4d7e9052
...
...
@@ -23,7 +23,6 @@ import (
"k8s.io/api/core/v1"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
coreinformers
"k8s.io/client-go/informers/core/v1"
listers
"k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/controller"
...
...
@@ -64,9 +63,7 @@ type EndpointsHandler interface {
}
// EndpointsConfig tracks a set of endpoints configurations.
// It accepts "set", "add" and "remove" operations of endpoints via channels, and invokes registered handlers on change.
type
EndpointsConfig
struct
{
lister
listers
.
EndpointsLister
listerSynced
cache
.
InformerSynced
eventHandlers
[]
EndpointsHandler
}
...
...
@@ -74,7 +71,6 @@ type EndpointsConfig struct {
// NewEndpointsConfig creates a new EndpointsConfig.
func
NewEndpointsConfig
(
endpointsInformer
coreinformers
.
EndpointsInformer
,
resyncPeriod
time
.
Duration
)
*
EndpointsConfig
{
result
:=
&
EndpointsConfig
{
lister
:
endpointsInformer
.
Lister
(),
listerSynced
:
endpointsInformer
.
Informer
()
.
HasSynced
,
}
...
...
@@ -95,12 +91,9 @@ func (c *EndpointsConfig) RegisterEventHandler(handler EndpointsHandler) {
c
.
eventHandlers
=
append
(
c
.
eventHandlers
,
handler
)
}
// Run
starts the goroutine responsible for calling registered handlers
.
// Run
waits for cache synced and invokes handlers after syncing
.
func
(
c
*
EndpointsConfig
)
Run
(
stopCh
<-
chan
struct
{})
{
defer
utilruntime
.
HandleCrash
()
klog
.
Info
(
"Starting endpoints config controller"
)
defer
klog
.
Info
(
"Shutting down endpoints config controller"
)
if
!
controller
.
WaitForCacheSync
(
"endpoints config"
,
stopCh
,
c
.
listerSynced
)
{
return
...
...
@@ -110,8 +103,6 @@ func (c *EndpointsConfig) Run(stopCh <-chan struct{}) {
klog
.
V
(
3
)
.
Infof
(
"Calling handler.OnEndpointsSynced()"
)
c
.
eventHandlers
[
i
]
.
OnEndpointsSynced
()
}
<-
stopCh
}
func
(
c
*
EndpointsConfig
)
handleAddEndpoints
(
obj
interface
{})
{
...
...
@@ -163,9 +154,7 @@ func (c *EndpointsConfig) handleDeleteEndpoints(obj interface{}) {
}
// ServiceConfig tracks a set of service configurations.
// It accepts "set", "add" and "remove" operations of services via channels, and invokes registered handlers on change.
type
ServiceConfig
struct
{
lister
listers
.
ServiceLister
listerSynced
cache
.
InformerSynced
eventHandlers
[]
ServiceHandler
}
...
...
@@ -173,7 +162,6 @@ type ServiceConfig struct {
// NewServiceConfig creates a new ServiceConfig.
func
NewServiceConfig
(
serviceInformer
coreinformers
.
ServiceInformer
,
resyncPeriod
time
.
Duration
)
*
ServiceConfig
{
result
:=
&
ServiceConfig
{
lister
:
serviceInformer
.
Lister
(),
listerSynced
:
serviceInformer
.
Informer
()
.
HasSynced
,
}
...
...
@@ -194,13 +182,9 @@ func (c *ServiceConfig) RegisterEventHandler(handler ServiceHandler) {
c
.
eventHandlers
=
append
(
c
.
eventHandlers
,
handler
)
}
// Run starts the goroutine responsible for calling
// registered handlers.
// Run waits for cache synced and invokes handlers after syncing.
func
(
c
*
ServiceConfig
)
Run
(
stopCh
<-
chan
struct
{})
{
defer
utilruntime
.
HandleCrash
()
klog
.
Info
(
"Starting service config controller"
)
defer
klog
.
Info
(
"Shutting down service config controller"
)
if
!
controller
.
WaitForCacheSync
(
"service config"
,
stopCh
,
c
.
listerSynced
)
{
return
...
...
@@ -210,8 +194,6 @@ func (c *ServiceConfig) Run(stopCh <-chan struct{}) {
klog
.
V
(
3
)
.
Info
(
"Calling handler.OnServiceSynced()"
)
c
.
eventHandlers
[
i
]
.
OnServiceSynced
()
}
<-
stopCh
}
func
(
c
*
ServiceConfig
)
handleAddService
(
obj
interface
{})
{
...
...
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