Merge pull request #45167 from deads2k/api-09-unstructured-fix

Automatic merge from submit-queue

prevent panic on setting nil deletion timestamp

Setting a nil deletionstamp on unstructured causes panics.  This is done when preparing for create.
pull/6/head
Kubernetes Submit Queue 2017-05-01 10:01:25 -07:00 committed by GitHub
commit c51efa9ba0
1 changed files with 4 additions and 0 deletions

View File

@ -406,6 +406,10 @@ func (u *Unstructured) GetDeletionTimestamp() *metav1.Time {
}
func (u *Unstructured) SetDeletionTimestamp(timestamp *metav1.Time) {
if timestamp == nil {
u.setNestedField(nil, "metadata", "deletionTimestamp")
return
}
ts, _ := timestamp.MarshalQueryParameter()
u.setNestedField(ts, "metadata", "deletionTimestamp")
}