Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1517700 - It will delete all the RCs in the project when deleting non-existing dc with name started or ended with special chars
It will delete all the RCs in the project when deleting non-existing dc with ...
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Deployments (Show other bugs)
3.7.0
Unspecified Unspecified
high Severity high
: ---
: 3.7.z
Assigned To: Tomáš Nožička
zhou ying
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-27 04:21 EST by Meng Bo
Modified: 2018-04-05 05:32 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-05 05:32:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0636 None None None 2018-04-05 05:32 EDT

  None (edit)
Description Meng Bo 2017-11-27 04:21:33 EST
Description of problem:
When trying to delete the non-existing dc with name started or ended with special chars, like _, -, *, =. It will report success and all the RCs in the project are deleted.

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

How reproducible:
always

Steps to Reproduce:
1. Try to delete dc with name started or ended with special chars
[user1@ose-master ~]$ oc get rc 
NAME      DESIRED   CURRENT   READY     AGE
test-rc   2         2         0         2s
[user1@ose-master ~]$ oc get dc
No resources found.
[user1@ose-master ~]$ oc delete dc _aaaa                         # non-existing dc with name started or ended with special chars
deploymentconfig "_aaaa" deleted
[user1@ose-master ~]$ oc get rc
No resources found.

2.
3.

Actual results:
[user1@ose-master ~]$ oc delete dc _aaaa --loglevel=6
....
I1127 16:03:32.645365    6594 round_trippers.go:405] PATCH https://ose-master.bmeng.local:8443/apis/apps.openshift.io/v1/namespaces/bmengp1/deploymentconfigs/_aaaa 404 Not Found in 8 milliseconds
I1127 16:03:32.647934    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers 200 OK in 2 milliseconds
I1127 16:03:32.649474    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers/test-rc 200 OK in 1 milliseconds
I1127 16:03:32.650558    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers 200 OK in 0 milliseconds
I1127 16:03:32.651675    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers/test-rc 200 OK in 0 milliseconds
I1127 16:03:32.661839    6594 round_trippers.go:405] PUT https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers/test-rc 200 OK in 7 milliseconds
I1127 16:03:32.671572    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers/test-rc 200 OK in 9 milliseconds
I1127 16:03:32.673784    6594 round_trippers.go:405] GET https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers?fieldSelector=metadata.name%3Dtest-rc&resourceVersion=285985&watch=true 200 OK in 1 milliseconds
I1127 16:03:32.929943    6594 round_trippers.go:405] DELETE https://ose-master.bmeng.local:8443/api/v1/namespaces/bmengp1/replicationcontrollers/test-rc 200 OK in 146 milliseconds
....
deploymentconfig "_aaaa" deleted


Expected results:


Additional info:
Comment 1 Tomáš Nožička 2017-11-27 14:34:28 EST
I could reproduce it and traced it down to:

 1. cli doesn't validate the name (even upstream I think)
 2. apimachinery bug that ignores the error and returns selector matching all
Comment 2 Tomáš Nožička 2017-11-29 09:39:57 EST
https://github.com/openshift/origin/pull/17492
Comment 3 Tomáš Nožička 2018-01-02 04:17:16 EST
backport for ose 3.7 - https://github.com/openshift/ose/pull/979
Comment 4 ge liu 2018-01-31 00:37:11 EST
Verified on ocp 3.7,

openshift v3.7.27
kubernetes v1.7.6+a08f5eeb62
etcd 3.2.8

# oc delete dc _aaaa 
Error from server (BadRequest): unable to parse requirement: invalid label value: "_aaaa": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
[root@ip-172-18-1-126 ~]# oc get rc
NAME                   DESIRED   CURRENT   READY     AGE
deployment-example-1   1         1         1         2m

# oc delete dc deployment-example _aaaa 
deploymentconfig "deployment-example" deleted
Error from server (BadRequest): unable to parse requirement: invalid label value: "_aaaa": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
# oc get dc
ocNo resources found.
# oc get rc
No resources found.
Comment 8 errata-xmlrpc 2018-04-05 05:32:08 EDT
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-2018:0636

Note You need to log in before you can comment on or make changes to this bug.