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
1b831bab
Commit
1b831bab
authored
Feb 29, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move deployment Add/Update/DeleteFunc into functions
parent
1960243d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+34
-28
No files found.
pkg/controller/deployment/deployment_controller.go
View file @
1b831bab
...
@@ -114,35 +114,10 @@ func NewDeploymentController(client clientset.Interface, resyncPeriod controller
...
@@ -114,35 +114,10 @@ func NewDeploymentController(client clientset.Interface, resyncPeriod controller
&
extensions
.
Deployment
{},
&
extensions
.
Deployment
{},
FullDeploymentResyncPeriod
,
FullDeploymentResyncPeriod
,
framework
.
ResourceEventHandlerFuncs
{
framework
.
ResourceEventHandlerFuncs
{
AddFunc
:
func
(
obj
interface
{})
{
AddFunc
:
dc
.
addDeploymentNotification
,
d
:=
obj
.
(
*
extensions
.
Deployment
)
UpdateFunc
:
dc
.
updateDeploymentNotification
,
glog
.
V
(
4
)
.
Infof
(
"Adding deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
d
)
},
UpdateFunc
:
func
(
old
,
cur
interface
{})
{
oldD
:=
old
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Updating deployment %s"
,
oldD
.
Name
)
// Resync on deployment object relist.
dc
.
enqueueDeployment
(
cur
.
(
*
extensions
.
Deployment
))
},
// This will enter the sync loop and no-op, because the deployment has been deleted from the store.
// This will enter the sync loop and no-op, because the deployment has been deleted from the store.
DeleteFunc
:
func
(
obj
interface
{})
{
DeleteFunc
:
dc
.
deleteDeploymentNotification
,
d
,
ok
:=
obj
.
(
*
extensions
.
Deployment
)
if
!
ok
{
tombstone
,
ok
:=
obj
.
(
cache
.
DeletedFinalStateUnknown
)
if
!
ok
{
glog
.
Errorf
(
"Couldn't get object from tombstone %+v"
,
obj
)
return
}
d
,
ok
=
tombstone
.
Obj
.
(
*
extensions
.
Deployment
)
if
!
ok
{
glog
.
Errorf
(
"Tombstone contained object that is not a Deployment %+v"
,
obj
)
return
}
}
glog
.
V
(
4
)
.
Infof
(
"Deleting deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
d
)
},
},
},
)
)
...
@@ -202,6 +177,37 @@ func (dc *DeploymentController) Run(workers int, stopCh <-chan struct{}) {
...
@@ -202,6 +177,37 @@ func (dc *DeploymentController) Run(workers int, stopCh <-chan struct{}) {
dc
.
queue
.
ShutDown
()
dc
.
queue
.
ShutDown
()
}
}
func
(
dc
*
DeploymentController
)
addDeploymentNotification
(
obj
interface
{})
{
d
:=
obj
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Adding deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
d
)
}
func
(
dc
*
DeploymentController
)
updateDeploymentNotification
(
old
,
cur
interface
{})
{
oldD
:=
old
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Updating deployment %s"
,
oldD
.
Name
)
// Resync on deployment object relist.
dc
.
enqueueDeployment
(
cur
.
(
*
extensions
.
Deployment
))
}
func
(
dc
*
DeploymentController
)
deleteDeploymentNotification
(
obj
interface
{})
{
d
,
ok
:=
obj
.
(
*
extensions
.
Deployment
)
if
!
ok
{
tombstone
,
ok
:=
obj
.
(
cache
.
DeletedFinalStateUnknown
)
if
!
ok
{
glog
.
Errorf
(
"Couldn't get object from tombstone %+v"
,
obj
)
return
}
d
,
ok
=
tombstone
.
Obj
.
(
*
extensions
.
Deployment
)
if
!
ok
{
glog
.
Errorf
(
"Tombstone contained object that is not a Deployment %+v"
,
obj
)
return
}
}
glog
.
V
(
4
)
.
Infof
(
"Deleting deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
d
)
}
// addReplicaSet enqueues the deployment that manages a ReplicaSet when the ReplicaSet is created.
// addReplicaSet enqueues the deployment that manages a ReplicaSet when the ReplicaSet is created.
func
(
dc
*
DeploymentController
)
addReplicaSet
(
obj
interface
{})
{
func
(
dc
*
DeploymentController
)
addReplicaSet
(
obj
interface
{})
{
rs
:=
obj
.
(
*
extensions
.
ReplicaSet
)
rs
:=
obj
.
(
*
extensions
.
ReplicaSet
)
...
...
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