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
142c5a96
Commit
142c5a96
authored
Mar 17, 2017
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup proxy/config
parent
7ce368cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
43 deletions
+4
-43
config.go
pkg/proxy/config/config.go
+4
-25
config_test.go
pkg/proxy/config/config_test.go
+0
-18
No files found.
pkg/proxy/config/config.go
View file @
142c5a96
...
...
@@ -31,31 +31,6 @@ import (
"k8s.io/kubernetes/pkg/util/config"
)
// Operation is a type of operation of services or endpoints.
type
Operation
int
// These are the available operation types.
const
(
ADD
Operation
=
iota
UPDATE
REMOVE
SYNCED
)
// ServiceUpdate describes an operation of services, sent on the channel.
// You can add, update or remove single service by setting Op == ADD|UPDATE|REMOVE.
type
ServiceUpdate
struct
{
Service
*
api
.
Service
Op
Operation
}
// EndpointsUpdate describes an operation of endpoints, sent on the channel.
// You can add, update or remove single endpoints by setting Op == ADD|UPDATE|REMOVE.
type
EndpointsUpdate
struct
{
Endpoints
*
api
.
Endpoints
Op
Operation
}
// ServiceConfigHandler is an abstract interface of objects which receive update notifications for the set of services.
type
ServiceConfigHandler
interface
{
// OnServiceUpdate gets called when a configuration has been changed by one of the sources.
...
...
@@ -118,6 +93,8 @@ func (c *EndpointsConfig) RegisterHandler(handler EndpointsConfigHandler) {
c
.
handlers
=
append
(
c
.
handlers
,
handler
)
}
// Run starts the underlying informer and goroutine responsible for calling
// registered handlers.
func
(
c
*
EndpointsConfig
)
Run
(
stopCh
<-
chan
struct
{})
{
// The updates channel is used to send interrupts to the Endpoints handler.
// It's buffered because we never want to block for as long as there is a
...
...
@@ -217,6 +194,8 @@ func (c *ServiceConfig) RegisterHandler(handler ServiceConfigHandler) {
c
.
handlers
=
append
(
c
.
handlers
,
handler
)
}
// Run starts the underlying informer and goroutine responsible for calling
// registered handlers.
func
(
c
*
ServiceConfig
)
Run
(
stopCh
<-
chan
struct
{})
{
// The updates channel is used to send interrupts to the Services handler.
// It's buffered because we never want to block for as long as there is a
...
...
pkg/proxy/config/config_test.go
View file @
142c5a96
...
...
@@ -28,16 +28,6 @@ import (
"k8s.io/kubernetes/pkg/api"
)
const
TomcatPort
int
=
8080
const
TomcatName
=
"tomcat"
var
TomcatEndpoints
=
map
[
string
]
string
{
"c0"
:
"1.1.1.1:18080"
,
"c1"
:
"2.2.2.2:18081"
}
const
MysqlPort
int
=
3306
const
MysqlName
=
"mysql"
var
MysqlEndpoints
=
map
[
string
]
string
{
"c0"
:
"1.1.1.1:13306"
,
"c3"
:
"2.2.2.2:13306"
}
type
sortedServices
[]
api
.
Service
func
(
s
sortedServices
)
Len
()
int
{
...
...
@@ -130,14 +120,6 @@ func (h *EndpointsHandlerMock) ValidateEndpoints(t *testing.T, expectedEndpoints
}
}
func
CreateServiceUpdate
(
op
Operation
,
service
*
api
.
Service
)
ServiceUpdate
{
return
ServiceUpdate
{
Op
:
op
,
Service
:
service
}
}
func
CreateEndpointsUpdate
(
op
Operation
,
endpoints
*
api
.
Endpoints
)
EndpointsUpdate
{
return
EndpointsUpdate
{
Op
:
op
,
Endpoints
:
endpoints
}
}
func
TestNewServiceAddedAndNotified
(
t
*
testing
.
T
)
{
fakeWatch
:=
watch
.
NewFake
()
lw
:=
fakeLW
{
...
...
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