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
2dc404fc
Commit
2dc404fc
authored
Feb 08, 2017
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update REST Handler to return 202 for cascading deletion
parent
4ee81eb0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
rest.go
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go
+15
-3
No files found.
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go
View file @
2dc404fc
...
...
@@ -857,8 +857,10 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
}
trace
.
Step
(
"About do delete object from database"
)
wasDeleted
:=
true
result
,
err
:=
finishRequest
(
timeout
,
func
()
(
runtime
.
Object
,
error
)
{
obj
,
_
,
err
:=
r
.
Delete
(
ctx
,
name
,
options
)
obj
,
deleted
,
err
:=
r
.
Delete
(
ctx
,
name
,
options
)
wasDeleted
=
deleted
return
obj
,
err
})
if
err
!=
nil
{
...
...
@@ -867,12 +869,22 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
}
trace
.
Step
(
"Object deleted from database"
)
status
:=
http
.
StatusOK
// Return http.StatusAccepted if the resource was not deleted immediately and
// user requested cascading deletion by setting OrphanDependents=false.
// Note: We want to do this always if resource was not deleted immediately, but
// that will break existing clients.
// Other cases where resource is not instantly deleted are: namespace deletion
// and pod graceful deletion.
if
!
wasDeleted
&&
options
.
OrphanDependents
!=
nil
&&
*
options
.
OrphanDependents
==
false
{
status
=
http
.
StatusAccepted
}
// if the rest.Deleter returns a nil object, fill out a status. Callers may return a valid
// object with the response.
if
result
==
nil
{
result
=
&
metav1
.
Status
{
Status
:
metav1
.
StatusSuccess
,
Code
:
http
.
StatusOK
,
Code
:
int32
(
status
)
,
Details
:
&
metav1
.
StatusDetails
{
Name
:
name
,
Kind
:
scope
.
Kind
.
Kind
,
...
...
@@ -887,7 +899,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
}
}
}
responsewriters
.
WriteObject
(
http
.
StatusOK
,
scope
.
Kind
.
GroupVersion
(),
scope
.
Serializer
,
result
,
w
,
req
.
Request
)
responsewriters
.
WriteObject
(
status
,
scope
.
Kind
.
GroupVersion
(),
scope
.
Serializer
,
result
,
w
,
req
.
Request
)
}
}
...
...
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