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
37534b66
Commit
37534b66
authored
Mar 02, 2017
by
Anthony Yeh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deployment: Always set BlockOwnerDeletion in ControllerRef.
parent
57fb5e2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
controller_ref_manager.go
pkg/controller/controller_ref_manager.go
+1
-1
sync.go
pkg/controller/deployment/sync.go
+7
-5
No files found.
pkg/controller/controller_ref_manager.go
View file @
37534b66
...
@@ -296,7 +296,7 @@ func (m *ReplicaSetControllerRefManager) AdoptReplicaSet(replicaSet *extensions.
...
@@ -296,7 +296,7 @@ func (m *ReplicaSetControllerRefManager) AdoptReplicaSet(replicaSet *extensions.
// Note that ValidateOwnerReferences() will reject this patch if another
// Note that ValidateOwnerReferences() will reject this patch if another
// OwnerReference exists with controller=true.
// OwnerReference exists with controller=true.
addControllerPatch
:=
fmt
.
Sprintf
(
addControllerPatch
:=
fmt
.
Sprintf
(
`{"metadata":{"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true}],"uid":"%s"}}`
,
`{"metadata":{"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true
,"blockOwnerDeletion":true
}],"uid":"%s"}}`
,
m
.
controllerKind
.
GroupVersion
(),
m
.
controllerKind
.
Kind
,
m
.
controllerKind
.
GroupVersion
(),
m
.
controllerKind
.
Kind
,
m
.
controller
.
GetName
(),
m
.
controller
.
GetUID
(),
replicaSet
.
UID
)
m
.
controller
.
GetName
(),
m
.
controller
.
GetUID
(),
replicaSet
.
UID
)
return
m
.
rsControl
.
PatchReplicaSet
(
replicaSet
.
Namespace
,
replicaSet
.
Name
,
[]
byte
(
addControllerPatch
))
return
m
.
rsControl
.
PatchReplicaSet
(
replicaSet
.
Namespace
,
replicaSet
.
Name
,
[]
byte
(
addControllerPatch
))
...
...
pkg/controller/deployment/sync.go
View file @
37534b66
...
@@ -616,12 +616,14 @@ func (dc *DeploymentController) isScalingEvent(d *extensions.Deployment, rsList
...
@@ -616,12 +616,14 @@ func (dc *DeploymentController) isScalingEvent(d *extensions.Deployment, rsList
// newControllerRef returns a ControllerRef pointing to the deployment.
// newControllerRef returns a ControllerRef pointing to the deployment.
func
newControllerRef
(
d
*
extensions
.
Deployment
)
*
metav1
.
OwnerReference
{
func
newControllerRef
(
d
*
extensions
.
Deployment
)
*
metav1
.
OwnerReference
{
blockOwnerDeletion
:=
true
isController
:=
true
isController
:=
true
return
&
metav1
.
OwnerReference
{
return
&
metav1
.
OwnerReference
{
APIVersion
:
controllerKind
.
GroupVersion
()
.
String
(),
APIVersion
:
controllerKind
.
GroupVersion
()
.
String
(),
Kind
:
controllerKind
.
Kind
,
Kind
:
controllerKind
.
Kind
,
Name
:
d
.
Name
,
Name
:
d
.
Name
,
UID
:
d
.
UID
,
UID
:
d
.
UID
,
Controller
:
&
isController
,
BlockOwnerDeletion
:
&
blockOwnerDeletion
,
Controller
:
&
isController
,
}
}
}
}
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