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
436fedd6
Commit
436fedd6
authored
Sep 18, 2015
by
Sam Ghods
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up comments on replication manager
parent
7ddbdc47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
replication_controller.go
pkg/controller/replication/replication_controller.go
+19
-14
No files found.
pkg/controller/replication/replication_controller.go
View file @
436fedd6
...
@@ -75,23 +75,22 @@ type ReplicationManager struct {
...
@@ -75,23 +75,22 @@ type ReplicationManager struct {
// To allow injection of syncReplicationController for testing.
// To allow injection of syncReplicationController for testing.
syncHandler
func
(
rcKey
string
)
error
syncHandler
func
(
rcKey
string
)
error
// podStoreSynced returns true if the pod store has been synced at least once.
// Added as a member to the struct to allow injection for testing.
podStoreSynced
func
()
bool
// A TTLCache of pod creates/deletes each rc expects to see
// A TTLCache of pod creates/deletes each rc expects to see
expectations
controller
.
ControllerExpectationsInterface
expectations
controller
.
ControllerExpectationsInterface
// A store of replication controllers, populated by the rcController
// A store of replication controllers, populated by the rcController
rcStore
cache
.
StoreToReplicationControllerLister
rcStore
cache
.
StoreToReplicationControllerLister
// A store of pods, populated by the podController
podStore
cache
.
StoreToPodLister
// Watches changes to all replication controllers
// Watches changes to all replication controllers
rcController
*
framework
.
Controller
rcController
*
framework
.
Controller
// A store of pods, populated by the podController
podStore
cache
.
StoreToPodLister
// Watches changes to all pods
// Watches changes to all pods
podController
*
framework
.
Controller
podController
*
framework
.
Controller
// Controllers that need to be updated
// podStoreSynced returns true if the pod store has been synced at least once.
// Added as a member to the struct to allow injection for testing.
podStoreSynced
func
()
bool
// Controllers that need to be synced
queue
*
workqueue
.
Type
queue
*
workqueue
.
Type
}
}
...
@@ -126,12 +125,18 @@ func NewReplicationManager(kubeClient client.Interface, burstReplicas int) *Repl
...
@@ -126,12 +125,18 @@ func NewReplicationManager(kubeClient client.Interface, burstReplicas int) *Repl
framework
.
ResourceEventHandlerFuncs
{
framework
.
ResourceEventHandlerFuncs
{
AddFunc
:
rm
.
enqueueController
,
AddFunc
:
rm
.
enqueueController
,
UpdateFunc
:
func
(
old
,
cur
interface
{})
{
UpdateFunc
:
func
(
old
,
cur
interface
{})
{
// We only really need to do this when spec changes, but for correctness it is safer to
// You might imagine that we only really need to enqueue the
// periodically double check. It is overkill for 2 reasons:
// controller when Spec changes, but it is safer to sync any
// 1. Status.Replica updates will cause a sync
// time this function is triggered. That way a full informer
// 2. Every 30s we will get a full resync (this will happen anyway every 5 minutes when pods relist)
// resync can requeue any controllers that don't yet have pods
// However, it shouldn't be that bad as rcs that haven't met expectations won't sync, and all
// but whose last attempts at creating a pod have failed (since
// the listing is done using local stores.
// we don't block on creation of pods) instead of those
// controllers stalling indefinitely. Enqueueing every time
// does result in some spurious syncs (like when Status.Replica
// is updated and the watch notification from it retriggers
// this function), but in general extra resyncs shouldn't be
// that bad as rcs that haven't met expectations yet won't
// sync, and all the listing is done using local stores.
oldRC
:=
old
.
(
*
api
.
ReplicationController
)
oldRC
:=
old
.
(
*
api
.
ReplicationController
)
curRC
:=
cur
.
(
*
api
.
ReplicationController
)
curRC
:=
cur
.
(
*
api
.
ReplicationController
)
if
oldRC
.
Status
.
Replicas
!=
curRC
.
Status
.
Replicas
{
if
oldRC
.
Status
.
Replicas
!=
curRC
.
Status
.
Replicas
{
...
...
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