| Summary: | oc scale/patch with record True does not add the change-cause annotation | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | XiaochuanWang <xiaocwan> |
| Component: | openshift-controller-manager | Assignee: | Michal Fojtik <mfojtik> |
| Status: | CLOSED EOL | QA Contact: | zhou ying <yinzhou> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | unspecified | CC: | aos-bugs, mfojtik, mmccomas, pweil |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-08-23 12:49:05 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: | |
|
Description
XiaochuanWang
2016-09-02 09:49:51 UTC
Reassigning since the issue seems to be server-side when patching the deployment config. In the request body of the patch request in logs, it looks like the 'metadata' field is missing
{"annotations":{"kubernetes.io/change-cause":"oc scale dc/ho --replicas=2 --record=true --loglevel=8"}}
should be
'{"metadata":{"annotations":{"kubernetes.io/change-cause":"oc scale dc/ho --replicas=2 --record=true --loglevel=10"}}}'
Patching via 'oc patch' or 'curl' with the version with 'metadata' works fine.
Scaling the rc directly in kubectl with --record=true also adds the annotation correctly:
kubectl scale rc ho-1 --replicas=3 --record=true ; kubectl get rc ho-1 -o yaml | grep change-cause
Can confirm @ffranz's comment. I tested `oc scale` by adding the following line: > patchBytes = []byte(fmt.Sprintf("{\"metadata\":%v}", string(patchBytes))) in this location: https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/scale.go#L165 recompiled, and the patch now worked as expected. `oc patch --record=true` lost the record on Origin but not reproduced on OCP:
oc v1.4.0-alpha.0+6e155d0
# oc patch dc/ho -p '{"metadata":{"labels":{"run":"hotrue"}}}' --record=true
# oc get dc -o yaml | grep change-cause
Here is nothing output.
oc v3.3.0.31
# oc get dc -o yaml | grep -A1 change-cause
kubernetes.io/change-cause: oc patch dc/ho -p {"metadata":{"labels":{"run":"hotrue"}}}
--record=true
Fixed here: https://github.com/openshift/origin/pull/11727 |