Bug 1334866

Summary: metadata.deletionTimestamp settable during update
Product: OpenShift Container Platform Reporter: Jordan Liggitt <jliggitt>
Component: MasterAssignee: Jordan Liggitt <jliggitt>
Status: CLOSED ERRATA QA Contact: weiwei jiang <wjiang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.2.0CC: adellape, aos-bugs, jokerman, mmccomas, tdawson, wsun
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, it was possible to set the metadata.deletionTimestamp parameter during the update of an object. However, deletionTimestamp and deletionGracePeriodSeconds fields should only be able to be set as a result of a delete API operation. This bug fix ensures that the parameter cannot be set during update, and any attempts now produce a "field is immutable; may only be changed via deletion" error.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-27 15:07:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jordan Liggitt 2016-05-10 16:57:48 UTC
Description of problem:

During update of an object, metadata.deletionTimestamp can be set. deletionTimestamp and deletionGracePeriodSeconds fields should only be able to be set as a result of a delete API operation.


Upstream issue: https://github.com/kubernetes/kubernetes/issues/24828
Upstream fix: https://github.com/kubernetes/kubernetes/pull/24839


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Jordan Liggitt 2016-05-10 16:59:27 UTC
Fixed in https://github.com/openshift/ose/pull/193

Comment 3 weiwei jiang 2016-06-06 10:16:46 UTC
Checked with atomic-openshift-3.2.1.1-1.git.0.96f9555.el7, and the deletionTimestamp is an immutable field now.

# oc edit dc php
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# deploymentconfigs "php" was not valid:
# * metadata.deletionTimestamp: Invalid value: "2016-06-06T09:52:05Z": field is immutable; may only be changed via deletion
# * metadata.deletionTimestamp: Invalid value: "2016-06-06T09:52:05Z": field is immutable; may only be changed via deletion
#
apiVersion: v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: 2016-06-06T09:51:05Z
  deletionTimestamp: 2016-06-06T09:52:05Z


# oc patch dc php -p '{"metadata":{"deletionTimestamp":"2016-06-06T09:52:05Z"}}' 
The DeploymentConfig "php" is invalid.

* metadata.deletionTimestamp: Invalid value: "2016-06-06T09:52:05Z": field is immutable; may only be changed via deletion
* metadata.deletionTimestamp: Invalid value: "2016-06-06T09:52:05Z": field is immutable; may only be changed via deletion

But why display the message twice?

Comment 4 Jordan Liggitt 2016-06-06 13:50:49 UTC
validation of core object metadata fields is done centrally on update of all objects. some object update validation also calls this method, which means that errors it produces could be seen twice.

this occurs if you try to change the name, uid, or other immutable fields inside metadata as well.

this isn't related to this bug, so moving back to ON_QA

Comment 5 weiwei jiang 2016-06-07 02:08:20 UTC
(In reply to Jordan Liggitt from comment #4)
> validation of core object metadata fields is done centrally on update of all
> objects. some object update validation also calls this method, which means
> that errors it produces could be seen twice.
> 
> this occurs if you try to change the name, uid, or other immutable fields
> inside metadata as well.
> 
> this isn't related to this bug, so moving back to ON_QA

Since the issue in this bug has been fixed, so move to verified.

Comment 7 errata-xmlrpc 2016-06-27 15:07:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1343