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
6c734b1c
Commit
6c734b1c
authored
Jul 17, 2014
by
Brendan Burns
Committed by
Clayton Coleman
Jul 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrate minion health checking and caching.
parent
aaf0180e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
apiserver.go
cmd/apiserver/apiserver.go
+4
-1
integration.go
cmd/integration/integration.go
+1
-1
master.go
pkg/master/master.go
+21
-6
No files found.
cmd/apiserver/apiserver.go
View file @
6c734b1c
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"net"
"net"
"net/http"
"net/http"
"strconv"
"strconv"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
...
@@ -38,6 +39,8 @@ var (
...
@@ -38,6 +39,8 @@ var (
cloudProvider
=
flag
.
String
(
"cloud_provider"
,
""
,
"The provider for cloud services. Empty string for no provider."
)
cloudProvider
=
flag
.
String
(
"cloud_provider"
,
""
,
"The provider for cloud services. Empty string for no provider."
)
minionRegexp
=
flag
.
String
(
"minion_regexp"
,
""
,
"If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs"
)
minionRegexp
=
flag
.
String
(
"minion_regexp"
,
""
,
"If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs"
)
minionPort
=
flag
.
Uint
(
"minion_port"
,
10250
,
"The port at which kubelet will be listening on the minions."
)
minionPort
=
flag
.
Uint
(
"minion_port"
,
10250
,
"The port at which kubelet will be listening on the minions."
)
healthCheckMinions
=
flag
.
Bool
(
"health_check_minions"
,
true
,
"If true, health check minions and filter unhealthy ones. [default true]"
)
minionCacheTTL
=
flag
.
Duration
(
"minion_cache_ttl"
,
30
*
time
.
Second
,
"Duration of time to cache minion information. [default 30 seconds]"
)
etcdServerList
,
machineList
util
.
StringList
etcdServerList
,
machineList
util
.
StringList
)
)
...
@@ -80,7 +83,7 @@ func main() {
...
@@ -80,7 +83,7 @@ func main() {
var
m
*
master
.
Master
var
m
*
master
.
Master
if
len
(
etcdServerList
)
>
0
{
if
len
(
etcdServerList
)
>
0
{
m
=
master
.
New
(
etcdServerList
,
machineList
,
podInfoGetter
,
cloud
,
*
minionRegexp
,
client
)
m
=
master
.
New
(
etcdServerList
,
machineList
,
podInfoGetter
,
cloud
,
*
minionRegexp
,
client
,
*
healthCheckMinions
,
*
minionCacheTTL
)
}
else
{
}
else
{
m
=
master
.
NewMemoryServer
(
machineList
,
podInfoGetter
,
cloud
,
client
)
m
=
master
.
NewMemoryServer
(
machineList
,
podInfoGetter
,
cloud
,
client
)
}
}
...
...
cmd/integration/integration.go
View file @
6c734b1c
...
@@ -94,7 +94,7 @@ func startComponents(manifestURL string) (apiServerURL string) {
...
@@ -94,7 +94,7 @@ func startComponents(manifestURL string) (apiServerURL string) {
cl
.
Sync
=
true
cl
.
Sync
=
true
// Master
// Master
m
:=
master
.
New
(
servers
,
machineList
,
fakePodInfoGetter
{},
nil
,
""
,
cl
)
m
:=
master
.
New
(
servers
,
machineList
,
fakePodInfoGetter
{},
nil
,
""
,
cl
,
false
,
0
)
handler
.
delegate
=
m
.
ConstructHandler
(
"/api/v1beta1"
)
handler
.
delegate
=
m
.
ConstructHandler
(
"/api/v1beta1"
)
controllerManager
:=
controller
.
MakeReplicationManager
(
etcdClient
,
cl
)
controllerManager
:=
controller
.
MakeReplicationManager
(
etcdClient
,
cl
)
...
...
pkg/master/master.go
View file @
6c734b1c
...
@@ -55,9 +55,9 @@ func NewMemoryServer(minions []string, podInfoGetter client.PodInfoGetter, cloud
...
@@ -55,9 +55,9 @@ func NewMemoryServer(minions []string, podInfoGetter client.PodInfoGetter, cloud
}
}
// New returns a new instance of Master connected to the given etcdServer.
// New returns a new instance of Master connected to the given etcdServer.
func
New
(
etcdServers
,
minions
[]
string
,
podInfoGetter
client
.
PodInfoGetter
,
cloud
cloudprovider
.
Interface
,
minionRegexp
string
,
client
*
client
.
Client
)
*
Master
{
func
New
(
etcdServers
,
minions
[]
string
,
podInfoGetter
client
.
PodInfoGetter
,
cloud
cloudprovider
.
Interface
,
minionRegexp
string
,
client
*
client
.
Client
,
healthCheckMinions
bool
,
cacheMinionsTTL
time
.
Duration
)
*
Master
{
etcdClient
:=
etcd
.
NewClient
(
etcdServers
)
etcdClient
:=
etcd
.
NewClient
(
etcdServers
)
minionRegistry
:=
minionRegistryMaker
(
minions
,
cloud
,
minionRegexp
)
minionRegistry
:=
minionRegistryMaker
(
minions
,
cloud
,
minionRegexp
,
healthCheckMinions
,
cacheMinionsTTL
)
m
:=
&
Master
{
m
:=
&
Master
{
podRegistry
:
registry
.
MakeEtcdRegistry
(
etcdClient
,
minionRegistry
),
podRegistry
:
registry
.
MakeEtcdRegistry
(
etcdClient
,
minionRegistry
),
controllerRegistry
:
registry
.
MakeEtcdRegistry
(
etcdClient
,
minionRegistry
),
controllerRegistry
:
registry
.
MakeEtcdRegistry
(
etcdClient
,
minionRegistry
),
...
@@ -69,15 +69,30 @@ func New(etcdServers, minions []string, podInfoGetter client.PodInfoGetter, clou
...
@@ -69,15 +69,30 @@ func New(etcdServers, minions []string, podInfoGetter client.PodInfoGetter, clou
return
m
return
m
}
}
func
minionRegistryMaker
(
minions
[]
string
,
cloud
cloudprovider
.
Interface
,
minionRegexp
string
)
registry
.
MinionRegistry
{
func
minionRegistryMaker
(
minions
[]
string
,
cloud
cloudprovider
.
Interface
,
minionRegexp
string
,
healthCheck
bool
,
cacheTTL
time
.
Duration
)
registry
.
MinionRegistry
{
var
minionRegistry
registry
.
MinionRegistry
if
cloud
!=
nil
&&
len
(
minionRegexp
)
>
0
{
if
cloud
!=
nil
&&
len
(
minionRegexp
)
>
0
{
minionRegistry
,
err
:=
registry
.
MakeCloudMinionRegistry
(
cloud
,
minionRegexp
)
var
err
error
minionRegistry
,
err
=
registry
.
MakeCloudMinionRegistry
(
cloud
,
minionRegexp
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to initalize cloud minion registry reverting to static registry (%#v)"
,
err
)
glog
.
Errorf
(
"Failed to initalize cloud minion registry reverting to static registry (%#v)"
,
err
)
}
}
return
minionRegistry
}
}
return
registry
.
MakeMinionRegistry
(
minions
)
if
minionRegistry
==
nil
{
minionRegistry
=
registry
.
MakeMinionRegistry
(
minions
)
}
if
healthCheck
{
minionRegistry
=
registry
.
NewHealthyMinionRegistry
(
minionRegistry
,
&
http
.
Client
{})
}
if
cacheTTL
>
0
{
cachingMinionRegistry
,
err
:=
registry
.
NewCachingMinionRegistry
(
minionRegistry
,
cacheTTL
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to initialize caching layer, ignoring cache."
)
}
else
{
minionRegistry
=
cachingMinionRegistry
}
}
return
minionRegistry
}
}
func
(
m
*
Master
)
init
(
cloud
cloudprovider
.
Interface
,
podInfoGetter
client
.
PodInfoGetter
)
{
func
(
m
*
Master
)
init
(
cloud
cloudprovider
.
Interface
,
podInfoGetter
client
.
PodInfoGetter
)
{
...
...
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