Bug 1529659 - `oc patch --type=strategic` should prompt the name of the required key
Summary: `oc patch --type=strategic` should prompt the name of the required key
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Master
Version: 3.9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.9.0
Assignee: Michal Fojtik
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-29 07:31 UTC by Xingxing Xia
Modified: 2018-06-18 18:27 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-18 14:19:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xingxing Xia 2017-12-29 07:31:49 UTC
Description of problem:
`oc patch --type=strategic` should prompt the required key's name when updating array element

Version-Release number of selected component (if applicable):
OCP v3.9.0-0.9.0
Seems it is server issue, because testing with oc v3.9.0-0.9.0 against server v3.9.0-0.8.0 can prompt the required key's name, as shown in below "[Note 1]"

How reproducible:
Always

Steps to Reproduce:
1. Create resource whose YAML has array, e.g.
$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/services/multi-portsvc.json
$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/rc-with-two-containers.yaml

2. Run `oc patch --type=strategic ...` (--type=strategic is by default)
a) $ oc patch svc multi-portsvc --type=strategic -p '
spec:
  ports:
  - targetPort: 441'

b) $ oc patch rc rctest -p='
spec:
  template:
    spec:
      containers:
      - resources:
          limits:
            memory: 258Mi'

Actual results:
2. It improves readability than before [Note 1], but it doesn't prompt the name of the required key's name to user
a) Output is:
The Service "multi-portsvc" is invalid: spec.ports: Required value
b) Output is:
The ReplicationController "rctest" is invalid: spec.template.spec.containers: Required value

* [Note 1] Before, the output is not good to read, but it can show the required key's name:
Error from server: map: map[targetPort:441] does not contain declared merge key: port

Expected results:
2. Should prompt the required key's name to user

Additional info:

Comment 2 Jordan Liggitt 2018-01-03 16:38:31 UTC
I don't see an issue either. Can you open one upstream?

Comment 3 Michal Fojtik 2018-01-04 09:27:12 UTC
Upstream issue: https://github.com/kubernetes/kubernetes/issues/57834

Comment 4 Juan Vallejo 2018-01-08 19:06:47 UTC
Upstream PR: https://github.com/kubernetes/kubernetes/pull/57854

Comment 5 Michal Fojtik 2018-01-29 14:18:27 UTC
Downstream: https://github.com/openshift/origin/pull/18331

Comment 6 Xingxing Xia 2018-01-31 06:59:45 UTC
Downstream PR was just merged 3 hours ago and does not come in OCP yet. Waiting for it coming to OCP next version to verify it

Comment 7 Xingxing Xia 2018-02-05 06:03:12 UTC
Checked in OCP v3.9.0-0.36.0, now the steps in bug description return respectively:
Error from server: map: map[targetPort:441] does not contain declared merge key: port

Error from server: map: map[resources:map[limits:map[memory:258Mi]]] does not contain declared merge key: name

i.e., they prompt the name of the required key


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